From ddb6945e8fbb8a00d5b67a6a6b8a069b7642022d Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Fri, 23 Sep 2011 16:39:21 -0400 Subject: Fixing bug 857712 Change-Id: I495363b44d9da96d66f85c2a621393329830aeb3 --- nova/compute/api.py | 4 ++-- nova/tests/test_compute.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/nova/compute/api.py b/nova/compute/api.py index 54c847a0a..cfde9cd2f 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -219,9 +219,9 @@ class API(base.Base): image_href) image = image_service.show(context, image_id) - if instance_type['memory_mb'] < int(image.get('min_ram', 0)): + if instance_type['memory_mb'] < int(image.get('min_ram') or 0): raise exception.InstanceTypeMemoryTooSmall() - if instance_type['local_gb'] < int(image.get('min_disk', 0)): + if instance_type['local_gb'] < int(image.get('min_disk') or 0): raise exception.InstanceTypeDiskTooSmall() config_drive_id = None diff --git a/nova/tests/test_compute.py b/nova/tests/test_compute.py index 2af0a6012..86ffc18a6 100644 --- a/nova/tests/test_compute.py +++ b/nova/tests/test_compute.py @@ -76,7 +76,8 @@ class ComputeTestCase(test.TestCase): test_notifier.NOTIFICATIONS = [] def fake_show(meh, context, id): - return {'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1}} + return {'id': 1, 'min_disk': None, 'min_ram': None, + 'properties': {'kernel_id': 1, 'ramdisk_id': 1}} self.stubs.Set(fake_image._FakeImageService, 'show', fake_show) -- cgit