1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-08 19:26:48 +00:00

test(instances): isolate the live libvirt suite on shared hosts

- Runs only when TEST_LIBVIRT_HOST is set, so manage.py test on a
  developer machine no longer creates VMs on the local libvirtd.
- Every VM and volume is named wvc-test-*, and volumes live in a
  temporary wvc-test pool (/var/lib/libvirt/wvc-test) instead of the
  default pool next to real images.
- Cleanup removes only prefixed domains and the test pool's volumes;
  it also clears leftovers of an interrupted run before starting, and
  tolerates domains that turned transient.
- tearDownClass fails if any domain or volume outside the test
  namespace appeared, disappeared or was replaced.
- livetest gains create_volume/define_vm helpers and
  test_live_dataloss.py, whose setUpClass opens the class transaction
  last, so a failed libvirt connection cannot lock the test database
  for later test classes.

The first live tests reproduce two known external-snapshot data losses
and are marked expectedFailure: reverting deletes a disk added after
the snapshot, and deleting the older of two snapshots deletes the
newer one's overlay.
This commit is contained in:
catborise 2026-10-03 18:53:22 +03:00
parent fbc6c4976f
commit dbbf2ce2e8
5 changed files with 294 additions and 43 deletions

View file

@ -1,5 +1,5 @@
<domain type="kvm">
<name>test-vm</name>
<name>wvc-test-vm</name>
<uuid>1bd3c1f2-dd12-4b8d-a298-dff387cb9f93</uuid>
<memory unit="KiB">131072</memory>
<currentMemory unit="KiB">131072</currentMemory>
@ -22,7 +22,7 @@
<devices>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2" cache="directsync" />
<source file="/var/lib/libvirt/images/test-volume.qcow2" />
<source file="/var/lib/libvirt/wvc-test/wvc-test-volume.qcow2" />
<target dev="vda" bus="virtio" />
<address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0" />
</disk>