示例#1
0
    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()
示例#2
0
    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()
示例#3
0
    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()
示例#4
0
    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()
示例#5
0
    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()
示例#6
0
    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()