summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-08-31 17:38:02 +0000
committerGerrit Code Review <review@openstack.org>2012-08-31 17:38:02 +0000
commite1cdd0f3be2615482bd485e590e1fddeea566e12 (patch)
tree91a7543989c626cf4d31f9ab32fa7348891d7541 /nova/compute
parentb164525e25662f71068838e323690156c51675d1 (diff)
parent04e6ad112f541df68b06c17f141be916e5e8bdb2 (diff)
Merge "Save the original base image ref for snapshots."
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/api.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index e47147522..6ce5b5526 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -682,6 +682,16 @@ class API(base.Base):
new_value = str(value)[:255]
instance['system_metadata']['image_%s' % key] = new_value
+ # Keep a record of the original base image that this
+ # image's instance is derived from:
+ base_image_ref = image['properties'].get('base_image_ref')
+ if not base_image_ref:
+ # base image ref property not previously set through a snapshot.
+ # default to using the image ref as the base:
+ base_image_ref = base_options['image_ref']
+
+ instance['system_metadata']['image_base_image_ref'] = base_image_ref
+
# Use 'default' security_group if none specified.
if security_groups is None:
security_groups = ['default']
@@ -1167,6 +1177,13 @@ class API(base.Base):
'image_type': image_type,
}
+ # Persist base image ref as a Glance image property
+ system_meta = self.db.instance_system_metadata_get(
+ context, instance_uuid)
+ base_image_ref = system_meta.get('image_base_image_ref')
+ if base_image_ref:
+ properties['base_image_ref'] = base_image_ref
+
sent_meta = {'name': name, 'is_public': False}
if image_type == 'backup':