本文整理汇总了Python中logger.ServiceMonitorLogger.sandesh_reconfig_collectors方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceMonitorLogger.sandesh_reconfig_collectors方法的具体用法?Python ServiceMonitorLogger.sandesh_reconfig_collectors怎么用?Python ServiceMonitorLogger.sandesh_reconfig_collectors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logger.ServiceMonitorLogger
的用法示例。
在下文中一共展示了ServiceMonitorLogger.sandesh_reconfig_collectors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SvcMonitor
# 需要导入模块: from logger import ServiceMonitorLogger [as 别名]
# 或者: from logger.ServiceMonitorLogger import sandesh_reconfig_collectors [as 别名]
#.........这里部分代码省略.........
self.logger.info("Creating SI %s (%s)" %
((':').join(si.fq_name), st.virtualization_type))
try:
if st.virtualization_type == 'virtual-machine':
self.vm_manager.create_service(st, si)
elif st.virtualization_type == 'network-namespace':
self.netns_manager.create_service(st, si)
elif st.virtualization_type == 'vrouter-instance':
self.vrouter_manager.create_service(st, si)
elif st.virtualization_type == 'physical-device':
self.ps_manager.create_service(st, si)
else:
self.logger.error("Unknown virt type: %s" %
st.virtualization_type)
except Exception:
cgitb_error_log(self)
si.launch_count += 1
self.logger.info("SI %s creation success" % (':').join(si.fq_name))
def delete_service_instance(self, vm):
self.logger.info("Deleting VM %s %s for SI %s" %
((':').join(vm.fq_name), vm.uuid, vm.service_id))
try:
if vm.virtualization_type == svc_info.get_vm_instance_type():
self.vm_manager.delete_service(vm)
elif vm.virtualization_type == svc_info.get_netns_instance_type():
self.netns_manager.delete_service(vm)
elif vm.virtualization_type == 'vrouter-instance':
self.vrouter_manager.delete_service(vm)
elif vm.virtualization_type == 'physical-device':
self.ps_manager.delete_service(vm)
self.logger.info("Deleted VM %s %s for SI %s" %
((':').join(vm.fq_name), vm.uuid, vm.service_id))
except Exception:
cgitb_error_log(self)
# generate UVE
si_fq_name = vm.display_name.split('__')[:-2]
si_fq_str = (':').join(si_fq_name)
self.logger.uve_svc_instance(si_fq_str, status='DELETE',
vms=[{'uuid': vm.uuid}])
return True
def _relaunch_service_instance(self, si):
si.state = 'relaunch'
self.create_service_instance(si)
def _check_service_running(self, si):
st = ServiceTemplateSM.get(si.service_template)
if st.params and st.params.get('version', 1) == 2:
return
if st.virtualization_type == 'virtual-machine':
status = self.vm_manager.check_service(si)
elif st.virtualization_type == 'network-namespace':
status = self.netns_manager.check_service(si)
elif st.virtualization_type == 'vrouter-instance':
status = self.vrouter_manager.check_service(si)
elif st.virtualization_type == 'physical-device':
status = self.ps_manager.check_service(si)
return status
def delete_interface_route_table(self, irt_uuid):
try:
self._vnc_lib.interface_route_table_delete(id=irt_uuid)
InterfaceRouteTableSM.delete(irt_uuid)
except (NoIdError, RefsExistError):
return
def _delete_shared_vn(self, vn_uuid):
try:
self.logger.info("Deleting vn %s" % (vn_uuid))
self._vnc_lib.virtual_network_delete(id=vn_uuid)
VirtualNetworkSM.delete(vn_uuid)
except (NoIdError, RefsExistError):
pass
@staticmethod
def reset():
for cls in DBBaseSM.get_obj_type_map().values():
cls.reset()
def sighup_handler(self):
if self._conf_file:
config = ConfigParser.SafeConfigParser()
config.read(self._conf_file)
if 'DEFAULTS' in config.sections():
try:
collectors = config.get('DEFAULTS', 'collectors')
if type(collectors) is str:
collectors = collectors.split()
new_chksum = hashlib.md5("".join(collectors)).hexdigest()
if new_chksum != self._chksum:
self._chksum = new_chksum
config.random_collectors = random.sample(collectors, len(collectors))
# Reconnect to achieve load-balance irrespective of list
self.logger.sandesh_reconfig_collectors(config)
except ConfigParser.NoOptionError as e:
pass