当前位置: 首页>>代码示例>>Python>>正文


Python context.get_admin_context_without_session函数代码示例

本文整理汇总了Python中neutron_lib.context.get_admin_context_without_session函数的典型用法代码示例。如果您正苦于以下问题:Python get_admin_context_without_session函数的具体用法?Python get_admin_context_without_session怎么用?Python get_admin_context_without_session使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_admin_context_without_session函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: context

 def context(self):
     # TODO(kevinbenton): the context should really be passed in to each of
     # these methods so a call can be tracked all of the way through the
     # system but that will require a larger refactor to pass the context
     # everywhere. We just generate a new one here on each call so requests
     # can be independently tracked server side.
     return context.get_admin_context_without_session()
开发者ID:openstack,项目名称:neutron,代码行数:7,代码来源:agent.py

示例2: __init__

 def __init__(self, host, conf=None):
     try:
         sock_dir, sock_mode = utils.get_socket_settings()
     except Exception:
         sock_dir = constants.VHOSTUSER_SOCKET_DIR
         sock_mode = constants.VHOSTUSER_SOCKET_MODE
         LOG.warning("Cannot get vhostuser socket info from fp-vdev, use "
                     "default path '%s' and mode '%s'" % (sock_dir,
                                                          sock_mode))
     self.fp_info = {
         'timestamp': '',
         'product': 'virtual-accelerator',
         'active': False,
         'vhostuser_socket_dir': sock_dir,
         'vhostuser_socket_prefix': constants.VHOSTUSER_SOCKET_PREFIX,
         'vhostuser_socket_mode': sock_mode,
         'supported_plugs': ['ovs', 'bridge', 'tap'],
     }
     self.agent_state = {
         'binary': 'neutron-fastpath-agent',
         'host': cfg.CONF.host,
         'topic': n_constants.L2_AGENT_TOPIC,
         'configurations': self.fp_info,
         'start_flag': True,
         'agent_type': constants.FP_AGENT_TYPE,
     }
     self.ctx = context.get_admin_context_without_session()
     self._setup_rpc()
开发者ID:openstack,项目名称:networking-6wind,代码行数:28,代码来源:server.py

示例3: __init__

 def __init__(self, data):
     self._n_context = n_context.get_admin_context_without_session()
     self._data = data
     self._topic = data.pop('plugin_topic', None)
     self._interval = data.pop('report_interval', 0)
     self._state_rpc = n_agent_rpc.PluginReportStateAPI(
         self._topic)
开发者ID:openstack,项目名称:group-based-policy,代码行数:7,代码来源:rpc.py

示例4: _report_state

 def _report_state(self):
     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("Agent has just been revived. "
                      "Scheduling full sync")
             self.schedule_resync("Agent has just been revived")
     except AttributeError:
         # This means the server does not support report_state
         LOG.warning("Neutron server does not support state report. "
                     "State report for this agent will be disabled.")
         self.heartbeat.stop()
         self.run()
         return
     except Exception:
         self.failed_report_state = True
         LOG.exception("Failed reporting state!")
         return
     if self.failed_report_state:
         self.failed_report_state = False
         LOG.info("Successfully reported state after a previous failure.")
     if self.agent_state.pop('start_flag', None):
         self.run()
开发者ID:openstack,项目名称:neutron,代码行数:27,代码来源:agent.py

示例5: __init__

    def __init__(self, conf):
        super(LbaasAgentManager, self).__init__(conf)
        self.conf = conf
        self.context = ncontext.get_admin_context_without_session()
        self.serializer = agent_driver_base.DataModelSerializer()
        self.plugin_rpc = agent_api.LbaasAgentApi(
            lb_const.LOADBALANCER_PLUGINV2,
            self.context,
            self.conf.host
        )
        self._process_monitor = external_process.ProcessMonitor(
            config=self.conf, resource_type='loadbalancer')
        self._load_drivers()

        self.agent_state = {
            'binary': 'neutron-lbaasv2-agent',
            'host': conf.host,
            'topic': lb_const.LOADBALANCER_AGENTV2,
            'configurations': {'device_drivers': self.device_drivers.keys()},
            'agent_type': lb_const.AGENT_TYPE_LOADBALANCERV2,
            'start_flag': True}
        self.admin_state_up = True

        self._setup_state_rpc()
        self.needs_resync = False
        # pool_id->device_driver_name mapping used to store known instances
        self.instance_mapping = {}
