summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-07-05 22:20:58 +0000
committerGerrit Code Review <review@openstack.org>2012-07-05 22:20:58 +0000
commitefa69b44ccdacc788a39b893d46168a725c95ec2 (patch)
treea87defd95abff8ee5c746abd38acb7b81f96b0e8 /nova/compute
parent6335e66e1c1a825c28cb7beb46ef913401693bae (diff)
parent6222385d837f90f769c94f21d003999741c4f800 (diff)
Merge "Get hypervisor uptime."
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/api.py6
-rw-r--r--nova/compute/manager.py7
-rw-r--r--nova/compute/rpcapi.py7
3 files changed, 18 insertions, 2 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 771ed8b17..70528271f 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -1662,6 +1662,12 @@ class HostAPI(base.Base):
return self.compute_rpcapi.set_host_enabled(context, enabled=enabled,
host=host)
+ def get_host_uptime(self, context, host):
+ """Returns the result of calling "uptime" on the target host."""
+ # NOTE(comstud): No instance_uuid argument to this compute manager
+ # call
+ return self.compute_rpcapi.get_host_uptime(context, host=host)
+
def host_power_action(self, context, host, action):
"""Reboots, shuts down or powers up the host."""
# NOTE(comstud): No instance_uuid argument to this compute manager
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index fce50ee4a..a9e9e1562 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -228,7 +228,7 @@ def _get_additional_capabilities():
class ComputeManager(manager.SchedulerDependentManager):
"""Manages the running instances from creation to destruction."""
- RPC_API_VERSION = '1.0'
+ RPC_API_VERSION = '1.1'
def __init__(self, compute_driver=None, *args, **kwargs):
"""Load configuration options and connect to the hypervisor."""
@@ -1593,6 +1593,11 @@ class ComputeManager(manager.SchedulerDependentManager):
return self.driver.set_host_enabled(host, enabled)
@exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
+ def get_host_uptime(self, context, host):
+ """Returns the result of calling "uptime" on the target host."""
+ return self.driver.get_host_uptime(host)
+
+ @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
@wrap_instance_fault
def get_diagnostics(self, context, instance_uuid):
"""Retrieve diagnostics for an instance on this host."""
diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py
index 7a531fcf5..116b2d34b 100644
--- a/nova/compute/rpcapi.py
+++ b/nova/compute/rpcapi.py
@@ -54,9 +54,10 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy):
API version history:
1.0 - Initial version.
+ 1.1 - Adds get_host_uptime()
'''
- RPC_API_VERSION = '1.0'
+ RPC_API_VERSION = '1.1'
def __init__(self):
super(ComputeAPI, self).__init__(topic=FLAGS.compute_topic,
@@ -313,6 +314,10 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy):
return self.call(ctxt, self.make_msg('set_host_enabled',
enabled=enabled), topic)
+ def get_host_uptime(self, ctxt, host):
+ topic = _compute_topic(self.topic, ctxt, host, None)
+ return self.call(ctxt, self.make_msg('get_host_uptime'), topic)
+
def snapshot_instance(self, ctxt, instance, image_id, image_type,
backup_type, rotation):
self.cast(ctxt, self.make_msg('snapshot_instance',