From 301bc0ca1a847f921c330dced1d4b1c82946ec55 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Tue, 17 Jan 2012 16:00:20 -0500 Subject: Set instance_ref property when creating snapshots. Fixes LP bug #917810. Change-Id: I17c1e467a13075f3952dc6a1b475bc71a8b1d9bc --- nova/api/openstack/compute/contrib/admin_actions.py | 5 +---- nova/api/openstack/compute/views/images.py | 8 +++++--- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/contrib/admin_actions.py b/nova/api/openstack/compute/contrib/admin_actions.py index a4164fcb8..b44f16a1e 100644 --- a/nova/api/openstack/compute/contrib/admin_actions.py +++ b/nova/api/openstack/compute/contrib/admin_actions.py @@ -232,10 +232,7 @@ class AdminActionsController(wsgi.Controller): msg = _("createBackup attribute 'rotation' must be an integer") raise exc.HTTPBadRequest(explanation=msg) - # preserve link to server in image properties - server_ref = os.path.join(req.application_url, 'servers', id) - props = {'instance_ref': server_ref} - + props = {} metadata = entity.get('metadata', {}) common.check_img_metadata_quota_limit(context, metadata) try: diff --git a/nova/api/openstack/compute/views/images.py b/nova/api/openstack/compute/views/images.py index c4cfe8031..5ef1af59b 100644 --- a/nova/api/openstack/compute/views/images.py +++ b/nova/api/openstack/compute/views/images.py @@ -50,11 +50,13 @@ class ViewBuilder(common.ViewBuilder): "links": self._get_links(request, image["id"]), } - server_ref = image.get("properties", {}).get("instance_ref") + instance_uuid = image.get("properties", {}).get("instance_uuid") - if server_ref is not None: + if instance_uuid is not None: + server_ref = os.path.join(request.application_url, 'servers', + instance_uuid) image_dict["server"] = { - "id": common.get_id_from_href(server_ref), + "id": instance_uuid, "links": [{ "rel": "self", "href": server_ref, -- cgit