Changes to support calls from VIF Driver and Scheduler.
This commit is contained in:
parent
5186e6de11
commit
3cf38401c4
@ -41,7 +41,7 @@ PPDEFAULT = 'default'
|
||||
VLANID = 'vlan_id'
|
||||
VLANNAME = 'vlan_name'
|
||||
PORTPROFILENAME = 'portprofile_name'
|
||||
QOS='qos'
|
||||
QOS = 'qos'
|
||||
|
||||
ATTACHMENT = 'attachment'
|
||||
PORT_ID = 'port-id'
|
||||
|
@ -13,7 +13,7 @@ max_port_profiles=65568
|
||||
max_networks=65568
|
||||
|
||||
[MODEL]
|
||||
model_class=quantum.plugins.cisco.models.l2network_single_blade.L2NetworkSinlgeBlade
|
||||
model_class=quantum.plugins.cisco.models.l2network_multi_blade.L2NetworkMultiBlade
|
||||
|
||||
[SEGMENTATION]
|
||||
manager_class=quantum.plugins.cisco.segmentation.l2network_vlan_mgr.L2NetworkVLANMgr
|
||||
|
@ -116,6 +116,8 @@ class L2NetworkMultiBlade(L2NetworkModelBase):
|
||||
|
||||
def create_port(self, args):
|
||||
"""Support for the Quantum core API call"""
|
||||
if not const.UCS_PLUGIN in self._plugins.keys():
|
||||
return
|
||||
least_reserved_blade_dict = \
|
||||
self._ucs_inventory.get_least_reserved_blade()
|
||||
if not least_reserved_blade_dict:
|
||||
@ -129,6 +131,8 @@ class L2NetworkMultiBlade(L2NetworkModelBase):
|
||||
|
||||
def delete_port(self, args):
|
||||
"""Support for the Quantum core API call"""
|
||||
if not const.UCS_PLUGIN in self._plugins.keys():
|
||||
return
|
||||
rsvd_info = \
|
||||
self._ucs_inventory.get_rsvd_blade_intf_by_port(args[0],
|
||||
args[2])
|
||||
@ -152,6 +156,8 @@ class L2NetworkMultiBlade(L2NetworkModelBase):
|
||||
|
||||
def plug_interface(self, args):
|
||||
"""Support for the Quantum core API call"""
|
||||
if not const.UCS_PLUGIN in self._plugins.keys():
|
||||
return
|
||||
rsvd_info = \
|
||||
self._ucs_inventory.get_rsvd_blade_intf_by_port(args[0],
|
||||
args[2])
|
||||
@ -162,6 +168,8 @@ class L2NetworkMultiBlade(L2NetworkModelBase):
|
||||
|
||||
def unplug_interface(self, args):
|
||||
"""Support for the Quantum core API call"""
|
||||
if not const.UCS_PLUGIN in self._plugins.keys():
|
||||
return
|
||||
rsvd_info = \
|
||||
self._ucs_inventory.get_rsvd_blade_intf_by_port(args[0],
|
||||
args[2])
|
||||
@ -173,7 +181,12 @@ class L2NetworkMultiBlade(L2NetworkModelBase):
|
||||
def get_host(self, args):
|
||||
"""Provides the hostname on which a dynamic vnic is reserved"""
|
||||
LOG.debug("get_host() called\n")
|
||||
host_list = {const.HOST_LIST: {const.HOST_1: platform.node()}}
|
||||
if not const.UCS_PLUGIN in self._plugins.keys():
|
||||
return
|
||||
tenant_id = args[0]
|
||||
instance_id = args[1]
|
||||
host_name = self._ucs_inventory.get_host_name(tenant_id, instance_id)
|
||||
host_list = {const.HOST_LIST: {const.HOST_1: host_name}}
|
||||
return host_list
|
||||
|
||||
def get_instance_port(self, args):
|
||||
@ -181,6 +194,13 @@ class L2NetworkMultiBlade(L2NetworkModelBase):
|
||||
Get the portprofile name and the device namei for the dynamic vnic
|
||||
"""
|
||||
LOG.debug("get_instance_port() called\n")
|
||||
vif_desc = {const.VIF_DESC:
|
||||
{const.DEVICENAME: "eth2", const.UCSPROFILE: "default"}}
|
||||
if not const.UCS_PLUGIN in self._plugins.keys():
|
||||
return
|
||||
tenant_id = args[0]
|
||||
instance_id = args[1]
|
||||
vif_id = args[2]
|
||||
vif_info = self._ucs_inventory.get_instance_port(tenant_id,
|
||||
instance_id,
|
||||
vif_id)
|
||||
vif_desc = {const.VIF_DESC: vif_info}
|
||||
return vif_desc
|
||||
|
@ -404,7 +404,7 @@ class UCSInventory(object):
|
||||
return host_name
|
||||
return None
|
||||
|
||||
def get_instance_port(self, tenant_id, instance_id, vif_id):
|
||||
def get_instance_port(self, tenant_id, instance_id, vif_id=None):
|
||||
"""
|
||||
Return the device name for a reserved interface
|
||||
"""
|
||||
@ -428,60 +428,14 @@ class UCSInventory(object):
|
||||
port_id = port_binding[const.PORTID]
|
||||
udb.update_portbinding(port_id,
|
||||
vif_id=vif_id)
|
||||
return blade_intf_data[blade_intf]\
|
||||
device_name = blade_intf_data[blade_intf]\
|
||||
[const.BLADE_INTF_RHEL_DEVICE_NAME]
|
||||
profile_name = port_binding[const.PORTPROFILENAME]
|
||||
return {const.DEVICENAME: device_name,
|
||||
const.UCSPROFILE: profile_name}
|
||||
return None
|
||||
|
||||
def add_blade(self, ucsm_ip, chassis_id, blade_id):
|
||||
"""Add a blade to the inventory"""
|
||||
# TODO (Sumit)
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
#client = UCSInventory()
|
||||
#client.build_state()
|
||||
ucsinv = UCSInventory()
|
||||
reserved_nics = []
|
||||
ucsinv.build_inventory_state()
|
||||
while True:
|
||||
reserved_blade_dict = ucsinv.get_least_reserved_blade()
|
||||
if not reserved_blade_dict:
|
||||
print "No more unreserved blades\n"
|
||||
break
|
||||
|
||||
least_reserved_blade_ucsm = \
|
||||
reserved_blade_dict[const.LEAST_RSVD_BLADE_UCSM]
|
||||
least_reserved_blade_chassis = \
|
||||
reserved_blade_dict[const.LEAST_RSVD_BLADE_CHASSIS]
|
||||
least_reserved_blade_id = \
|
||||
reserved_blade_dict[const.LEAST_RSVD_BLADE_ID]
|
||||
least_reserved_blade_data = \
|
||||
reserved_blade_dict[const.LEAST_RSVD_BLADE_DATA]
|
||||
reserved_nic_dict = \
|
||||
ucsinv.reserve_blade_interface(least_reserved_blade_ucsm,
|
||||
least_reserved_blade_chassis,
|
||||
least_reserved_blade_id,
|
||||
least_reserved_blade_data,
|
||||
"demo", "12345", "profilename")
|
||||
if reserved_nic_dict:
|
||||
reserved_intf_nic_info = {const.RESERVED_INTERFACE_UCSM:
|
||||
least_reserved_blade_ucsm,
|
||||
const.RESERVED_INTERFACE_CHASSIS:
|
||||
least_reserved_blade_chassis,
|
||||
const.RESERVED_INTERFACE_BLADE:
|
||||
least_reserved_blade_id,
|
||||
const.RESERVED_INTERFACE_DN:
|
||||
reserved_nic_dict[const.BLADE_INTF_DN]}
|
||||
reserved_nics.append(reserved_intf_nic_info)
|
||||
#break
|
||||
|
||||
for rnic in reserved_nics:
|
||||
ucsinv.unreserve_blade_interface(
|
||||
rnic[const.RESERVED_INTERFACE_UCSM],
|
||||
rnic[const.RESERVED_INTERFACE_CHASSIS],
|
||||
rnic[const.RESERVED_INTERFACE_BLADE],
|
||||
rnic[const.RESERVED_INTERFACE_DN])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user