summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Meade <alex.meade@rackspace.com>2011-09-29 15:58:43 -0400
committerAlex Meade <alex.meade@rackspace.com>2011-09-29 16:17:53 -0400
commitf3fb16a7935e91f8c9034d1da84a2b17cbe186f8 (patch)
treedaf1c11b897f43edcfd32d5cc90217491e58f6fe
parenteb4bd86f65a440b39804d16e477aeb77f31e11c1 (diff)
downloadnova-f3fb16a7935e91f8c9034d1da84a2b17cbe186f8.tar.gz
nova-f3fb16a7935e91f8c9034d1da84a2b17cbe186f8.tar.xz
nova-f3fb16a7935e91f8c9034d1da84a2b17cbe186f8.zip
Adds the tenant id to the create images response Location header
Fixes bug 862672 Change-Id: I85fc91c64146b02718dad77686762e26bdfce08c
-rw-r--r--nova/api/openstack/servers.py5
-rw-r--r--nova/tests/api/openstack/test_server_actions.py4
2 files changed, 6 insertions, 3 deletions
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py
index d01efd904..8da3a8ff8 100644
--- a/nova/api/openstack/servers.py
+++ b/nova/api/openstack/servers.py
@@ -1244,7 +1244,10 @@ class ControllerV11(Controller):
# build location of newly-created image entity
image_id = str(image['id'])
- image_ref = os.path.join(req.application_url, 'images', image_id)
+ image_ref = os.path.join(req.application_url,
+ context.project_id,
+ 'images',
+ image_id)
resp = webob.Response(status_int=202)
resp.headers['Location'] = image_ref
diff --git a/nova/tests/api/openstack/test_server_actions.py b/nova/tests/api/openstack/test_server_actions.py
index 04b603237..4625a4809 100644
--- a/nova/tests/api/openstack/test_server_actions.py
+++ b/nova/tests/api/openstack/test_server_actions.py
@@ -871,7 +871,7 @@ class ServerActionsTestV11(test.TestCase):
response = req.get_response(fakes.wsgi_app())
self.assertEqual(202, response.status_int)
location = response.headers['Location']
- self.assertEqual('http://localhost/v1.1/images/123', location)
+ self.assertEqual('http://localhost/v1.1/fake/images/123', location)
def test_create_image_snapshots_disabled(self):
"""Don't permit a snapshot if the allow_instance_snapshots flag is
@@ -904,7 +904,7 @@ class ServerActionsTestV11(test.TestCase):
response = req.get_response(fakes.wsgi_app())
self.assertEqual(202, response.status_int)
location = response.headers['Location']
- self.assertEqual('http://localhost/v1.1/images/123', location)
+ self.assertEqual('http://localhost/v1.1/fake/images/123', location)
def test_create_image_with_too_much_metadata(self):
body = {