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
This commit is contained in:
Dan Prince
2012-05-15 10:54:13 -04:00
parent b29263ae98
commit 173bf4edcc
2 changed files with 7 additions and 0 deletions

View File

@@ -507,6 +507,9 @@ class Connection(object):
def getVersion(self):
return 14000
def getHostname(self):
return 'compute1'
def getCapabilities(self):
return '''<capabilities>
<host>

View File

@@ -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: