示例#1
0
    def test_power_state_get_off(self):
        mock_login = self.patch(virsh.VirshSSH, 'login')
        mock_login.return_value = True
        mock_state = self.patch(virsh.VirshSSH, 'get_state')
        mock_state.return_value = virsh.VirshVMState.OFF

        poweraddr = factory.make_name('poweraddr')
        machine = factory.make_name('machine')
        self.assertEqual('off', virsh.power_state_virsh(poweraddr, machine))
示例#2
0
    def test_power_state_get_off(self):
        mock_login = self.patch(virsh.VirshSSH, "login")
        mock_login.return_value = True
        mock_state = self.patch(virsh.VirshSSH, "get_state")
        mock_state.return_value = virsh.VirshVMState.OFF

        poweraddr = factory.make_name("poweraddr")
        machine = factory.make_name("machine")
        self.assertEqual("off", virsh.power_state_virsh(poweraddr, machine))
示例#3
0
 def power_query(self, system_id, context):
     """Power query Virsh node."""
     poweraddr, machine, password = extract_virsh_parameters(context)
     return power_state_virsh(poweraddr, machine, password)