Skip to content

Commit

Permalink
Merge "Remove super old br-<uuid> neutron network id compat code"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Nov 16, 2019
2 parents 313a1a1 + 42e65ee commit 236d56e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
11 changes: 3 additions & 8 deletions nova/api/openstack/compute/servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,14 +389,9 @@ def _validate_network_id(net_id, network_uuids):
:raises: webob.exc.HTTPBadRequest if validation fails
"""
if not uuidutils.is_uuid_like(net_id):
# NOTE(mriedem): Neutron would allow a network id with a br- prefix
# back in Folsom so continue to honor that.
# TODO(mriedem): Need to figure out if this is still a valid case.
br_uuid = net_id.split('-', 1)[-1]
if not uuidutils.is_uuid_like(br_uuid):
msg = _("Bad networks format: network uuid is "
"not in proper format (%s)") % net_id
raise exc.HTTPBadRequest(explanation=msg)
msg = _("Bad networks format: network uuid is "
"not in proper format (%s)") % net_id
raise exc.HTTPBadRequest(explanation=msg)

# duplicate networks are allowed only for neutron v2.0
if net_id in network_uuids and not utils.is_neutron():
Expand Down
10 changes: 8 additions & 2 deletions nova/tests/unit/api/openstack/compute/test_serversV21.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,17 @@ def test_instance_lookup_targets(self, mock_get_im, mock_get_inst):
self.assertIsNotNone(ctxt.db_connection)

def test_requested_networks_prefix(self):
"""Tests that we no longer support the legacy br-<uuid> format for
a network id.
"""
self.flags(use_neutron=True)
uuid = 'br-00000000-0000-0000-0000-000000000000'
requested_networks = [{'uuid': uuid}]
res = self.controller._get_requested_networks(requested_networks)
self.assertIn((uuid, None, None, None), res.as_tuples())
ex = self.assertRaises(webob.exc.HTTPBadRequest,
self.controller._get_requested_networks,
requested_networks)
self.assertIn('Bad networks format: network uuid is not in proper '
'format', six.text_type(ex))

def test_requested_networks_neutronv2_enabled_with_port(self):
self.flags(use_neutron=True)
Expand Down

0 comments on commit 236d56e

Please sign in to comment.