def test_reboot_ok(self): self.mox.StubOutWithMock(ipmi, '_power_off') self.mox.StubOutWithMock(ipmi, '_power_on') ipmi._power_off(self.info) ipmi._power_on(self.info).AndReturn(states.POWER_ON) self.mox.ReplayAll() with task_manager.acquire([self.node['uuid']]) as task: self.driver.power.reboot(task, self.node) self.mox.VerifyAll()
def test_set_power_off_ok(self): self.config(ipmi_power_retry=0) self.mox.StubOutWithMock(ipmi, '_power_on') self.mox.StubOutWithMock(ipmi, '_power_off') ipmi._power_off(self.info).AndReturn(states.POWER_OFF) self.mox.ReplayAll() with task_manager.acquire([self.node['uuid']]) as task: self.driver.power.set_power_state( task, self.node, states.POWER_OFF) self.mox.VerifyAll()
def test_set_power_off_ok(self): self.config(ipmi_power_retry=0) self.mox.StubOutWithMock(ipmi, '_power_on') self.mox.StubOutWithMock(ipmi, '_power_off') ipmi._power_off(self.info).AndReturn(states.POWER_OFF) self.mox.ReplayAll() with task_manager.acquire([self.node['uuid']]) as task: self.driver.power.set_power_state(task, self.node, states.POWER_OFF) self.mox.VerifyAll()
def test_reboot_fail(self): self.mox.StubOutWithMock(ipmi, '_power_off') self.mox.StubOutWithMock(ipmi, '_power_on') ipmi._power_off(self.info) ipmi._power_on(self.info).AndReturn(states.ERROR) self.mox.ReplayAll() with task_manager.acquire([self.node['uuid']]) as task: self.assertRaises(exception.PowerStateFailure, self.driver.power.reboot, task, self.node) self.mox.VerifyAll()