From 8a0c02225901bb82ae3f5aa3dfc707edfe1d3177 Mon Sep 17 00:00:00 2001 From: Lucian Petrut Date: Mon, 26 Jan 2015 20:58:18 +0200 Subject: [PATCH] Fixes Hyper-V agent root_helper issue 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 --- .../hyperv/agent/hyperv_neutron_agent.py | 17 +++++++++-------- .../unit/hyperv/test_hyperv_neutron_agent.py | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py b/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py index feb36be2d..168878c63 100644 --- a/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py +++ b/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py @@ -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... ")) diff --git a/neutron/tests/unit/hyperv/test_hyperv_neutron_agent.py b/neutron/tests/unit/hyperv/test_hyperv_neutron_agent.py index 5d06c035f..1de90d12f 100644 --- a/neutron/tests/unit/hyperv/test_hyperv_neutron_agent.py +++ b/neutron/tests/unit/hyperv/test_hyperv_neutron_agent.py @@ -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() -- 2.45.2