diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 4a690bdd47b0..2c07e9630f42 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -4066,7 +4066,7 @@ class ComputeManager(manager.Manager): @wrap_exception() def get_host_uptime(self, context): """Returns the result of calling "uptime" on the target host.""" - return self.driver.get_host_uptime(self.host) + return self.driver.get_host_uptime() @object_compat @wrap_exception() diff --git a/nova/tests/unit/virt/test_virt_drivers.py b/nova/tests/unit/virt/test_virt_drivers.py index 998ecf2cbb72..54bacc9fd6e4 100644 --- a/nova/tests/unit/virt/test_virt_drivers.py +++ b/nova/tests/unit/virt/test_virt_drivers.py @@ -664,7 +664,7 @@ class _VirtDriverTestCase(_FakeDriverBackendTestCase): @catch_notimplementederror def test_get_host_uptime(self): - self.connection.get_host_uptime('a useless argument?') + self.connection.get_host_uptime() @catch_notimplementederror def test_host_power_action_reboot(self): diff --git a/nova/tests/unit/virt/vmwareapi/test_driver_api.py b/nova/tests/unit/virt/vmwareapi/test_driver_api.py index 2332660ab5d8..8a17355b4127 100644 --- a/nova/tests/unit/virt/vmwareapi/test_driver_api.py +++ b/nova/tests/unit/virt/vmwareapi/test_driver_api.py @@ -2470,7 +2470,7 @@ class VMwareAPIVMTestCase(test.NoDBTestCase): def test_get_host_uptime(self): self.assertRaises(NotImplementedError, - self.conn.get_host_uptime, 'host') + self.conn.get_host_uptime) def _test_finish_migration(self, power_on, resize_instance=False): """Tests the finish_migration method on VC Driver.""" diff --git a/nova/tests/unit/virt/xenapi/test_xenapi.py b/nova/tests/unit/virt/xenapi/test_xenapi.py index a927244f537f..0ee23374866c 100644 --- a/nova/tests/unit/virt/xenapi/test_xenapi.py +++ b/nova/tests/unit/virt/xenapi/test_xenapi.py @@ -2144,7 +2144,7 @@ class XenAPIHostTestCase(stubs.XenAPITestBase): self.assertEqual(service.disabled, True) def test_get_host_uptime(self): - result = self.conn.get_host_uptime('host') + result = self.conn.get_host_uptime() self.assertEqual(result, 'fake uptime') def test_supported_instances_is_included_in_host_state(self): diff --git a/nova/virt/driver.py b/nova/virt/driver.py index c07d178b8003..8ade83341a9a 100644 --- a/nova/virt/driver.py +++ b/nova/virt/driver.py @@ -1026,7 +1026,7 @@ class ComputeDriver(object): # TODO(Vek): Need to pass context in for access to auth_token raise NotImplementedError() - def get_host_uptime(self, host): + def get_host_uptime(self): """Returns the result of calling "uptime" on the target host.""" # TODO(Vek): Need to pass context in for access to auth_token raise NotImplementedError() diff --git a/nova/virt/hyperv/driver.py b/nova/virt/hyperv/driver.py index 50775f883628..a6ae9f53fb0d 100644 --- a/nova/virt/hyperv/driver.py +++ b/nova/virt/hyperv/driver.py @@ -233,7 +233,7 @@ class HyperVDriver(driver.ComputeDriver): def get_host_ip_addr(self): return self._hostops.get_host_ip_addr() - def get_host_uptime(self, host): + def get_host_uptime(self): return self._hostops.get_host_uptime() def get_rdp_console(self, context, instance): diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 148c5d41b94d..1f05a0fe28bb 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -5637,10 +5637,8 @@ class LibvirtDriver(driver.ComputeDriver): stats["frequency"] = self._conn.getInfo()[3] return stats - def get_host_uptime(self, host): + def get_host_uptime(self): """Returns the result of calling "uptime".""" - # NOTE(dprince): host seems to be ignored for this call and in - # other compute drivers as well. Perhaps we should remove it? out, err = utils.execute('env', 'LANG=C', 'uptime') return out diff --git a/nova/virt/vmwareapi/driver.py b/nova/virt/vmwareapi/driver.py index 479f42ce5efb..82e2ecc056fc 100644 --- a/nova/virt/vmwareapi/driver.py +++ b/nova/virt/vmwareapi/driver.py @@ -596,7 +596,7 @@ class VMwareVCDriver(driver.ComputeDriver): """ raise NotImplementedError() - def get_host_uptime(self, host): + def get_host_uptime(self): """Host uptime operation not supported by VC driver.""" msg = _("Multiple hosts may be managed by the VMWare " diff --git a/nova/virt/xenapi/driver.py b/nova/virt/xenapi/driver.py index fd56bc15debc..1deafcb48d70 100644 --- a/nova/virt/xenapi/driver.py +++ b/nova/virt/xenapi/driver.py @@ -646,9 +646,9 @@ class XenAPIDriver(driver.ComputeDriver): """Sets the compute host's ability to accept new instances.""" return self._host.set_host_enabled(enabled) - def get_host_uptime(self, host): + def get_host_uptime(self): """Returns the result of calling "uptime" on the target host.""" - return self._host.get_host_uptime(host) + return self._host.get_host_uptime() def host_maintenance_mode(self, host, mode): """Start/Stop host maintenance window. On start, it triggers diff --git a/nova/virt/xenapi/host.py b/nova/virt/xenapi/host.py index 36ff094b5be5..e0c8fe80025d 100644 --- a/nova/virt/xenapi/host.py +++ b/nova/virt/xenapi/host.py @@ -132,7 +132,7 @@ class Host(object): response = call_xenhost(self._session, "set_host_enabled", args) return response.get("status", response) - def get_host_uptime(self, _host): + def get_host_uptime(self): """Returns the result of calling "uptime" on the target host.""" response = call_xenhost(self._session, "host_uptime", {}) return response.get("uptime", response)