1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00

fix(instances): a create whose definition answer was lost keeps the VM's disk

A definition can go through on the host while its answer is lost, as when
the connection drops right then. The create job took every failed
definition for none and deleted the new disk and seed, so the VM could be
left defined without them, and recovery then reported it created.

The job now asks the host for the VM's UUID first. Only when the host says
there is no such VM do the new volumes go; otherwise they stay and recovery
decides, recording the VM it finds.
This commit is contained in:
catborise 2026-11-10 20:46:13 +03:00
parent f53b41039d
commit 18d8c2a8f0
4 changed files with 34 additions and 1 deletions

View file

@ -31,6 +31,9 @@ class CloudInitCreateTestCase(TransactionTestCase):
patcher = patch("instances.jobs.wvmCreate")
self.conn = patcher.start().return_value
self.addCleanup(patcher.stop)
missing = libvirt.libvirtError("no domain")
missing.get_error_code = lambda: libvirt.VIR_ERR_NO_DOMAIN
self.conn.wvm.lookupByUUIDString.side_effect = missing # until the job defines the VM
self.conn.get_instances.return_value = []
self.conn.get_cache_modes.return_value = {"none": "Disable cache"}
self.conn.get_firmwares.return_value = ["BIOS", "UEFI", "UEFI Secure Boot"]