Skip to content

Commit

Permalink
Use min_ram of original image for snapshot, even with VHD
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Andrew Laski committed Feb 26, 2013
1 parent a8fef8e commit e3b49a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions nova/compute/api.py
Expand Up @@ -1644,13 +1644,13 @@ def _get_minram_mindisk_params(self, context, instance):

#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):
Expand Down
6 changes: 3 additions & 3 deletions nova/tests/compute/test_compute.py
Expand Up @@ -4663,8 +4663,8 @@ def fake_show(meh, context, id):
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',
Expand All @@ -4678,7 +4678,7 @@ def test_snapshot_minram_mindisk_VHD(self):

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)
Expand Down

0 comments on commit e3b49a2

Please sign in to comment.