本文整理汇总了Python中logger.ServiceMonitorLogger.error方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceMonitorLogger.error方法的具体用法?Python ServiceMonitorLogger.error怎么用?Python ServiceMonitorLogger.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logger.ServiceMonitorLogger
的用法示例。
在下文中一共展示了ServiceMonitorLogger.error方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SvcMonitor
# 需要导入模块: from logger import ServiceMonitorLogger [as 别名]
# 或者: from logger.ServiceMonitorLogger import error [as 别名]
#.........这里部分代码省略.........
image_name="ubuntu",
hypervisor_type='vrouter-instance',
vrouter_instance_type='docker',
instance_data={
"command": "/bin/bash"
})
# upgrade handling
self.upgrade()
# check services
self.vrouter_scheduler.vrouters_running()
self.launch_services()
self.rabbit._db_resync_done.set()
def _upgrade_instance_ip(self, vm):
for vmi_id in vm.virtual_machine_interfaces:
vmi = VirtualMachineInterfaceSM.get(vmi_id)
if not vmi:
continue
for iip_id in vmi.instance_ips:
iip = InstanceIpSM.get(iip_id)
if not iip or iip.service_instance_ip:
continue
iip_obj = InstanceIp()
iip_obj.name = iip.name
iip_obj.uuid = iip.uuid
iip_obj.set_service_instance_ip(True)
try:
self._vnc_lib.instance_ip_update(iip_obj)
except NoIdError:
self.logger.error("upgrade instance ip to service ip failed %s" % (iip.name))
continue
def _upgrade_auto_policy(self, si, st):
if st.name != 'netns-snat-template':
return
if not si.params['auto_policy']:
return
si_obj = ServiceInstance()
si_obj.uuid = si.uuid
si_obj.fq_name = si.fq_name
si_props = ServiceInstanceType(**si.params)
si_props.set_auto_policy(False)
si_obj.set_service_instance_properties(si_props)
try:
self._vnc_lib.service_instance_update(si_obj)
self.logger.notice("snat policy upgraded for %s" % (si.name))
except NoIdError:
self.logger.error("snat policy upgrade failed for %s" % (si.name))
return
def upgrade(self):
for lr in LogicalRouterSM.values():
self.snat_agent.upgrade(lr)
for si in ServiceInstanceSM.values():
st = ServiceTemplateSM.get(si.service_template)
if not st:
continue
self._upgrade_auto_policy(si, st)
示例2: SvcMonitor
# 需要导入模块: from logger import ServiceMonitorLogger [as 别名]
# 或者: from logger.ServiceMonitorLogger import error [as 别名]
#.........这里部分代码省略.........
image_name="ubuntu",
hypervisor_type='vrouter-instance',
vrouter_instance_type='docker',
instance_data={
"command": "/bin/bash"
})
# upgrade handling
self.upgrade()
# check services
self.vrouter_scheduler.vrouters_running()
self.launch_services()
self.rabbit._db_resync_done.set()
def _upgrade_instance_ip(self, vm):
for vmi_id in vm.virtual_machine_interfaces:
vmi = VirtualMachineInterfaceSM.get(vmi_id)
if not vmi:
continue
for iip_id in vmi.instance_ips:
iip = InstanceIpSM.get(iip_id)
if not iip or iip.service_instance_ip:
continue
iip_obj = InstanceIp()
iip_obj.name = iip.name
iip_obj.uuid = iip.uuid
iip_obj.set_service_instance_ip(True)
try:
self._vnc_lib.instance_ip_update(iip_obj)
except NoIdError:
self.logger.error("upgrade instance ip to service ip failed %s" % (iip.name))
continue
def upgrade(self):
for si in ServiceInstanceSM.values():
st = ServiceTemplateSM.get(si.service_template)
if not st:
continue
vm_id_list = list(si.virtual_machines)
for vm_id in vm_id_list:
vm = VirtualMachineSM.get(vm_id)
self._upgrade_instance_ip(vm)
if vm.virtualization_type:
continue
try:
nova_vm = self._nova_client.oper('servers', 'get',
si.proj_name, id=vm_id)
except nc_exc.NotFound:
nova_vm = None
if nova_vm:
vm_name = nova_vm.name
vm.proj_fq_name = nova_vm.name.split('__')[0:2]
else:
vm_name = vm.name
if not vm_name.split('__')[-1].isdigit():
continue
vm.virtualization_type = st.virtualization_type
self.delete_service_instance(vm)