diff options
| author | Lorin Hochstein <lorin@isi.edu> | 2011-06-24 10:52:59 -0400 |
|---|---|---|
| committer | Lorin Hochstein <lorin@isi.edu> | 2011-06-24 10:52:59 -0400 |
| commit | 101fcf7488f4f2b42102da0533c5d97c8f53dd49 (patch) | |
| tree | 6d34755f6c7c48879034b79303316ab6295e37af | |
| parent | 4c46c44d7c1458ccaa3919110de12dfceef406c1 (diff) | |
| download | nova-101fcf7488f4f2b42102da0533c5d97c8f53dd49.tar.gz nova-101fcf7488f4f2b42102da0533c5d97c8f53dd49.tar.xz nova-101fcf7488f4f2b42102da0533c5d97c8f53dd49.zip | |
Edited the host filter test case for extra specs
| -rw-r--r-- | nova/scheduler/host_filter.py | 4 | ||||
| -rw-r--r-- | nova/tests/scheduler/test_host_filter.py | 16 |
2 files changed, 16 insertions, 4 deletions
diff --git a/nova/scheduler/host_filter.py b/nova/scheduler/host_filter.py index 9c396cc0c..5f61f9456 100644 --- a/nova/scheduler/host_filter.py +++ b/nova/scheduler/host_filter.py @@ -103,7 +103,7 @@ class InstanceTypeFilter(HostFilter): # 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: @@ -128,7 +128,7 @@ class InstanceTypeFilter(HostFilter): if host_ram_mb >= spec_ram and \ disk_bytes >= spec_disk and \ self._satisfies_extra_specs(capabilities, instance_type): - selected_hosts.append((host, capabilities)) + selected_hosts.append((host, capabilities)) return selected_hosts #host entries (currently) are like: diff --git a/nova/tests/scheduler/test_host_filter.py b/nova/tests/scheduler/test_host_filter.py index 75a2cb21c..b1892dab4 100644 --- a/nova/tests/scheduler/test_host_filter.py +++ b/nova/tests/scheduler/test_host_filter.py @@ -77,14 +77,26 @@ class HostFilterTestCase(test.TestCase): swap=500, rxtx_quota=30000, rxtx_cap=200, - extra_specs={'gpu': 'nvidia'}) + extra_specs={'xpu_arch': 'fermi', + 'xpu_info': 'Tesla 2050'}) self.zone_manager = FakeZoneManager() states = {} for x in xrange(10): states['host%02d' % (x + 1)] = {'compute': self._host_caps(x)} self.zone_manager.service_states = states - self.zone_manager.service_states['host07']['compute']['gpu'] = 'nvidia' + + # Add some extra capabilities to some hosts + host07 = self.zone_manager.service_states['host07']['compute'] + host07['xpu_arch'] = 'fermi' + host07['xpu_info'] = 'Tesla 2050' + + host08 = self.zone_manager.service_states['host08']['compute'] + host08['xpu_arch'] = 'radeon' + + host09 = self.zone_manager.service_states['host09']['compute'] + host09['xpu_arch'] = 'fermi' + host09['xpu_info'] = 'Tesla 2150' def tearDown(self): FLAGS.default_host_filter = self.old_flag |
