Avoids logging error on ML2 OVS agent start

On agent start, we check the interface type to cleanup ports of
wrong type if any. We should not log error on not finding db entry
for interface type, because the interface and hence the db entry
may not exist yet.

Change-Id: Ie619a7fd141fbaa92d39b73f77e5c8c1efc8ec48
Closes-Bug: #1545058
This commit is contained in:
Ritesh Anand 2016-02-17 07:48:07 -08:00
parent 412012de59
commit 87d3370740
3 changed files with 7 additions and 4 deletions

View File

@ -1100,7 +1100,10 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
bridge, prefix=constants.PEER_PHYSICAL_PREFIX)
# Interface type of port for physical and integration bridges must
# be same, so check only one of them.
int_type = self.int_br.db_get_val("Interface", int_if_name, "type")
# Not logging error here, as the interface may not exist yet.
# Type check is done to cleanup wrong interface if any.
int_type = self.int_br.db_get_val("Interface",
int_if_name, "type", log_errors=False)
if self.use_veth_interconnection:
# Drop ports if the interface types doesn't match the
# configuration value.

View File

@ -1080,7 +1080,7 @@ class TestOvsNeutronAgent(object):
mock.call.phys_br.setup_controllers(mock.ANY),
mock.call.phys_br.setup_default_table(),
mock.call.int_br.db_get_val('Interface', 'int-br-eth',
'type'),
'type', log_errors=False),
# Have to use __getattr__ here to avoid mock._Call.__eq__
# method being called
mock.call.int_br.db_get_val().__getattr__('__eq__')('veth'),

View File

@ -194,7 +194,7 @@ class TunnelTest(object):
constants.NONEXISTENT_PEER), ]
self.mock_int_bridge_expected += [
mock.call.db_get_val('Interface', 'int-%s' % self.MAP_TUN_BRIDGE,
'type'),
'type', log_errors=False),
mock.call.add_patch_port('int-%s' % self.MAP_TUN_BRIDGE,
constants.NONEXISTENT_PEER),
]
@ -640,7 +640,7 @@ class TunnelTestUseVethInterco(TunnelTest):
]
self.mock_int_bridge_expected += [
mock.call.db_get_val('Interface', 'int-%s' % self.MAP_TUN_BRIDGE,
'type'),
'type', log_errors=False),
mock.call.add_port(self.inta)
]