summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNaveed Massjouni <naveedm9@gmail.com>2012-03-08 19:47:10 +0000
committerNaveed Massjouni <naveedm9@gmail.com>2012-03-08 20:02:38 +0000
commit0e867f3d85773369a45d0680043ffaf40e4b1848 (patch)
tree972011a59c75ed2554bb0353bb705af8b017c0db
parenta5fba51ce08e6f93134b434fccd5a960f7e215ec (diff)
Fixing image snapshots server links
The responses for images that are snapshots should honor the configured link prefix for the server links. Change-Id: Ie6218c532fe5f012307309832e6b079f72f52a5b
-rw-r--r--nova/api/openstack/compute/views/images.py2
-rw-r--r--nova/tests/api/openstack/compute/test_images.py4
2 files changed, 4 insertions, 2 deletions
diff --git a/nova/api/openstack/compute/views/images.py b/nova/api/openstack/compute/views/images.py
index 865e7df85..c9b8e5804 100644
--- a/nova/api/openstack/compute/views/images.py
+++ b/nova/api/openstack/compute/views/images.py
@@ -59,6 +59,8 @@ class ViewBuilder(common.ViewBuilder):
if instance_uuid is not None:
server_ref = os.path.join(request.application_url, 'servers',
instance_uuid)
+ server_ref = self._update_link_prefix(server_ref,
+ FLAGS.osapi_compute_link_prefix)
image_dict["server"] = {
"id": instance_uuid,
"links": [{
diff --git a/nova/tests/api/openstack/compute/test_images.py b/nova/tests/api/openstack/compute/test_images.py
index 64ac7edc1..d9bcc1e14 100644
--- a/nova/tests/api/openstack/compute/test_images.py
+++ b/nova/tests/api/openstack/compute/test_images.py
@@ -123,8 +123,8 @@ class ImagesControllerTest(test.TestCase):
bookmark = "https://zoo.com:42/fake/images/124"
alternate = "http://circus.com:34/fake/images/124"
server_uuid = "aa640691-d1a7-4a67-9d3c-d35ee6b3cc74"
- server_href = "http://localhost/v2/servers/" + server_uuid
- server_bookmark = "http://localhost/servers/" + server_uuid
+ server_href = "https://zoo.com:42/v2/servers/" + server_uuid
+ server_bookmark = "https://zoo.com:42/servers/" + server_uuid
expected_image = {
"image": {