Skip to content

Commit

Permalink
Ensure that correct root helper is used
Browse files Browse the repository at this point in the history
Fixes bug 1105193

Change-Id: Iaaf0b3687c410f5dbfa152d601ae3b2492a610dd
  • Loading branch information
Gary Kotton committed Jan 26, 2013
1 parent 1a24b68 commit fe0ae7a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions quantum/agent/ovs_cleanup_util.py
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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"))
1 change: 1 addition & 0 deletions quantum/tests/unit/test_agent_ovs_cleanup.py
Expand Up @@ -29,6 +29,7 @@ def test_setup_conf(self):
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'):
Expand Down

0 comments on commit fe0ae7a

Please sign in to comment.