summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Riedemann <mriedem@us.ibm.com>2013-06-11 10:32:39 -0700
committerMatt Riedemann <mriedem@us.ibm.com>2013-06-11 10:32:39 -0700
commit50680eee2f9842eaca5491e740f1715a2bd32f90 (patch)
tree4e524802c471c1f3bcac230f6b9b9b91a97aaeec
parent685228d96b7d40f537cf6144014234e24e8cd7fd (diff)
downloadnova-50680eee2f9842eaca5491e740f1715a2bd32f90.tar.gz
nova-50680eee2f9842eaca5491e740f1715a2bd32f90.tar.xz
nova-50680eee2f9842eaca5491e740f1715a2bd32f90.zip
Remove redundant architecture property update in powervm snapshot
During an instance snapshot if the architecture property is defined in the image it is updated twice in the snapshot image. The snapshot is created with the metadata values from the "instance_system_metadata" table and then, if defined, the architecture property is updated from the value in the base image in that moment. There is no reason to treat this property differently from others. Also, it didn't respect the "non_inheritable_image_properties" option. This change removes the special behavior for the architecture property in the powervm driver during a snapshot. Fixes bug 1189969 Change-Id: I05ebcaef7b75387827917b5b223868794d98e0aa
-rw-r--r--nova/tests/virt/powervm/test_powervm.py13
-rwxr-xr-xnova/virt/powervm/driver.py6
2 files changed, 12 insertions, 7 deletions
diff --git a/nova/tests/virt/powervm/test_powervm.py b/nova/tests/virt/powervm/test_powervm.py
index 3781c6738..181cdee3e 100644
--- a/nova/tests/virt/powervm/test_powervm.py
+++ b/nova/tests/virt/powervm/test_powervm.py
@@ -269,9 +269,12 @@ class PowerVMDriverTestCase(test.TestCase):
self._loc_expected_task_state = expected_state
loc_context = context.get_admin_context()
+ arch = 'fake_arch'
properties = {'instance_id': self.instance['id'],
- 'user_id': str(loc_context.user_id)}
- sent_meta = {'name': 'fake_snap', 'is_public': False,
+ 'user_id': str(loc_context.user_id),
+ 'architecture': arch}
+ snapshot_name = 'fake_snap'
+ sent_meta = {'name': snapshot_name, 'is_public': False,
'status': 'creating', 'properties': properties}
image_service = fake.FakeImageService()
recv_meta = image_service.create(loc_context, sent_meta)
@@ -283,6 +286,12 @@ class PowerVMDriverTestCase(test.TestCase):
self.assertTrue(self._loc_task_state == task_states.IMAGE_UPLOADING and
self._loc_expected_task_state == task_states.IMAGE_PENDING_UPLOAD)
+ snapshot = image_service.show(context, recv_meta['id'])
+ self.assertEquals(snapshot['properties']['image_state'], 'available')
+ self.assertEquals(snapshot['properties']['architecture'], arch)
+ self.assertEquals(snapshot['status'], 'active')
+ self.assertEquals(snapshot['name'], snapshot_name)
+
def _set_get_info_stub(self, state):
def fake_get_instance(instance_name):
return {'state': state,
diff --git a/nova/virt/powervm/driver.py b/nova/virt/powervm/driver.py
index 5117bdf72..2684c99ea 100755
--- a/nova/virt/powervm/driver.py
+++ b/nova/virt/powervm/driver.py
@@ -1,6 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
-# Copyright 2012 IBM Corp.
+# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@@ -161,10 +161,6 @@ class PowerVMDriver(driver.ComputeDriver):
'container_format': image_meta['container_format']
}
- if 'architecture' in image_meta['properties']:
- arch = image_meta['properties']['architecture']
- new_snapshot_meta['properties']['architecture'] = arch
-
# disk capture and glance upload
self._powervm.capture_image(context, instance, image_id,
new_snapshot_meta, update_task_state)