diff options
| author | Matt Riedemann <mriedem@us.ibm.com> | 2013-06-15 13:10:26 -0700 |
|---|---|---|
| committer | Matt Riedemann <mriedem@us.ibm.com> | 2013-06-27 05:17:39 -0700 |
| commit | 0946017e289cc865913980dbe199106d9b152cf3 (patch) | |
| tree | 50361c5382a6edd9e6f0dbc5de628596097ca8d3 /nova/tests | |
| parent | 82fab9a0110e0ed5e2410c6d02468ff3a0a2feda (diff) | |
| download | nova-0946017e289cc865913980dbe199106d9b152cf3.tar.gz nova-0946017e289cc865913980dbe199106d9b152cf3.tar.xz nova-0946017e289cc865913980dbe199106d9b152cf3.zip | |
Implement get_host_uptime for powervm driver
This patch implements the get_host_uptime method for the powervm driver
by calling the sysstat command on the backing hypervisor and returning
the parsed results.
Fixes bug 1191785
Change-Id: I67aaf6a5f5eb6b3a411ca9a0284d9a3016dd2947
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/virt/powervm/test_powervm.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/nova/tests/virt/powervm/test_powervm.py b/nova/tests/virt/powervm/test_powervm.py index 6628c23ea..fddd97a9d 100644 --- a/nova/tests/virt/powervm/test_powervm.py +++ b/nova/tests/virt/powervm/test_powervm.py @@ -173,7 +173,8 @@ class FakeBlockAdapter(powervm_blockdev.PowerVMLocalVolumeAdapter): def fake_get_powervm_operator(): - return FakeIVMOperator(None) + return FakeIVMOperator(common.Connection('fake_host', 'fake_user', + 'fake_password')) def create_instance(testcase): @@ -618,6 +619,25 @@ class PowerVMDriverTestCase(test.TestCase): self.assertEquals(host_stats['supported_instances'][0][1], "powervm") self.assertEquals(host_stats['supported_instances'][0][2], "hvm") + def test_get_host_uptime(self): + """ + Tests that the get_host_uptime method issues the proper sysstat command + and parses the output correctly. + """ + exp_cmd = "ioscli sysstat -short fake_user" + output = [("02:54PM up 24 days, 5:41, 1 user, " + "load average: 0.06, 0.03, 0.02")] + + fake_op = self.powervm_connection._powervm + self.mox.StubOutWithMock(fake_op._operator, 'run_vios_command') + fake_op._operator.run_vios_command(exp_cmd).AndReturn(output) + + self.mox.ReplayAll() + + # the host parameter isn't used so we just pass None + uptime = self.powervm_connection.get_host_uptime(None) + self.assertEquals("02:54PM up 24 days 5:41", uptime) + class PowerVMDriverLparTestCase(test.TestCase): """Unit tests for PowerVM connection calls.""" |
