Move snapshot image property inheritance
The xenapi snapshotting code had support for inheriting properties from the base image of the snapshot (by way of the system metadata set on the snapshotted instance). The problem, however, came in the fact that some image properties were set in nova.compute.api, but those properties were not excluded from this inheritance logic except through a configuration option called "non_inheritable_image_properties". I had previously updated the default setting for this option to work around the bugs introduced by setting image properties in two different locations, but now it is time for the real fix. This change moves the inheritance logic into nova.compute.api:API._create_image. Note that two properties are still set through the xenapi snapshotting logic: the "os_type" and the "auto_disk_config" properties, which are presumed to be xenapi specific. The change also alters the inheritance logic to ensure that the work-around listing of image properties in non_inheritable_image_properties is no longer necessary; the default for this configuration option is updated accordingly. (Note: It will not harm anything to have these image properties still listed in non_inheritable_image_properties, so configurations that override this option do not need to be altered.) Change-Id: I3514da432cc10c75418e1de9752f60640d579136
This commit is contained in:
@@ -401,12 +401,6 @@ global_opts = [
|
||||
help='The strategy to use for auth: noauth or keystone.'),
|
||||
cfg.ListOpt('non_inheritable_image_properties',
|
||||
default=['cache_in_nova',
|
||||
'instance_uuid',
|
||||
'user_id',
|
||||
'image_type',
|
||||
'backup_type',
|
||||
'min_ram',
|
||||
'min_disk',
|
||||
'bittorrent'],
|
||||
help='These are image properties which a snapshot should not'
|
||||
' inherit from an instance'),
|
||||
|
||||
@@ -2296,9 +2296,6 @@ class VmUtilsTestCase(test.TestCase):
|
||||
"""Unit tests for xenapi utils."""
|
||||
|
||||
def test_upload_image(self):
|
||||
"""Ensure image properties include instance system metadata
|
||||
as well as few local settings."""
|
||||
|
||||
def fake_instance_system_metadata_get(context, uuid):
|
||||
return dict(image_a=1, image_b=2, image_c='c', d='d')
|
||||
|
||||
@@ -2337,8 +2334,8 @@ class VmUtilsTestCase(test.TestCase):
|
||||
vm_utils.upload_image(ctx, session, instance, "vmi uuids", "image id")
|
||||
|
||||
actual = self.kwargs['properties']
|
||||
expected = dict(a=1, b=2, c='c', d='d',
|
||||
auto_disk_config='auto disk config',
|
||||
# Inheritance happens in another place, now
|
||||
expected = dict(auto_disk_config='auto disk config',
|
||||
os_type='os type')
|
||||
self.assertEquals(expected, actual)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user