summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2012-05-15 10:54:13 -0400
committerDan Prince <dprince@redhat.com>2012-05-15 11:31:25 -0400
commitcdcb64f045764017a7fba4d86207e2ec30a957f9 (patch)
tree3255c0b4c398a922e2d13ec799470328090ea5a9 /nova/tests
parent8823f7bef2142a807b3c92e512f602b6b415a3e2 (diff)
Implement get_hypervisor_hostname for libvirt.
Implements get_hypervisor_hostname so that the OS-EXT-SRV-ATTR:hypervisor_hostname extension can properly display this information when using libvirt. Fixes LP Bug #999729. Change-Id: I124d48ca352dc225f88999046f9d212ffb9e4c6e
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/fakelibvirt.py3
-rw-r--r--nova/tests/test_libvirt.py4
2 files changed, 7 insertions, 0 deletions
diff --git a/nova/tests/fakelibvirt.py b/nova/tests/fakelibvirt.py
index 5a317dca1..693330408 100644
--- a/nova/tests/fakelibvirt.py
+++ b/nova/tests/fakelibvirt.py
@@ -507,6 +507,9 @@ class Connection(object):
def getVersion(self):
return 14000
+ def getHostname(self):
+ return 'compute1'
+
def getCapabilities(self):
return '''<capabilities>
<host>
diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py
index b0b165c70..426246fe3 100644
--- a/nova/tests/test_libvirt.py
+++ b/nova/tests/test_libvirt.py
@@ -1695,6 +1695,9 @@ class HostStateTestCase(test.TestCase):
def get_hypervisor_version(self):
return 13091
+ def get_hypervisor_hostname(self):
+ return 'compute1'
+
def get_disk_available_least(self):
return 13091
@@ -1721,6 +1724,7 @@ class HostStateTestCase(test.TestCase):
self.assertEquals(stats["host_memory_free"], 409)
self.assertEquals(stats["hypervisor_type"], 'QEMU')
self.assertEquals(stats["hypervisor_version"], 13091)
+ self.assertEquals(stats["hypervisor_hostname"], 'compute1')
class NWFilterFakes: