Esempio n. 1
0
 def test_delete_undefine_snapshots(self):
     """QEMU Domain undefine with snapshots metadata."""
     domain = mock.Mock()
     logger = mock.Mock()
     domain.isActive.return_value = False
     qemu.domain_delete(domain, logger)
     domain.undefineFlags.assert_called_with(libvirt.VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA)
Esempio n. 2
0
 def test_delete_undefine(self):
     """QEMU Domain is undefined."""
     domain = mock.Mock()
     logger = mock.Mock()
     domain.isActive.return_value = False
     qemu.domain_delete(domain, logger)
     self.assertTrue(domain.undefineFlags.called)
Esempio n. 3
0
 def test_delete_destroy(self):
     """QEMU Domain is destroyed if active."""
     domain = mock.Mock()
     logger = mock.Mock()
     domain.isActive.return_value = True
     qemu.domain_delete(domain, logger)
     self.assertTrue(domain.destroy.called)
Esempio n. 4
0
 def test_delete_destroy_error(self):
     """QEMU Domain destroy raises error."""
     domain = mock.Mock()
     logger = mock.Mock()
     domain.isActive.return_value = True
     domain.destroy.side_effect = libvirt.libvirtError("BOOM")
     qemu.domain_delete(domain, logger)
     self.assertTrue(domain.undefineFlags.called)