本文整理汇总了Python中logger.ServiceMonitorLogger.log_error方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceMonitorLogger.log_error方法的具体用法?Python ServiceMonitorLogger.log_error怎么用?Python ServiceMonitorLogger.log_error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logger.ServiceMonitorLogger
的用法示例。
在下文中一共展示了ServiceMonitorLogger.log_error方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SvcMonitor
# 需要导入模块: from logger import ServiceMonitorLogger [as 别名]
# 或者: from logger.ServiceMonitorLogger import log_error [as 别名]
#.........这里部分代码省略.........
self.loadbalancer_agent.load_drivers()
for lb_pool in LoadbalancerPoolSM.values():
lb_pool.add()
# Audit the lb pools
self.loadbalancer_agent.audit_lb_pools()
# Audit the SNAT instances
self.snat_agent.audit_snat_instances()
# end sync_sm
# create service template
def _create_default_template(self, st_name, svc_type, svc_mode=None,
hypervisor_type='virtual-machine',
image_name=None, flavor=None, scaling=False,
vrouter_instance_type=None,
instance_data=None):
domain_name = 'default-domain'
domain_fq_name = [domain_name]
st_fq_name = [domain_name, st_name]
self.logger.log_info("Creating %s %s hypervisor %s" %
(domain_name, st_name, hypervisor_type))
domain_obj = None
for domain in DomainSM.values():
if domain.fq_name == domain_fq_name:
domain_obj = Domain()
domain_obj.uuid = domain.uuid
domain_obj.fq_name = domain_fq_name
break
if not domain_obj:
self.logger.log_error("%s domain not found" % (domain_name))
return
for st in ServiceTemplateSM.values():
if st.fq_name == st_fq_name:
self.logger.log_info("%s exists uuid %s" %
(st.name, str(st.uuid)))
return
svc_properties = ServiceTemplateType()
svc_properties.set_service_type(svc_type)
svc_properties.set_service_mode(svc_mode)
svc_properties.set_service_virtualization_type(hypervisor_type)
svc_properties.set_image_name(image_name)
svc_properties.set_flavor(flavor)
svc_properties.set_ordered_interfaces(True)
svc_properties.set_service_scaling(scaling)
# set interface list
if svc_type == 'analyzer':
if_list = [['left', False]]
elif hypervisor_type == 'network-namespace':
if_list = [['right', True], ['left', True]]
else:
if_list = [
['management', False], ['left', False], ['right', False]]
for itf in if_list:
if_type = ServiceTemplateInterfaceType(shared_ip=itf[1])
if_type.set_service_interface_type(itf[0])
svc_properties.add_interface_type(if_type)
if vrouter_instance_type is not None:
示例2: SvcMonitor
# 需要导入模块: from logger import ServiceMonitorLogger [as 别名]
# 或者: from logger.ServiceMonitorLogger import log_error [as 别名]
#.........这里部分代码省略.........
cgitb_error_log(self)
def _vnc_subscribe_actions(self, oper_info):
try:
msg = "Notification Message: %s" % (pformat(oper_info))
self.logger.log_debug(msg)
obj_type = oper_info['type'].replace('-', '_')
obj_class = DBBaseSM.get_obj_type_map().get(obj_type)
if obj_class is None:
return
if oper_info['oper'] == 'CREATE' or oper_info['oper'] == 'UPDATE':
dependency_tracker = DependencyTracker(
DBBaseSM.get_obj_type_map(), self._REACTION_MAP)
obj_id = oper_info['uuid']
obj = obj_class.get(obj_id)
if obj is not None:
dependency_tracker.evaluate(obj_type, obj)
else:
obj = obj_class.locate(obj_id)
obj.update()
dependency_tracker.evaluate(obj_type, obj)
elif oper_info['oper'] == 'DELETE':
obj_id = oper_info['uuid']
obj = obj_class.get(obj_id)
if obj is None:
return
dependency_tracker = DependencyTracker(
DBBaseSM.get_obj_type_map(), self._REACTION_MAP)
dependency_tracker.evaluate(obj_type, obj)
obj_class.delete(obj_id)
else:
# unknown operation
self.logger.log_error('Unknown operation %s' %
oper_info['oper'])
return
if obj is None:
self.logger.log_error('Error while accessing %s uuid %s' % (
obj_type, obj_id))
return
except Exception:
cgitb_error_log(self)
for sas_id in dependency_tracker.resources.get(
'service_appliance_set', []):
sas_obj = ServiceApplianceSetSM.get(sas_id)
if sas_obj is not None:
sas_obj.add()
for lb_pool_id in dependency_tracker.resources.get(
'loadbalancer_pool', []):
lb_pool = LoadbalancerPoolSM.get(lb_pool_id)
if lb_pool is not None:
lb_pool.add()
for si_id in dependency_tracker.resources.get('service_instance', []):
si = ServiceInstanceSM.get(si_id)
if si:
si.state = 'launch'
self._create_service_instance(si)
else:
self.logger.log_info("Deleting SI %s" % si_id)
for vm_id in dependency_tracker.resources.get(
'virtual_machine', []):
示例3: SvcMonitor
# 需要导入模块: from logger import ServiceMonitorLogger [as 别名]
# 或者: from logger.ServiceMonitorLogger import log_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.log_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)