diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-07-05 22:20:58 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-07-05 22:20:58 +0000 |
| commit | efa69b44ccdacc788a39b893d46168a725c95ec2 (patch) | |
| tree | a87defd95abff8ee5c746abd38acb7b81f96b0e8 /nova/virt | |
| parent | 6335e66e1c1a825c28cb7beb46ef913401693bae (diff) | |
| parent | 6222385d837f90f769c94f21d003999741c4f800 (diff) | |
Merge "Get hypervisor uptime."
Diffstat (limited to 'nova/virt')
| -rw-r--r-- | nova/virt/driver.py | 5 | ||||
| -rw-r--r-- | nova/virt/xenapi/connection.py | 4 | ||||
| -rw-r--r-- | nova/virt/xenapi/fake.py | 2 | ||||
| -rw-r--r-- | nova/virt/xenapi/host.py | 5 |
4 files changed, 16 insertions, 0 deletions
diff --git a/nova/virt/driver.py b/nova/virt/driver.py index d01fc7898..ad73b1896 100644 --- a/nova/virt/driver.py +++ b/nova/virt/driver.py @@ -548,6 +548,11 @@ class ComputeDriver(object): # TODO(Vek): Need to pass context in for access to auth_token raise NotImplementedError() + def get_host_uptime(self, host): + """Returns the result of calling "uptime" on the target host.""" + # TODO(Vek): Need to pass context in for access to auth_token + raise NotImplementedError() + def plug_vifs(self, instance, network_info): """Plug VIFs into networks.""" # TODO(Vek): Need to pass context in for access to auth_token diff --git a/nova/virt/xenapi/connection.py b/nova/virt/xenapi/connection.py index 4d29b7ed8..6db5e5b73 100644 --- a/nova/virt/xenapi/connection.py +++ b/nova/virt/xenapi/connection.py @@ -474,6 +474,10 @@ class XenAPIDriver(driver.ComputeDriver): """Sets the specified host's ability to accept new instances.""" return self._host.set_host_enabled(host, enabled) + def get_host_uptime(self, host): + """Returns the result of calling "uptime" on the target host.""" + return self._host.get_host_uptime(host) + def host_maintenance_mode(self, host, mode): """Start/Stop host maintenance window. On start, it triggers guest VMs evacuation.""" diff --git a/nova/virt/xenapi/fake.py b/nova/virt/xenapi/fake.py index 48c9c1083..72008a69d 100644 --- a/nova/virt/xenapi/fake.py +++ b/nova/virt/xenapi/fake.py @@ -522,6 +522,8 @@ class SessionBase(object): elif (plugin, method) == ('xenhost', 'set_host_enabled'): enabled = 'enabled' if _5.get('enabled') == 'true' else 'disabled' return jsonutils.dumps({"status": enabled}) + elif (plugin, method) == ('xenhost', 'host_uptime'): + return jsonutils.dumps({"uptime": "fake uptime"}) else: raise Exception('No simulation in host_call_plugin for %s,%s' % (plugin, method)) diff --git a/nova/virt/xenapi/host.py b/nova/virt/xenapi/host.py index 4633695fd..6594600d5 100644 --- a/nova/virt/xenapi/host.py +++ b/nova/virt/xenapi/host.py @@ -116,6 +116,11 @@ class Host(object): response = call_xenhost(self._session, "set_host_enabled", args) return response.get("status", response) + def get_host_uptime(self, _host): + """Returns the result of calling "uptime" on the target host.""" + response = call_xenhost(self._session, "host_uptime", {}) + return response.get("uptime", response) + class HostState(object): """Manages information about the XenServer host this compute |
