From 50680eee2f9842eaca5491e740f1715a2bd32f90 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Tue, 11 Jun 2013 10:32:39 -0700 Subject: 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 --- nova/tests/virt/powervm/test_powervm.py | 13 +++++++++++-- nova/virt/powervm/driver.py | 6 +----- 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) -- cgit