mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
fix(instances): recovery removes the UEFI variables copy of a clone that was not defined
A shut-off clone copies the VM's NVRAM file just before it defines the clone; a worker that stopped between the two left the copy, unnamed by the job, which recovery then reported as leaving nothing. The job records the copy's path once libvirt made it, and recovery deletes that file when the clone was not defined, in whichever pool it is.
This commit is contained in:
parent
e2b038f3fa
commit
32e8ff3c11
4 changed files with 71 additions and 19 deletions
|
|
@ -321,7 +321,7 @@ class DefineCloneTestCase(unittest.TestCase):
|
|||
p.define_clone = MagicMock(return_value=UUID)
|
||||
self.assertEqual(p.clone_instance(FORM, UUID), UUID)
|
||||
p.pool.createXMLFrom.assert_called_once()
|
||||
p.define_clone.assert_called_once_with(FORM, UUID, {"vda": "/pool/copy-vda.qcow2"})
|
||||
p.define_clone.assert_called_once_with(FORM, UUID, {"vda": "/pool/copy-vda.qcow2"}, None)
|
||||
|
||||
def test_clone_instance_checks_the_macs_before_copying(self):
|
||||
p = proxy()
|
||||
|
|
@ -414,12 +414,15 @@ class LiveCloneTestCase(SimpleTestCase):
|
|||
vm = wvmInstance(*self.args, None, uuid=dom.UUIDString())
|
||||
source = vm.get_nvram()
|
||||
|
||||
made = []
|
||||
uuid = vm.clone_instance(
|
||||
{"name": P + "clone-uefi-copy", "disk-vda": P + "clone-uefi-copy-a.qcow2", "disk_owner_uid": 0, "disk_owner_gid": 0}, "abababab-0000-1111-2222-333333333333"
|
||||
{"name": P + "clone-uefi-copy", "disk-vda": P + "clone-uefi-copy-a.qcow2", "disk_owner_uid": 0, "disk_owner_gid": 0}, "abababab-0000-1111-2222-333333333333",
|
||||
on_nvram=made.append,
|
||||
)
|
||||
|
||||
clone = self.conn.lookupByUUIDString(uuid)
|
||||
path = ElementTree.fromstring(clone.XMLDesc(libvirt.VIR_DOMAIN_XML_INACTIVE)).findtext("os/nvram")
|
||||
self.assertEqual(made, [path]) # the job records it: recovery removes it if the clone is not defined
|
||||
self.assertEqual(path, os.path.join(os.path.dirname(source), P + "clone-uefi-copy_VARS.fd"))
|
||||
with vm._nvram_pool() as pool:
|
||||
copy = pool.storageVolLookupByName(os.path.basename(path))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue