l3-agent: move check if ext-net bridge exists within daemon loop
bug 1052522 the l3 agent checked if the external network bridge exists in its constructor, raising an uncaught exception if it did not. this does not make much sense when running the l3-agent as a deamon, especially since it can be the case that the l3-agent starts before open vswitch. Change-Id: Ie1717b2c02c9f0bc0caf34a6fdb0dc3a930123c0
This commit is contained in:
parent
e5f9c71224
commit
4b85a9726f
@ -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()
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user