~ubuntu-branches/ubuntu/vivid/neutron/vivid-updates

« back to all changes in this revision

Viewing changes to neutron/plugins/sriovnicagent/sriov_nic_agent.py

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2015-03-30 11:17:19 UTC
  • mfrom: (1.1.21)
  • Revision ID: package-import@ubuntu.com-20150330111719-h0gx7233p4jkkgfh
Tags: 1:2015.1~b3-0ubuntu1
* New upstream milestone release:
  - d/control: Align version requirements with upstream.
  - d/control: Add new dependency on oslo-log.
  - d/p/*: Rebase.
  - d/control,d/neutron-plugin-hyperv*: Dropped, decomposed into
    separate project upstream.
  - d/control,d/neutron-plugin-openflow*: Dropped, decomposed into
    separate project upstream.
  - d/neutron-common.install: Add neutron-rootwrap-daemon and 
    neutron-keepalived-state-change binaries.
  - d/rules: Ignore neutron-hyperv-agent when installing; only for Windows.
  - d/neutron-plugin-cisco.install: Drop neutron-cisco-cfg-agent as
    decomposed into separate project upstream.
  - d/neutron-plugin-vmware.install: Drop neutron-check-nsx-config and
    neutron-nsx-manage as decomposed into separate project upstream.
  - d/control: Add dependency on python-neutron-fwaas to neutron-l3-agent.
* d/pydist-overrides: Add overrides for oslo packages.
* d/control: Fixup type in package description (LP: #1263539).
* d/p/fixup-driver-test-execution.patch: Cherry pick fix from upstream VCS
  to support unit test exection in out-of-tree vendor drivers.
* d/neutron-common.postinst: Allow general access to /etc/neutron but limit
  access to root/neutron to /etc/neutron/neutron.conf to support execution
  of unit tests in decomposed vendor drivers.
* d/control: Add dependency on python-neutron-fwaas to neutron-l3-agent
  package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import eventlet
22
22
eventlet.monkey_patch()
23
23
 
24
 
from oslo.config import cfg
25
 
from oslo import messaging
 
24
from oslo_config import cfg
 
25
from oslo_log import log as logging
 
26
import oslo_messaging
26
27
 
27
28
from neutron.agent import rpc as agent_rpc
28
29
from neutron.agent import securitygroups_rpc as sg_rpc
32
33
from neutron.common import utils as q_utils
33
34
from neutron import context
34
35
from neutron.i18n import _LE, _LI
35
 
from neutron.openstack.common import log as logging
36
36
from neutron.openstack.common import loopingcall
37
37
from neutron.plugins.sriovnicagent.common import config  # noqa
38
38
from neutron.plugins.sriovnicagent.common import exceptions as exc
47
47
    # Set RPC API version to 1.0 by default.
48
48
    # history
49
49
    #   1.1 Support Security Group RPC
50
 
    target = messaging.Target(version='1.1')
 
50
    target = oslo_messaging.Target(version='1.1')
51
51
 
52
52
    def __init__(self, context, agent, sg_agent):
53
53
        super(SriovNicSwitchRpcCallbacks, self).__init__()
68
68
 
69
69
class SriovNicSwitchAgent(object):
70
70
    def __init__(self, physical_devices_mappings, exclude_devices,
71
 
                 polling_interval, root_helper):
 
71
                 polling_interval):
72
72
 
73
73
        self.polling_interval = polling_interval
74
 
        self.root_helper = root_helper
75
74
        self.setup_eswitch_mgr(physical_devices_mappings,
76
75
                               exclude_devices)
77
76
        configurations = {'device_mappings': physical_devices_mappings}
90
89
        self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
91
90
        self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)
92
91
        self.sg_agent = sg_rpc.SecurityGroupAgentRpc(self.context,
93
 
                self.sg_plugin_rpc, self.root_helper)
 
92
                self.sg_plugin_rpc)
94
93
        self._setup_rpc()
95
94
        # Initialize iteration counter
96
95
        self.iter_num = 0
130
129
            LOG.exception(_LE("Failed reporting state!"))
131
130
 
132
131
    def setup_eswitch_mgr(self, device_mappings, exclude_devices={}):
133
 
        self.eswitch_mgr = esm.ESwitchManager(device_mappings,
134
 
                                              exclude_devices,
135
 
                                              self.root_helper)
 
132
        self.eswitch_mgr = esm.ESwitchManager(device_mappings, exclude_devices)
136
133
 
137
134
    def scan_devices(self, registered_devices, updated_devices):
138
135
        curr_devices = self.eswitch_mgr.get_assigned_devices()
337
334
    LOG.info(_LI("Exclude Devices: %s"), exclude_devices)
338
335
 
339
336
    polling_interval = cfg.CONF.AGENT.polling_interval
340
 
    root_helper = cfg.CONF.AGENT.root_helper
341
337
    try:
342
338
        agent = SriovNicSwitchAgent(device_mappings,
343
339
                                    exclude_devices,
344
 
                                    polling_interval,
345
 
                                    root_helper)
 
340
                                    polling_interval)
346
341
    except exc.SriovNicError:
347
342
        LOG.exception(_LE("Agent Initialization Failed"))
348
343
        raise SystemExit(1)