From 0e867f3d85773369a45d0680043ffaf40e4b1848 Mon Sep 17 00:00:00 2001 From: Naveed Massjouni Date: Thu, 8 Mar 2012 19:47:10 +0000 Subject: 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 --- nova/api/openstack/compute/views/images.py | 2 ++ nova/tests/api/openstack/compute/test_images.py | 4 ++-- 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": { -- cgit