From: Gary Kotton Date: Fri, 25 Jan 2013 15:30:26 +0000 (+0000) Subject: Ensure that correct root helper is used X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=76eef0200a7c9ff357ca48c2a1e172a2ffd2f728;p=openstack-build%2Fneutron-build.git Ensure that correct root helper is used Fixes bug 1105193 Change-Id: Iaaf0b3687c410f5dbfa152d601ae3b2492a610dd --- diff --git a/quantum/agent/ovs_cleanup_util.py b/quantum/agent/ovs_cleanup_util.py index cce0ae6d8..a744c16db 100644 --- a/quantum/agent/ovs_cleanup_util.py +++ b/quantum/agent/ovs_cleanup_util.py @@ -41,10 +41,15 @@ def setup_conf(): 'bridges.')) ] + agent_opts = [ + cfg.StrOpt('root_helper', default='sudo'), + ] + conf = cfg.CommonConfigOpts() conf.register_cli_opts(opts) conf.register_opts(l3_agent.L3NATAgent.OPTS) conf.register_opts(interface.OPTS) + conf.register_opts(agent_opts, 'AGENT') config.setup_logging(conf) return conf @@ -60,7 +65,7 @@ def main(): configuration_bridges = set([conf.ovs_integration_bridge, conf.external_network_bridge]) - ovs_bridges = set(ovs_lib.get_bridges(conf.root_helper)) + ovs_bridges = set(ovs_lib.get_bridges(conf.AGENT.root_helper)) if conf.ovs_all_ports: bridges = ovs_bridges @@ -69,7 +74,7 @@ def main(): for bridge in bridges: LOG.info(_("Cleaning %s"), bridge) - ovs = ovs_lib.OVSBridge(bridge, conf.root_helper) + ovs = ovs_lib.OVSBridge(bridge, conf.AGENT.root_helper) ovs.delete_ports(all_ports=conf.ovs_all_ports) LOG.info(_("OVS cleanup completed successfully")) diff --git a/quantum/tests/unit/test_agent_ovs_cleanup.py b/quantum/tests/unit/test_agent_ovs_cleanup.py index d82f4103d..646485722 100644 --- a/quantum/tests/unit/test_agent_ovs_cleanup.py +++ b/quantum/tests/unit/test_agent_ovs_cleanup.py @@ -28,6 +28,7 @@ class TestOVSCleanup(unittest.TestCase): self.assertEqual(conf.external_network_bridge, 'br-ex') self.assertEqual(conf.ovs_integration_bridge, 'br-int') self.assertFalse(conf.ovs_all_ports) + self.assertEqual(conf.AGENT.root_helper, 'sudo') def test_main(self): with mock.patch('quantum.common.config.setup_logging'):