1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 01:16:10 +00:00

refactor(vrtManager): a new VM's copy of a template is made by clone_volume

clone_from_template wrote its own copy XML next to wvmStorage.clone_volume,
which the volume and VM clones use. clone_volume now takes the volume to
copy, of its pool or another, so the template's copy goes through it too;
it leaves metadata unallocated in a pool of no files, as the template copy
did. A qcow2 template's copy in a file pool is now named <vm>.qcow2, like
a new empty disk, not <vm>.img.
This commit is contained in:
catborise 2026-11-14 15:23:26 +03:00
parent 0d68888510
commit dd258888d2
6 changed files with 19 additions and 36 deletions

View file

@ -57,9 +57,13 @@ class TemplateCopyTests(SimpleTestCase):
for pool_type in ("dir", "fs", "netfs"):
with self.subTest(pool_type):
volume, flags = self.copied(pool_type, "qcow2")
self.assertEqual((volume.findtext("name"), flags), ("vm.img", True))
self.assertEqual((volume.findtext("name"), flags), ("vm.qcow2", True))
self.assertIsNotNone(volume.find("target/features/lazy_refcounts"))
def test_other_pools_take_no_metadata(self):
volume, flags = self.copied("logical", "raw")
self.assertEqual((volume.findtext("name"), flags), ("vm", False))
def test_only_a_qcow2_copy_takes_its_options(self):
for fmt in ("raw", "qcow"):
with self.subTest(fmt):