本文整理汇总了Python中config_db.LoadbalancerPoolSM类的典型用法代码示例。如果您正苦于以下问题:Python LoadbalancerPoolSM类的具体用法?Python LoadbalancerPoolSM怎么用?Python LoadbalancerPoolSM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LoadbalancerPoolSM类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: audit_lb_pools
def audit_lb_pools(self):
for hm_id, config_data, driver_data in self._object_db.health_monitor_list():
if HealthMonitorSM.get(hm_id):
continue
hm = config_data
if not hasattr(hm, 'provider'):
continue
driver = self._get_driver_for_provider(hm['provider'])
pools = set()
for i in hm['pools'] or []:
pools.add(i['pool_id'])
try:
for pool in pools:
driver.delete_health_monitor(hm, pool)
except Exception:
pass
self._object_db.healthmonitor_remove(hm_id)
for lb_id, config_data, driver_data in self._object_db.loadbalancer_list():
if LoadbalancerSM.get(lb_id):
continue
# Delete the lb from the driver
driver = self._get_driver_for_provider(config_data['provider'])
driver.delete_loadbalancer(config_data)
self._object_db.loadbalancer_remove(lb_id)
self._delete_driver_for_loadbalancer(lb_id)
for pool_id, config_data, driver_data in self._object_db.pool_list():
if LoadbalancerPoolSM.get(pool_id):
continue
# Delete the pool from the driver
driver = self._get_driver_for_provider(config_data['provider'])
driver.delete_pool(config_data)
self._object_db.pool_remove(pool_id)
self._delete_driver_for_pool(pool_id)
示例2: hm_get_reqdict
def hm_get_reqdict(self, health_monitor):
res = {'id': health_monitor.uuid,
'tenant_id': health_monitor.parent_uuid.replace('-', ''),
'status': self._get_object_status(health_monitor)}
props = health_monitor.params
for key, mapping in self._loadbalancer_health_type_mapping.iteritems():
value = props[key]
if value is not None:
res[mapping] = value
pool_ids = []
pool_back_refs = health_monitor.loadbalancer_pools
for pool_back_ref in pool_back_refs or []:
pool_id = {}
pool_id['pool_id'] = pool_back_ref
pool_ids.append(pool_id)
res['pools'] = pool_ids
if pool_ids:
pool = LoadbalancerPoolSM.get(pool_ids[0]['pool_id'])
if pool:
res['provider'] = pool.provider
return res
示例3: audit_lb_pools
def audit_lb_pools(self):
for pool_id, config_data, driver_data in self.lb_db.pool_list():
if LoadbalancerPoolSM.get(pool_id):
continue
# Delete the pool from the driver
driver = self._get_driver_for_provider(config_data['provider'])
driver.delete_pool(config_data)
self.lb_db.pool_remove(pool_id)
示例4: _get_driver_for_pool
def _get_driver_for_pool(self, pool_id, provider=None):
if pool_id in self._pool_driver:
return self._pool_driver[pool_id]
if not provider:
pool = LoadbalancerPoolSM.get(pool_id)
provider = pool.provider
if provider:
driver = self._get_driver_for_provider(provider)
self._pool_driver[pool_id] = driver
return driver
return self._loadbalancer_driver[self._default_provider]
示例5: loadbalancer_member_get_reqdict
def loadbalancer_member_get_reqdict(self, member):
res = {"id": member.uuid, "pool_id": member.loadbalancer_pool, "status": self._get_object_status(member)}
pool = LoadbalancerPoolSM.get(member.loadbalancer_pool)
res["tenant_id"] = pool.parent_uuid.replace("-", "")
props = member.params
for key, mapping in self._loadbalancer_member_type_mapping.iteritems():
value = props[key]
if value is not None:
res[mapping] = value
return res
示例6: _send_lb_config_uve
def _send_lb_config_uve(self, lb_id, deleted):
lb = LoadbalancerSM.get(lb_id)
if not lb:
return
sandesh = self._svc_mon.logger._sandesh
if deleted == True:
uve_lb = UveLoadbalancerConfig(name=lb.uuid, deleted=True)
uve_lb.listener = {}
uve_lb.pool = {}
uve_trace = UveLoadbalancerConfigTrace(data=uve_lb, sandesh=sandesh)
uve_trace.send(sandesh=sandesh)
return
uve_lb = UveLoadbalancerConfig()
uve_lb.name = lb.uuid
uve_lb.listener = {}
uve_lb.pool = {}
pool_found = False
for ll_id in lb.loadbalancer_listeners:
ll = LoadbalancerListenerSM.get(ll_id)
if not ll:
continue
if not ll.params['admin_state']:
continue
ll_uuid = ll.uuid
pools = []
pool = LoadbalancerPoolSM.get(ll.loadbalancer_pool)
if pool and pool.params['admin_state']:
pools.append(pool.uuid)
uve_lb_listener = LoadbalancerConfig()
uve_lb_listener.pool_uuid = pools
uve_lb.listener[ll_uuid] = uve_lb_listener
pool_uuid = pool.uuid
pool_found = True
members = []
uve_lb_pool = LoadbalancerConfig()
for member_id in pool.members:
member = LoadbalancerMemberSM.get(member_id)
members.append(member.uuid)
uve_lb_pool.member_uuid = members
uve_lb.pool[pool_uuid] = uve_lb_pool
if pool_found == True:
uve_trace = UveLoadbalancerConfigTrace(data=uve_lb, sandesh=sandesh)
uve_trace.send(sandesh=sandesh)
else:
uve_lb = UveLoadbalancerConfig(name=lb.uuid, deleted=True)
uve_lb.listener = {}
uve_lb.pool = {}
uve_trace = UveLoadbalancerConfigTrace(data=uve_lb, sandesh=sandesh)
uve_trace.send(sandesh=sandesh)
return
示例7: _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
示例8: loadbalancer_member_get_reqdict
def loadbalancer_member_get_reqdict(self, member):
res = {'id': member.uuid,
'vmi': member.vmi,
'pool_id': member.loadbalancer_pool,
'status': self._get_object_status(member)}
pool = LoadbalancerPoolSM.get(member.loadbalancer_pool)
res['tenant_id'] = pool.parent_uuid.replace('-', '')
props = member.params
for key, mapping in self._loadbalancer_member_type_mapping.iteritems():
if key in props and props[key]:
res[mapping] = props[key]
return res
示例9: _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
示例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_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