本文整理汇总了Python中config_db.VirtualMachineInterfaceSM类的典型用法代码示例。如果您正苦于以下问题:Python VirtualMachineInterfaceSM类的具体用法?Python VirtualMachineInterfaceSM怎么用?Python VirtualMachineInterfaceSM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VirtualMachineInterfaceSM类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_service
def check_service(self, si):
if si.max_instances>len(si.port_tuples):
return False
pt_list = list(si.port_tuples)
pi_list = []
all_possible_pi=[]
for pt_uuid in pt_list:
pt_obj = PortTupleSM.get(pt_uuid)
for vmi_uuid in pt_obj.virtual_machine_interfaces:
vmi_obj = VirtualMachineInterfaceSM.get(vmi_uuid)
pi_list.append(vmi_obj.physical_interface)
st_obj = ServiceTemplateSM.get(si.service_template)
if not st_obj.service_appliance_set:
return False
sa_set_obj = ServiceApplianceSetSM.get(st_obj.service_appliance_set)
for sa_uuid in sa_set_obj.service_appliances:
sa_obj = ServiceApplianceSM.get(sa_uuid)
for key in sa_obj.physical_interfaces:
all_possible_pi.append(sa_obj.physical_interfaces[key])
if not pi_list and all_possible_pi and si.max_instances>0:
return False
if not all_possible_pi and pi_list:
return False
for pi_uuid in pi_list:
if not pi_uuid in all_possible_pi:
return False
return True
示例2: _get_vip_vmi
def _get_vip_vmi(self, si):
lb = LoadbalancerSM.get(si.loadbalancer)
if lb:
vmi_id = lb.virtual_machine_interface
vmi = VirtualMachineInterfaceSM.get(vmi_id)
return vmi
pool = LoadbalancerPoolSM.get(si.loadbalancer_pool)
if pool:
vip = VirtualIpSM.get(pool.virtual_ip)
if vip:
vmi_id = vip.virtual_machine_interface
vmi = VirtualMachineInterfaceSM.get(vmi_id)
return vmi
return None
示例3: _get_vip_vmi
def _get_vip_vmi(self, si):
pool = LoadbalancerPoolSM.get(si.loadbalancer_pool)
if not pool:
return None
listener = LoadbalancerListenerSM.get(pool.loadbalancer_listener)
if listener:
lb = LoadbalancerSM.get(listener.loadbalancer)
vmi_id = lb.virtual_machine_interface
vmi = VirtualMachineInterfaceSM.get(vmi_id)
return vmi
vip = VirtualIpSM.get(pool.virtual_ip)
if vip:
vmi_id = vip.virtual_machine_interface
vmi = VirtualMachineInterfaceSM.get(vmi_id)
return vmi
return None
示例4: _get_interface_params
def _get_interface_params(self, port_id, props):
if port_id is None:
return None
if not props['address']:
vmi = VirtualMachineInterfaceSM.get(port_id)
for iip_id in vmi.instance_ips:
iip = InstanceIpSM.get(iip_id)
props['address'] = iip.address
break
return port_id
示例5: cleanup_pi_connections
def cleanup_pi_connections(self, vmi_list):
for vmi_id in vmi_list:
try:
vmi = VirtualMachineInterfaceSM.get(vmi_id)
self._vnc_lib.ref_update('virtual-machine-interface',
vmi.uuid,
'physical_interface_refs',
vmi.physical_interface,
None,
'DELETE')
PhysicalInterfaceSM.locate(vmi.physical_interface)
except:
pass
示例6: _get_interface_params
def _get_interface_params(self, vip, props):
port_id = vip.virtual_machine_interface
if port_id is None:
return None
if not props['address']:
vmi = VirtualMachineInterfaceSM.get(port_id)
ip_refs = vmi.instance_ip
if ip_refs:
iip = InstanceIpSM.get(ip_refs)
props['address'] = iip.address
return port_id
示例7: _get_interface_params
def _get_interface_params(self, vip, props):
port_id = vip.virtual_machine_interface
if port_id is None:
return None
if not props["address"]:
vmi = VirtualMachineInterfaceSM.get(port_id)
for iip_id in vmi.instance_ips:
iip = InstanceIpSM.get(iip_id)
props["address"] = iip.address
break
return port_id
示例8: _get_vip_vmi
def _get_vip_vmi(self, si):
if not si.loadbalancer_pool:
return None
pool = LoadbalancerPoolSM.get(si.loadbalancer_pool)
if not pool.virtual_ip:
return None
vip = VirtualIpSM.get(pool.virtual_ip)
if not vip.virtual_machine_interface:
return None
vmi = VirtualMachineInterfaceSM.get(vip.virtual_machine_interface)
return vmi
示例9: delete_vm
def delete_vm(self,vm):
if vm.virtual_machine_interfaces:
vmi_list = list(vm.virtual_machine_interfaces)
pt_uuid = VirtualMachineInterfaceSM.get(vmi_list[0]).port_tuple
self.cleanup_pi_connections(vmi_list)
self.cleanup_svc_vm_ports(vmi_list)
try:
self._vnc_lib.port_tuple_delete(id=pt_uuid)
PortTupleSM.delete(pt_uuid)
except NoIdError:
pass
try:
self._vnc_lib.virtual_machine_delete(id=vm.uuid)
VirtualMachineSM.delete(vm.uuid)
except NoIdError:
pass
示例10: _get_vip_vmi_iip
def _get_vip_vmi_iip(self, si):
if not si.loadbalancer_pool:
return None, None
pool = LoadbalancerPoolSM.get(si.loadbalancer_pool)
if not pool.virtual_ip:
return None, None
vip = VirtualIpSM.get(pool.virtual_ip)
if not vip.virtual_machine_interface:
return None, None
vmi = VirtualMachineInterfaceSM.get(vip.virtual_machine_interface)
if not vmi.instance_ip or not vmi.virtual_network:
return None, None
return vmi.instance_ip, vmi.virtual_network
示例11: _get_net_uuids
def _get_net_uuids(self, vmi_uuids):
return [
VirtualMachineInterfaceSM.get(uuid).virtual_network
for uuid in vmi_uuids]