From cdcb64f045764017a7fba4d86207e2ec30a957f9 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Tue, 15 May 2012 10:54:13 -0400 Subject: 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/virt/libvirt/connection.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'nova/virt') diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py index a5c65ff04..507fea973 100644 --- a/nova/virt/libvirt/connection.py +++ b/nova/virt/libvirt/connection.py @@ -1964,6 +1964,10 @@ class LibvirtConnection(driver.ComputeDriver): return method() + def get_hypervisor_hostname(self): + """Returns the hostname of the hypervisor.""" + return self._conn.getHostname() + def get_cpu_info(self): """Get cpuinfo information. @@ -2075,6 +2079,7 @@ class LibvirtConnection(driver.ComputeDriver): 'local_gb_used': self.get_local_gb_used(), 'hypervisor_type': self.get_hypervisor_type(), 'hypervisor_version': self.get_hypervisor_version(), + 'hypervisor_hostname': self.get_hypervisor_hostname(), 'cpu_info': self.get_cpu_info(), 'service_id': service_ref['id'], 'disk_available_least': self.get_disk_available_least()} @@ -2656,6 +2661,7 @@ class HostState(object): self.connection.get_memory_mb_used()) data["hypervisor_type"] = self.connection.get_hypervisor_type() data["hypervisor_version"] = self.connection.get_hypervisor_version() + data["hypervisor_hostname"] = self.connection.get_hypervisor_hostname() self._stats = data -- cgit