开发者ID:openstack,项目名称:neutron-lbaas,代码行数:27,代码来源:agent_manager.py

示例6: _report_state

 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,代码行数:25,代码来源:bgp_dragent.py

示例7: start

    def start(self):
        self.prevent_arp_spoofing = cfg.CONF.AGENT.prevent_arp_spoofing

        # stores all configured ports on agent
        self.network_ports = collections.defaultdict(list)
        # flag to do a sync after revival
        self.fullsync = False
        self.context = context.get_admin_context_without_session()
        self.setup_rpc()
        self.init_extension_manager(self.connection)

        configurations = {'extensions': self.ext_manager.names()}
        configurations.update(self.mgr.get_agent_configurations())

        #TODO(mangelajo): optimize resource_versions (see ovs agent)
        self.agent_state = {
            'binary': self.agent_binary,
            'host': cfg.CONF.host,
            'topic': constants.L2_AGENT_TOPIC,
            'configurations': configurations,
            'agent_type': self.agent_type,
            'resource_versions': resources.LOCAL_RESOURCE_VERSIONS,
            'start_flag': True}

        report_interval = cfg.CONF.AGENT.report_interval
        if report_interval:
            heartbeat = loopingcall.FixedIntervalLoopingCall(
                self._report_state)
            heartbeat.start(interval=report_interval)

        capabilities.notify_init_event(self.agent_type, self)
        # The initialization is complete; we can start receiving messages
        self.connection.consume_in_threads()

        self.daemon_loop()
开发者ID:AradhanaSingh,项目名称:neutron,代码行数:35,代码来源:_common_agent.py

示例8: setUp

 def setUp(self):
     super(LoggingExtensionTestFramework, self).setUp()
     cfg.CONF.set_override('extensions', ['log'], group='agent')
     self.context = neutron_context.get_admin_context_without_session()
     self._set_resource_rpc_mock()
     if self.firewall_name != 'openvswitch':
         self.skipTest("Logging extension doesn't support firewall driver"
                       " %s at that time " % self.firewall_name)
     self.log_driver = self.initialize_ovs_fw_log()
开发者ID:cubeek,项目名称:neutron,代码行数:9,代码来源:test_logging.py

示例9: initialize

 def initialize(self):
     super(AristaHAScaleSimulationDriver, self).initialize()
     self.context = context.get_admin_context_without_session()
     # Subscribe to port updates to force ports to active after binding
     # since a fake virt driver is being used, so OVS will never see
     # the libvirt interfaces come up, triggering the OVS provisioning
     self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
     registry.subscribe(self._port_update_callback,
                        resources.PORT, events.AFTER_UPDATE)
开发者ID:openstack,项目名称:networking-arista,代码行数:9,代码来源:mechanism_ha_simulator.py

示例10: _report_state

 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,代码行数:9,代码来源:base_agent_manager.py

示例11: __init__

    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,代码行数:10,代码来源:bgp_dragent.py

示例12: __init__

 def __init__(self):
     self.vif_type = dvs_const.DVS
     sg_enabled = securitygroups_rpc.is_firewall_enabled()
     self.vif_details = {portbindings.CAP_PORT_FILTER: sg_enabled,
                         portbindings.OVS_HYBRID_PLUG: sg_enabled}
     self.context = context.get_admin_context_without_session()
     self.dvs_notifier = dvs_agent_rpc_api.DVSClientAPI(self.context)
     LOG.info(_LI('DVS_notifier'))
     super(VMwareDVSMechanismDriver, self).__init__(
         dvs_const.AGENT_TYPE_DVS,
         self.vif_type,
         self.vif_details)
开发者ID:Zlei1115,项目名称:networking-vsphere,代码行数:12,代码来源:dvs_mechanism_driver.py

示例13: __init__

    def __init__(self, vsphere_hostname, vsphere_login, vsphere_password,
                 bridge_mappings, polling_interval):
        super(DVSAgent, self).__init__()

        self.agent_state = {
            'binary': 'neutron-dvs-agent',
            'host': cfg.CONF.host,
            'topic': n_const.L2_AGENT_TOPIC,
            'configurations': {'bridge_mappings': bridge_mappings,
                               'vsphere_hostname': vsphere_hostname},
            'agent_type': 'DVS agent',
            'start_flag': True}

        report_interval = cfg.CONF.DVS_AGENT.report_interval

        self.polling_interval = polling_interval
        # Security group agent support
        self.context = context.get_admin_context_without_session()
        self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)
        self.sg_agent = dvs_rpc.DVSSecurityGroupRpc(
            self.context, self.sg_plugin_rpc, defer_refresh_firewall=True)

        self.setup_rpc()
        self.run_daemon_loop = True
        self.iter_num = 0

        self.network_map = dvs_util.create_network_map_from_config(
            cfg.CONF.ML2_VMWARE, pg_cache=True)
        uplink_map = dvs_util.create_uplink_map_from_config(
            cfg.CONF.ML2_VMWARE, self.network_map)
        for phys, dvs in six.iteritems(self.network_map):
            if phys in uplink_map:
                dvs.load_uplinks(phys, uplink_map[phys])
        self.updated_ports = set()
        self.deleted_ports = set()
        self.known_ports = set()
        self.added_ports = set()
        self.booked_ports = set()
        LOG.info(_LI("Agent out of sync with plugin!"))
        connected_ports = self._get_dvs_ports()
        self.added_ports = connected_ports
        if cfg.CONF.DVS.clean_on_restart:
            self._clean_up_vsphere_extra_resources(connected_ports)
        self.fullsync = False

        # The initialization is complete; we can start receiving messages
        self.connection.consume_in_threads()
        if report_interval:
            heartbeat = loopingcall.FixedIntervalLoopingCall(
                self._report_state)
            heartbeat.start(interval=report_interval)
开发者ID:Zlei1115,项目名称:networking-vsphere,代码行数:51,代码来源:dvs_neutron_agent.py

示例14: __init__

    def __init__(self, host, conf=None):
        self.conf = conf or cfg.CONF
        self._load_drivers()
        self.context = context.get_admin_context_without_session()
        self.metering_loop = loopingcall.FixedIntervalLoopingCall(
            self._metering_loop
        )
        measure_interval = self.conf.measure_interval
        self.last_report = 0
        self.metering_loop.start(interval=measure_interval)
        self.host = host

        self.label_tenant_id = {}
        self.routers = {}
        self.metering_infos = {}
        super(MeteringAgent, self).__init__(host=host)
开发者ID:openstack,项目名称:neutron,代码行数:16,代码来源:metering_agent.py

示例15: __init__

    def __init__(self, physical_devices_mappings, exclude_devices,
                 polling_interval, rp_bandwidths, rp_inventory_defaults):

        self.polling_interval = polling_interval
        self.network_ports = collections.defaultdict(list)
        self.conf = cfg.CONF
        self.device_mappings = physical_devices_mappings
        self.exclude_devices = exclude_devices
        self.setup_eswitch_mgr(physical_devices_mappings,
                               exclude_devices)

        # Stores port update notifications for processing in the main loop
        self.updated_devices = set()
        # Stores <mac, pci_slot> pairs for ports whose binding has been
        # activated.
        self.activated_bindings = set()

        self.context = context.get_admin_context_without_session()
        self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
        self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)
        self.sg_agent = agent_sg_rpc.SecurityGroupAgentRpc(
            self.context, self.sg_plugin_rpc)
        self._setup_rpc()
        self.ext_manager = self._create_agent_extension_manager(
            self.connection)

        configurations = {'device_mappings': physical_devices_mappings,
                          n_constants.RP_BANDWIDTHS: rp_bandwidths,
                          n_constants.RP_INVENTORY_DEFAULTS:
                              rp_inventory_defaults,
                          'extensions': self.ext_manager.names()}

        # TODO(mangelajo): optimize resource_versions (see ovs agent)
        self.agent_state = {
            'binary': 'neutron-sriov-nic-agent',
            'host': self.conf.host,
            'topic': n_constants.L2_AGENT_TOPIC,
            'configurations': configurations,
            'agent_type': n_constants.AGENT_TYPE_NIC_SWITCH,
            'resource_versions': resources.LOCAL_RESOURCE_VERSIONS,
            'start_flag': True}

        # The initialization is complete; we can start receiving messages
        self.connection.consume_in_threads()
        # Initialize iteration counter
        self.iter_num = 0
开发者ID:openstack,项目名称:neutron,代码行数:46,代码来源:sriov_nic_agent.py


注:本文中的neutron_lib.context.get_admin_context_without_session函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。