Ensure that correct root helper is used

Fixes bug 1105193

Change-Id: Iaaf0b3687c410f5dbfa152d601ae3b2492a610dd
This commit is contained in:
Gary Kotton 2013-01-25 15:30:26 +00:00
parent 1a24b68728
commit fe0ae7a7f0
2 changed files with 8 additions and 2 deletions

View File

@ -42,10 +42,15 @@ def setup_conf():
'on integration and external network bridges.')
]
agent_opts = [
cfg.StrOpt('root_helper', default='sudo'),
]
conf = cfg.CommonConfigOpts()
conf.register_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
@ -61,7 +66,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
@ -70,7 +75,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"))

View File

@ -29,6 +29,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'):