Skip to content

Commit

Permalink
Fix image_type=base after snapshot
Browse files Browse the repository at this point in the history
When an instance is snapshotted, the resultant image should have the
image_type property set to "snapshot".  However, if the base image
already had image_type set to "base", the image_type on the snapshot
will also be set to "base".  This turns out to be because we set
image properties in two different places.  The first is when the
image record is created in glance, which occurs in
nova.compute.api:API._create_image(); this is when image_type is set
to "snapshot".  However, in nova.virt.xenapi.vm_utils:upload_image(),
all the properties from the base image are copied over, so all the
properties set by _create_image() could be overwritten.

The quick solution was to extend the non_inheritable_image_properties
configuration setting to also cover the image properties set by
_create_image().  Long-term, these two metadata-setting processes
need to be more closely unified.  (It should be noted that the
upload_image() function contains a TODO stating that the code should
move into the compute manager, so it can be shared across
hypervisors…)

Fixes bug 1031079.

Change-Id: I936bc147fb823eca67e40084cba5c3bc1a7fe73a
  • Loading branch information
Kevin L. Mitchell committed Jul 30, 2012
1 parent a84c35d commit aab2f2e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion nova/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,13 @@ def _get_my_ip():
default='noauth',
help='The strategy to use for auth: noauth or keystone.'),
cfg.ListOpt('non_inheritable_image_properties',
default=['cache_in_nova'],
default=['cache_in_nova',
'instance_uuid',
'user_id',
'image_type',
'backup_type',
'min_ram',
'min_disk'],
help='These are image properties which a snapshot should not'
' inherit from an instance'),
]
Expand Down

0 comments on commit aab2f2e

Please sign in to comment.