本文整理汇总了Python中logger.ServiceMonitorLogger.warning方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceMonitorLogger.warning方法的具体用法?Python ServiceMonitorLogger.warning怎么用?Python ServiceMonitorLogger.warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logger.ServiceMonitorLogger
的用法示例。
在下文中一共展示了ServiceMonitorLogger.warning方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SvcMonitor
# 需要导入模块: from logger import ServiceMonitorLogger [as 别名]
# 或者: from logger.ServiceMonitorLogger import warning [as 别名]
class SvcMonitor(object):
def __init__(self, args=None):
self._args = args
# initialize discovery client
self._disc = None
if self._args.disc_server_ip and self._args.disc_server_port:
self._disc = client.DiscoveryClient(
self._args.disc_server_ip,
self._args.disc_server_port,
ModuleNames[Module.SVC_MONITOR])
# initialize logger
self.logger = ServiceMonitorLogger(self._disc, args)
# rotating log file for catchall errors
self._err_file = self._args.trace_file
self._svc_err_logger = logging.getLogger('SvcErrLogger')
self._svc_err_logger.setLevel(logging.ERROR)
try:
with open(self._err_file, 'a'):
handler = logging.handlers.RotatingFileHandler(
self._err_file, maxBytes=64*1024, backupCount=2)
self._svc_err_logger.addHandler(handler)
except IOError:
self.logger.warning("Failed to open trace file %s" %
self._err_file)
# init cassandra
self._cassandra = ServiceMonitorDB(self._args, self.logger)
DBBaseSM.init(self, self.logger, self._cassandra)
# init rabbit connection
self.rabbit = RabbitConnection(self.logger, args)
self.rabbit._connect_rabbit()
def post_init(self, vnc_lib, args=None):
# api server
self._vnc_lib = vnc_lib
try:
self._nova_client = importutils.import_object(
'svc_monitor.nova_client.ServiceMonitorNovaClient',
self._args, self.logger)
except Exception as e:
self._nova_client = None
# agent manager
self._agent_manager = AgentManager()
# load vrouter scheduler
self.vrouter_scheduler = importutils.import_object(
self._args.si_netns_scheduler_driver,
self._vnc_lib, self._nova_client,
self._disc, self.logger, self._args)
# load virtual machine instance manager
self.vm_manager = importutils.import_object(
'svc_monitor.virtual_machine_manager.VirtualMachineManager',
self._vnc_lib, self._cassandra, self.logger,
self.vrouter_scheduler, self._nova_client, self._agent_manager,
self._args)
# load network namespace instance manager
self.netns_manager = importutils.import_object(
'svc_monitor.instance_manager.NetworkNamespaceManager',
self._vnc_lib, self._cassandra, self.logger,
self.vrouter_scheduler, self._nova_client, self._agent_manager,
self._args)
# load a vrouter instance manager
self.vrouter_manager = importutils.import_object(
'svc_monitor.vrouter_instance_manager.VRouterInstanceManager',
self._vnc_lib, self._cassandra, self.logger,
self.vrouter_scheduler, self._nova_client,
self._agent_manager, self._args)
# load PNF instance manager
self.ps_manager = importutils.import_object(
'svc_monitor.physical_service_manager.PhysicalServiceManager',
self._vnc_lib, self._cassandra, self.logger,
self.vrouter_scheduler, self._nova_client,
self._agent_manager, self._args)
# load a loadbalancer agent
self.loadbalancer_agent = LoadbalancerAgent(
self, self._vnc_lib,
self._cassandra, self._args)
self._agent_manager.register_agent(self.loadbalancer_agent)
# load a snat agent
self.snat_agent = SNATAgent(self, self._vnc_lib,
self._cassandra, self._args)
self._agent_manager.register_agent(self.snat_agent)
# load port tuple agent
self.port_tuple_agent = PortTupleAgent(self, self._vnc_lib,
self._cassandra, self._args, self.logger)
self._agent_manager.register_agent(self.port_tuple_agent)
#.........这里部分代码省略.........