From 173bf4edcc2ae19e298ef71885a7deaf68c58ea1 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Tue, 15 May 2012 10:54:13 -0400 Subject: [PATCH] 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 --- nova/tests/fakelibvirt.py | 3 +++ nova/tests/test_libvirt.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/nova/tests/fakelibvirt.py b/nova/tests/fakelibvirt.py index 5a317dca..69333040 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 ''' diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py index b0b165c7..426246fe 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: