本文整理汇总了Python中neutron_lib.context.get_admin_context_without_session方法的典型用法代码示例。如果您正苦于以下问题:Python context.get_admin_context_without_session方法的具体用法?Python context.get_admin_context_without_session怎么用?Python context.get_admin_context_without_session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neutron_lib.context
的用法示例。
在下文中一共展示了context.get_admin_context_without_session方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from neutron_lib import context [as 别名]
# 或者: from neutron_lib.context import get_admin_context_without_session [as 别名]
def __init__(self, vpn_service, host):
# TODO(pc_m) Replace vpn_service with config arg, once all driver
# implementations no longer need vpn_service.
self.conf = vpn_service.conf
self.host = host
self.conn = n_rpc.Connection()
self.context = context.get_admin_context_without_session()
self.topic = topics.IPSEC_AGENT_TOPIC
node_topic = '%s.%s' % (self.topic, self.host)
self.processes = {}
self.routers = {}
self.process_status_cache = {}
self.endpoints = [self]
self.conn.create_consumer(node_topic, self.endpoints, fanout=False)
self.conn.consume_in_threads()
self.agent_rpc = IPsecVpnDriverApi(topics.IPSEC_DRIVER_TOPIC)
self.process_status_cache_check = loopingcall.FixedIntervalLoopingCall(
self.report_status, self.context)
self.process_status_cache_check.start(
interval=self.conf.ipsec.ipsec_status_check_interval)
示例2: _report_state
# 需要导入模块: from neutron_lib import context [as 别名]
# 或者: from neutron_lib.context import get_admin_context_without_session [as 别名]
def _report_state(self):
LOG.debug("Report state task started")
try:
self.agent_state.get('configurations').update(
self.cache.get_state())
ctx = context.get_admin_context_without_session()
agent_status = self.state_rpc.report_state(ctx, self.agent_state,
True)
if agent_status == agent_consts.AGENT_REVIVED:
LOG.info(_LI("Agent has just been revived. "
"Scheduling full sync"))
self.schedule_full_resync(
reason=_("Agent has just been revived"))
except AttributeError:
# This means the server does not support report_state
LOG.warning(_LW("Neutron server does not support state report. "
"State report for this agent will be disabled."))
self.heartbeat.stop()
self.run()
return
except Exception:
LOG.exception(_LE("Failed reporting state!"))
return
if self.agent_state.pop('start_flag', None):
self.run()
示例3: initialize
# 需要导入模块: from neutron_lib import context [as 别名]
# 或者: from neutron_lib.context import get_admin_context_without_session [as 别名]
def initialize(self):
super(OVSSfcDriver, self).initialize()
self.ovs_driver_rpc = ovs_sfc_rpc.SfcAgentRpcClient(
sfc_topics.SFC_AGENT
)
self.rpc_ctx = n_context.get_admin_context_without_session()
self._setup_rpc()
示例4: __init__
# 需要导入模块: from neutron_lib import context [as 别名]
# 或者: from neutron_lib.context import get_admin_context_without_session [as 别名]
def __init__(self, host, conf=None):
super(BgpDrAgent, self).__init__()
self.initialize_driver(conf)
self.needs_resync_reasons = collections.defaultdict(list)
self.needs_full_sync_reason = None
self.cache = BgpSpeakerCache()
self.context = context.get_admin_context_without_session()
self.plugin_rpc = BgpDrPluginApi(bgp_consts.BGP_PLUGIN,
self.context, host)
示例5: _report_state
# 需要导入模块: from neutron_lib import context [as 别名]
# 或者: from neutron_lib.context import get_admin_context_without_session [as 别名]
def _report_state(self):
try:
ctx = context.get_admin_context_without_session()
self.state_rpc.report_state(ctx, self.agent_state,
True)
self.agent_state['start_flag'] = False
except Exception:
LOG.exception("Failed reporting state!")
self.handle_report_state_failure()
示例6: test_neutron_context_admin_without_session_to_dict
# 需要导入模块: from neutron_lib import context [as 别名]
# 或者: from neutron_lib.context import get_admin_context_without_session [as 别名]
def test_neutron_context_admin_without_session_to_dict(self):
ctx = context.get_admin_context_without_session()
ctx_dict = ctx.to_dict()
self.assertIsNone(ctx_dict['user_id'])
self.assertIsNone(ctx_dict['tenant_id'])
self.assertIsNone(ctx_dict['auth_token'])
self.assertFalse(hasattr(ctx, 'session'))