summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-07-05 17:19:49 +0000
committerGerrit Code Review <review@openstack.org>2012-07-05 17:19:49 +0000
commitac8e228e5bcdcb816ea6e7f056e16fdcc5b0aca7 (patch)
tree236be8706ae77e258661504d7c7fecd49cc989d5 /nova
parent9c37ef6dc31125e1aed7f75dc1d05be3f24d6880 (diff)
parentdd0e0ad5942743a434adf36bb91d107ac4e484e9 (diff)
Merge "Allow network_uuids that begin with a prefix"
Diffstat (limited to 'nova')
-rw-r--r--nova/api/openstack/compute/servers.py9
-rw-r--r--nova/tests/api/openstack/compute/test_servers.py6
2 files changed, 12 insertions, 3 deletions
diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py
index ca87f3d4a..1b0ad9463 100644
--- a/nova/api/openstack/compute/servers.py
+++ b/nova/api/openstack/compute/servers.py
@@ -524,9 +524,12 @@ class Controller(wsgi.Controller):
network_uuid = network['uuid']
if not utils.is_uuid_like(network_uuid):
- msg = _("Bad networks format: network uuid is not in"
- " proper format (%s)") % network_uuid
- raise exc.HTTPBadRequest(explanation=msg)
+ br_uuid = network_uuid.split('-', 1)[-1]
+ if not utils.is_uuid_like(br_uuid):
+ msg = _("Bad networks format: network uuid is "
+ "not in proper format "
+ "(%s)") % network_uuid
+ raise exc.HTTPBadRequest(explanation=msg)
#fixed IP address is optional
#if the fixed IP address is not provided then
diff --git a/nova/tests/api/openstack/compute/test_servers.py b/nova/tests/api/openstack/compute/test_servers.py
index ca5efe6c3..5b9fdc3d2 100644
--- a/nova/tests/api/openstack/compute/test_servers.py
+++ b/nova/tests/api/openstack/compute/test_servers.py
@@ -119,6 +119,12 @@ class ServersControllerTest(test.TestCase):
fake_network.stub_out_nw_api_get_instance_nw_info(self.stubs,
spectacular=True)
+ def test_requested_networks_prefix(self):
+ uuid = 'br-00000000-0000-0000-0000-000000000000'
+ requested_networks = [{'uuid': uuid}]
+ res = self.controller._get_requested_networks(requested_networks)
+ self.assertTrue((uuid, None) in res)
+
def test_get_server_by_uuid(self):
req = fakes.HTTPRequest.blank('/v2/fake/servers/%s' % FAKE_UUID)
res_dict = self.controller.show(req, FAKE_UUID)