當前位置: 首頁>>代碼示例>>Python>>正文


Python context.get_admin_context_without_session方法代碼示例

本文整理匯總了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) 
開發者ID:openstack,項目名稱:neutron-vpnaas,代碼行數:24,代碼來源:ipsec.py

示例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() 
開發者ID:openstack,項目名稱:neutron-dynamic-routing,代碼行數:27,代碼來源:bgp_dragent.py

示例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() 
開發者ID:openstack,項目名稱:networking-sfc,代碼行數:9,代碼來源:driver.py

示例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) 
開發者ID:openstack,項目名稱:neutron-dynamic-routing,代碼行數:12,代碼來源:bgp_dragent.py

示例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() 
開發者ID:openstack,項目名稱:networking-l2gw,代碼行數:11,代碼來源:base_agent_manager.py

示例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')) 
開發者ID:openstack,項目名稱:neutron-lib,代碼行數:9,代碼來源:test_context.py


注:本文中的neutron_lib.context.get_admin_context_without_session方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。