Merge "l3-agent: move check if ext-net bridge exists within daemon loop"

This commit is contained in:
Jenkins 2012-09-21 09:56:49 +00:00 committed by Gerrit Code Review
commit 0f6af09b7e
2 changed files with 10 additions and 8 deletions

View File

@ -117,11 +117,6 @@ class L3NATAgent(object):
self.polling_interval = conf.polling_interval
if (self.conf.external_network_bridge and
not ip_lib.device_exists(self.conf.external_network_bridge)):
raise Exception("external network bridge '%s' does not exist"
% self.conf.external_network_bridge)
self.qclient = client.Client(
username=self.conf.admin_user,
password=self.conf.admin_password,
@ -193,6 +188,13 @@ class L3NATAgent(object):
return ex_nets[0]['id']
def do_single_loop(self):
if (self.conf.external_network_bridge and
not ip_lib.device_exists(self.conf.external_network_bridge)):
LOG.error("external network bridge '%s' does not exist"
% self.conf.external_network_bridge)
return
prev_router_ids = set(self.router_info)
cur_router_ids = set()

View File

@ -81,9 +81,6 @@ class TestBasicRouterOperations(unittest.TestCase):
def testAgentCreate(self):
agent = l3_agent.L3NATAgent(self.conf)
self.device_exists.assert_has_calls(
[mock.call(self.conf.external_network_bridge)])
def _test_internal_network_action(self, action):
port_id = _uuid()
router_id = _uuid()
@ -251,6 +248,9 @@ class TestBasicRouterOperations(unittest.TestCase):
# verify that remove is called
self.assertEquals(self.mock_ip.get_devices.call_count, 1)
self.device_exists.assert_has_calls(
[mock.call(self.conf.external_network_bridge)])
def testDaemonLoop(self):
# just take a pass through the loop, then raise on time.sleep()