diff options
| author | Lorin Hochstein <lorin@isi.edu> | 2011-06-24 01:44:22 -0400 |
|---|---|---|
| committer | Lorin Hochstein <lorin@isi.edu> | 2011-06-24 01:44:22 -0400 |
| commit | e6dcd9b4008feb9a053edcd7c6f6020772a03c59 (patch) | |
| tree | 4de2350aba41eb3f6fa2f5d81417ea141fc3f70d | |
| parent | 48f3bccc3372023c35a75671e25e9089dd4ed836 (diff) | |
Dealing with cases where extra_specs wasn't defined
| -rw-r--r-- | nova/scheduler/host_filter.py | 4 | ||||
| -rw-r--r-- | nova/tests/test_host_filter.py | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/nova/scheduler/host_filter.py b/nova/scheduler/host_filter.py index 7d4b9ad91..9c396cc0c 100644 --- a/nova/scheduler/host_filter.py +++ b/nova/scheduler/host_filter.py @@ -97,9 +97,13 @@ class InstanceTypeFilter(HostFilter): """Check that the capabilities provided by the compute service satisfy the extra specs associated with the instance type""" + if 'extra_specs' not in instance_type: + return True + # Note(lorinh): For now, we are just checking exact matching on the # values. Later on, we want to handle numerical # values so we can represent things like number of GPU cards + try: for key, value in instance_type['extra_specs'].iteritems(): if capabilities[key] != value: diff --git a/nova/tests/test_host_filter.py b/nova/tests/test_host_filter.py index 3361c7b73..438f3e522 100644 --- a/nova/tests/test_host_filter.py +++ b/nova/tests/test_host_filter.py @@ -67,7 +67,8 @@ class HostFilterTestCase(test.TestCase): flavorid=1, swap=500, rxtx_quota=30000, - rxtx_cap=200) + rxtx_cap=200, + extra_specs={}) self.zone_manager = FakeZoneManager() states = {} |
