From e3b49a2167e5210f6984164d30376b4ac11fd245 Mon Sep 17 00:00:00 2001 From: Andrew Laski Date: Tue, 26 Feb 2013 13:47:03 -0500 Subject: Use min_ram of original image for snapshot, even with VHD When snapshotting an instance there seems to be no reason that min_ram can't be set based off of the original image in all cases. This relaxes the restriction that VHD backed instances set min_ram for snapshots based on the current instance. Bug 1133524 Change-Id: I3779c48d7325f3f0bde496f43a70017fe79d2835 --- nova/compute/api.py | 4 ++-- nova/tests/compute/test_compute.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'nova') diff --git a/nova/compute/api.py b/nova/compute/api.py index bba6ee1eb..1fab15fb1 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -1644,13 +1644,13 @@ class API(base.Base): #disk format of vhd is non-shrinkable if orig_image.get('disk_format') == 'vhd': - min_ram = instance['instance_type']['memory_mb'] min_disk = instance['instance_type']['root_gb'] else: #set new image values to the original image values - min_ram = orig_image.get('min_ram') min_disk = orig_image.get('min_disk') + min_ram = orig_image.get('min_ram') + return min_ram, min_disk def _get_block_device_info(self, context, instance_uuid): diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index 5ad333c9e..08adb7367 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -4663,8 +4663,8 @@ class ComputeAPITestCase(BaseTestCase): def test_snapshot_minram_mindisk_VHD(self): """Ensure a snapshots min_ram and min_disk are correct. - A snapshot of a non-shrinkable VHD should have min_ram - and min_disk set to that of the original instances flavor. + A snapshot of a non-shrinkable VHD should have min_disk + set to that of the original instances flavor. """ self.fake_image.update(disk_format='vhd', @@ -4678,7 +4678,7 @@ class ComputeAPITestCase(BaseTestCase): self.assertEqual(image['name'], 'snap1') instance_type = instance['instance_type'] - self.assertEqual(image['min_ram'], instance_type['memory_mb']) + self.assertEqual(image['min_ram'], self.fake_image['min_ram']) self.assertEqual(image['min_disk'], instance_type['root_gb']) properties = image['properties'] self.assertTrue('backup_type' not in properties) -- cgit