[NSX|V]: Fix add_router_interface for shared router driver
Under odd circumstances when devstack creates public networks with no subnets, the gateway port for the router created does not have a fixed IP. This leads to failures in add_interface for shared routers since it tries to fetch fixed IPs for all gateway ports. This patch adds a check and logs such GW ports and allows the creation of router interfaces. Change-Id: I5b5eb481e74a347e8821f65ad4d7140ad06a62f7
This commit is contained in:
parent
d1103e24f2
commit
a9e1e77329
@ -23,6 +23,7 @@ from neutron_lib import exceptions as n_exc
|
||||
from oslo_log import log as logging
|
||||
|
||||
from vmware_nsx._i18n import _
|
||||
from vmware_nsx._i18n import _LE
|
||||
from vmware_nsx.common import exceptions as nsx_exc
|
||||
from vmware_nsx.common import locking
|
||||
from vmware_nsx.db import nsxv_db
|
||||
@ -384,8 +385,12 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
|
||||
router_dict['gateway'] = None
|
||||
for gwp in gw_ports:
|
||||
if gwp['id'] == r['gw_port_id']:
|
||||
router_dict['gateway'] = (
|
||||
gwp['fixed_ips'][0]['subnet_id'])
|
||||
try:
|
||||
router_dict['gateway'] = (
|
||||
gwp['fixed_ips'][0]['subnet_id'])
|
||||
except IndexError:
|
||||
LOG.error(_LE("Skipping GW port %s with no fixed IP"),
|
||||
gwp['id'])
|
||||
subnet_ids = [p['fixed_ips'][0]['subnet_id'] for p in
|
||||
intf_ports if p['device_id'] == r['id']]
|
||||
router_dict['subnet_ids'] = subnet_ids
|
||||
|
Loading…
x
Reference in New Issue
Block a user