From 6222385d837f90f769c94f21d003999741c4f800 Mon Sep 17 00:00:00 2001 From: "Kevin L. Mitchell" Date: Fri, 29 Jun 2012 17:17:04 -0500 Subject: Get hypervisor uptime. Adds a call to retrieve the current uptime on a specific hypervisor. This version of the patch only adds the XenAPI variant; other virt drivers will raise a NotImplementedError until they implement the get_host_uptime() method. Change-Id: Ie259589757a460fcd91a49a8dd8099e4d91524e7 --- plugins/xenserver/xenapi/etc/xapi.d/plugins/xenhost | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenhost b/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenhost index d7effba19..4006de420 100755 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenhost +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenhost @@ -339,6 +339,12 @@ def parse_response(resp): return data +@jsonify +def host_uptime(self, arg_dict): + """Returns the result of the uptime command on the xenhost.""" + return {"uptime": _run_command('uptime')} + + def cleanup(dct): """Take the raw KV pairs returned and translate them into the appropriate types, discarding any we don't need. @@ -432,4 +438,5 @@ if __name__ == "__main__": "host_join": host_join, "get_config": get_config, "set_config": set_config, - "iptables_config": iptables_config}) + "iptables_config": iptables_config, + "host_uptime": host_uptime}) -- cgit