summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-08-15 07:56:13 +0000
committerGerrit Code Review <review@openstack.org>2012-08-15 07:56:13 +0000
commita301ff6dfd2a43ddb712eb69f4fb266dd3bc2b25 (patch)
treef7a8a8a789ca5f6060a33f88d247c9f806c58d57
parent47e612fec834b60fd0c9dfb945ae90a708bcf386 (diff)
parentaf4dc62e49128cb5e0be1fb244074b3a7c8733e8 (diff)
downloadnova-a301ff6dfd2a43ddb712eb69f4fb266dd3bc2b25.tar.gz
nova-a301ff6dfd2a43ddb712eb69f4fb266dd3bc2b25.tar.xz
nova-a301ff6dfd2a43ddb712eb69f4fb266dd3bc2b25.zip
Merge "Implement get_host_uptime in libvirt driver."
-rw-r--r--nova/tests/test_libvirt.py4
-rw-r--r--nova/virt/libvirt/driver.py7
2 files changed, 11 insertions, 0 deletions
diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py
index b1359323b..52cec9ebc 100644
--- a/nova/tests/test_libvirt.py
+++ b/nova/tests/test_libvirt.py
@@ -2682,6 +2682,10 @@ class HostStateTestCase(test.TestCase):
def get_hypervisor_hostname(self):
return 'compute1'
+ def get_host_uptime(self):
+ return ('10:01:16 up 1:36, 6 users, '
+ 'load average: 0.21, 0.16, 0.19')
+
def get_disk_available_least(self):
return 13091
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index 2ca5c2edf..75f157b9c 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -2720,6 +2720,13 @@ class LibvirtDriver(driver.ComputeDriver):
"""Sets the specified host's ability to accept new instances."""
pass
+ def get_host_uptime(self, host):
+ """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
+
def manage_image_cache(self, context):
"""Manage the local cache of images."""
self.image_cache_manager.verify_base_images(context)