]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fixes Hyper-V agent root_helper issue
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Mon, 26 Jan 2015 18:58:18 +0000 (20:58 +0200)
committerLucian Petrut <lpetrut@cloudbasesolutions.com>
Tue, 27 Jan 2015 04:03:09 +0000 (06:03 +0200)
This patch I2aaa55e8e539e47427e56b4da42321cfcfcde622 introduced a
reference to the root_helper config option in the Hyper-V Neutron
agent without it being registered. For this reason,
the Hyper-V Neutron agent fails to start.

As the root helper is not used by the Hyper-V Neutron agent,
all the occurences within the agent can be safely removed.

Change-Id: I85a6cc640e3fc7bcc8ab53a10824c206a15cda7c
Closes-Bug: #1415010

neutron/plugins/hyperv/agent/hyperv_neutron_agent.py
neutron/tests/unit/hyperv/test_hyperv_neutron_agent.py

index feb36be2d1e941da616fcb52d60aa662e509d514..168878c63e5dc4861be0952257359c8d24e63277 100644 (file)
@@ -80,9 +80,11 @@ config.register_agent_state_opts_helper(cfg.CONF)
 
 class HyperVSecurityAgent(sg_rpc.SecurityGroupAgentRpc):
 
-    def __init__(self, context, plugin_rpc, root_helper):
+    def __init__(self, context, plugin_rpc):
+        # Note: as rootwrap is not supported on HyperV, root_helper is
+        # passed in as None.
         super(HyperVSecurityAgent, self).__init__(context, plugin_rpc,
-                root_helper)
+                                                  root_helper=None)
         if sg_rpc.is_firewall_enabled():
             self._setup_rpc()
 
@@ -109,7 +111,7 @@ class HyperVNeutronAgent(object):
     # Set RPC API version to 1.1 by default.
     target = messaging.Target(version='1.1')
 
-    def __init__(self, root_helper):
+    def __init__(self):
         super(HyperVNeutronAgent, self).__init__()
         self._utils = utilsfactory.get_hypervutils()
         self._polling_interval = CONF.AGENT.polling_interval
@@ -117,7 +119,7 @@ class HyperVNeutronAgent(object):
         self._network_vswitch_map = {}
         self._port_metric_retries = {}
         self._set_agent_state()
-        self._setup_rpc(root_helper)
+        self._setup_rpc()
 
     def _set_agent_state(self):
         self.agent_state = {
@@ -137,7 +139,7 @@ class HyperVNeutronAgent(object):
         except Exception:
             LOG.exception(_LE("Failed reporting state!"))
 
-    def _setup_rpc(self, root_helper):
+    def _setup_rpc(self):
         self.agent_id = 'hyperv_%s' % platform.node()
         self.topic = topics.AGENT
         self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
@@ -159,7 +161,7 @@ class HyperVNeutronAgent(object):
                                                      consumers)
 
         self.sec_groups_agent = HyperVSecurityAgent(
-            self.context, self.sg_plugin_rpc, root_helper)
+            self.context, self.sg_plugin_rpc)
         report_interval = CONF.AGENT.report_interval
         if report_interval:
             heartbeat = loopingcall.FixedIntervalLoopingCall(
@@ -454,8 +456,7 @@ def main():
     common_config.init(sys.argv[1:])
     common_config.setup_logging()
 
-    root_helper = cfg.CONF.AGENT.root_helper
-    plugin = HyperVNeutronAgent(root_helper)
+    plugin = HyperVNeutronAgent()
 
     # Start everything.
     LOG.info(_LI("Agent initialized successfully, now running... "))
index 5d06c035f2b539a1a6707b55878fab477adaad17..1de90d12feccb471ca604746ea0fb7568e550be4 100644 (file)
@@ -53,7 +53,7 @@ class TestHyperVNeutronAgent(base.BaseTestCase):
         cfg.CONF.set_default('firewall_driver',
                              'neutron.agent.firewall.NoopFirewallDriver',
                              group='SECURITYGROUP')
-        self.agent = hyperv_neutron_agent.HyperVNeutronAgent(None)
+        self.agent = hyperv_neutron_agent.HyperVNeutronAgent()
         self.agent.plugin_rpc = mock.Mock()
         self.agent.sec_groups_agent = mock.MagicMock()
         self.agent.context = mock.Mock()