Merge "[OVN][Cosmetic] Improve gen_router_port_options"
This commit is contained in:
commit
6a571f8068
@ -1492,17 +1492,19 @@ class OVNClient(object):
|
|||||||
'device_owner')
|
'device_owner')
|
||||||
if is_gw_port and ovn_conf.is_ovn_emit_need_to_frag_enabled():
|
if is_gw_port and ovn_conf.is_ovn_emit_need_to_frag_enabled():
|
||||||
try:
|
try:
|
||||||
network_ids = set([port['network_id'] for port in
|
router_ports = self._get_router_ports(admin_context,
|
||||||
self._get_router_ports(admin_context, port['device_id'])])
|
port['device_id'])
|
||||||
|
except l3_exc.RouterNotFound:
|
||||||
|
# Don't add any mtu info if the router no longer exists
|
||||||
|
LOG.debug("Router %s not found", port['device_id'])
|
||||||
|
else:
|
||||||
|
network_ids = {port['network_id'] for port in router_ports}
|
||||||
for net in self._plugin.get_networks(admin_context,
|
for net in self._plugin.get_networks(admin_context,
|
||||||
filters={'id': network_ids}):
|
filters={'id': network_ids}):
|
||||||
if net['mtu'] > network['mtu']:
|
if net['mtu'] > network['mtu']:
|
||||||
options[ovn_const.OVN_ROUTER_PORT_GW_MTU_OPTION] = str(
|
options[ovn_const.OVN_ROUTER_PORT_GW_MTU_OPTION] = str(
|
||||||
network['mtu'])
|
network['mtu'])
|
||||||
break
|
break
|
||||||
except l3_exc.RouterNotFound:
|
|
||||||
# Don't add any mtu info if the router no longer exists
|
|
||||||
pass
|
|
||||||
return options
|
return options
|
||||||
|
|
||||||
def _create_lrouter_port(self, context, router, port, txn=None):
|
def _create_lrouter_port(self, context, router, port, txn=None):
|
||||||
|
@ -1634,7 +1634,7 @@ class TestOVNL3RouterPlugin(test_mech_driver.Ml2PluginV2TestCase):
|
|||||||
'network_id': 'priv-net'}
|
'network_id': 'priv-net'}
|
||||||
ari.return_value = self.fake_router_interface_info
|
ari.return_value = self.fake_router_interface_info
|
||||||
# If we remove the router halfway the return value of
|
# If we remove the router halfway the return value of
|
||||||
# _get_routers_ports will be []
|
# _get_routers_ports will be RouterNotFound
|
||||||
grps.side_effect = l3_exc.RouterNotFound(router_id=router_id)
|
grps.side_effect = l3_exc.RouterNotFound(router_id=router_id)
|
||||||
self.get_router.return_value = self.fake_router_with_ext_gw
|
self.get_router.return_value = self.fake_router_with_ext_gw
|
||||||
network_attrs = {'id': 'prov-net', 'mtu': 1200}
|
network_attrs = {'id': 'prov-net', 'mtu': 1200}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user