Fix create router port with no IPs
Even if a router port without IP cannot be used, Neutron allows for doing that as the IP can be updated at a later stage. This patch backport the fix already in master for not assuming a router port always has an IP upon creation. Change-Id: I99fba50cf9de243f84a9f7ce17e90aaa24168ccb
This commit is contained in:
parent
69d04c1d5f
commit
ffbcb838c2
|
@ -174,6 +174,8 @@ def get_nsx_router_id(session, cluster, neutron_router_id):
|
|||
First, look up the Neutron database. If not found, execute
|
||||
a query on NSX platform as the mapping might be missing.
|
||||
"""
|
||||
if not neutron_router_id:
|
||||
return
|
||||
nsx_router_id = nsx_db.get_nsx_router_id(
|
||||
session, neutron_router_id)
|
||||
if not nsx_router_id:
|
||||
|
|
|
@ -554,7 +554,9 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||
context.session, selected_lswitch['uuid'],
|
||||
port_data, False)
|
||||
# Assuming subnet being attached is on first fixed ip
|
||||
# element in port data
|
||||
# element in port data - if specified
|
||||
subnet_id = None
|
||||
if port_data['fixed_ips']:
|
||||
subnet_id = port_data['fixed_ips'][0]['subnet_id']
|
||||
nsx_router_id = nsx_utils.get_nsx_router_id(
|
||||
context.session, self.cluster, port_data['device_id'])
|
||||
|
|
|
@ -85,7 +85,9 @@ class NsxUtilsTestCase(base.BaseTestCase):
|
|||
def _verify_get_nsx_router_id(self, exp_lr_uuid):
|
||||
# The nsxlib and db calls are mocked, therefore the cluster
|
||||
# and the neutron_router_id parameters can be set to None
|
||||
lr_uuid = nsx_utils.get_nsx_router_id(db_api.get_session(), None, None)
|
||||
neutron_router_id = uuidutils.generate_uuid()
|
||||
lr_uuid = nsx_utils.get_nsx_router_id(db_api.get_session(), None,
|
||||
neutron_router_id)
|
||||
self.assertEqual(exp_lr_uuid, lr_uuid)
|
||||
|
||||
def test_get_nsx_switch_and_port_id_from_db_mappings(self):
|
||||
|
|
Loading…
Reference in New Issue