Merge "[NSX|V]: Fix add_router_interface for shared router driver"

This commit is contained in:
Jenkins 2016-08-14 06:41:48 +00:00 committed by Gerrit Code Review
commit 6d0a3de189

View File

@ -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