summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorAlessandro Pilotti <ap@pilotti.it>2012-10-31 19:38:55 +0200
committerAlessandro Pilotti <ap@pilotti.it>2012-10-31 19:38:55 +0200
commit80fb666fa276b78e87590bb06d3b932eeef48e0e (patch)
tree7ee044f0605c32d005bb9598a353bfb9d7def115 /nova/tests
parent3157a42744a58083278146279de52416f2d84a4a (diff)
Fixes hypervisor based image filtering on Hyper-V
Fixes Bug #1073547 Nova scheduler's ImagePropertiesFilter based filtering requires the "supported_instances" stat returned by the driver's get_host_stats method. This fix implements the get_host_stats method, providing also some refactoring in the process by adding a HostOps class. Change-Id: Ia6e73eb3e8ff0be028854fe4fd6d8e305fa1d504
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/hyperv/stubs/test_hypervapi.HyperVAPITestCase.test_get_host_stats_shutil.p.gzbin0 -> 290 bytes
-rw-r--r--nova/tests/hyperv/stubs/test_hypervapi.HyperVAPITestCase.test_get_host_stats_wmi.p.gzbin0 -> 888 bytes
-rw-r--r--nova/tests/test_hypervapi.py10
3 files changed, 10 insertions, 0 deletions
diff --git a/nova/tests/hyperv/stubs/test_hypervapi.HyperVAPITestCase.test_get_host_stats_shutil.p.gz b/nova/tests/hyperv/stubs/test_hypervapi.HyperVAPITestCase.test_get_host_stats_shutil.p.gz
new file mode 100644
index 000000000..805931bbb
--- /dev/null
+++ b/nova/tests/hyperv/stubs/test_hypervapi.HyperVAPITestCase.test_get_host_stats_shutil.p.gz
Binary files differ
diff --git a/nova/tests/hyperv/stubs/test_hypervapi.HyperVAPITestCase.test_get_host_stats_wmi.p.gz b/nova/tests/hyperv/stubs/test_hypervapi.HyperVAPITestCase.test_get_host_stats_wmi.p.gz
new file mode 100644
index 000000000..e9852d038
--- /dev/null
+++ b/nova/tests/hyperv/stubs/test_hypervapi.HyperVAPITestCase.test_get_host_stats_wmi.p.gz
Binary files differ
diff --git a/nova/tests/test_hypervapi.py b/nova/tests/test_hypervapi.py
index 0ae65feaf..e3f9fde4c 100644
--- a/nova/tests/test_hypervapi.py
+++ b/nova/tests/test_hypervapi.py
@@ -103,6 +103,7 @@ class HyperVAPITestCase(basetestcase.BaseTestCase):
# Modules in which the mocks are going to be injected
from nova.virt.hyperv import baseops
+ from nova.virt.hyperv import hostops
from nova.virt.hyperv import livemigrationops
from nova.virt.hyperv import snapshotops
from nova.virt.hyperv import vmops
@@ -112,6 +113,7 @@ class HyperVAPITestCase(basetestcase.BaseTestCase):
modules_to_test = [
driver_hyperv,
baseops,
+ hostops,
vmops,
vmutils,
volumeops,
@@ -157,6 +159,14 @@ class HyperVAPITestCase(basetestcase.BaseTestCase):
self.assertEquals(dic['hypervisor_hostname'], platform.node())
+ def test_get_host_stats(self):
+ dic = self._conn.get_host_stats(True)
+
+ self.assertEquals(dic['disk_total'],
+ dic['disk_used'] + dic['disk_available'])
+ self.assertEquals(dic['host_memory_total'],
+ dic['host_memory_overhead'] + dic['host_memory_free'])
+
def test_list_instances(self):
num_vms = self._hypervutils.get_vm_count()
instances = self._conn.list_instances()