1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +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

@ -48,7 +48,8 @@ class VolumeCloneJobTestCase(TransactionTestCase):
op.refresh_from_db()
CloneVolume().run(op, Context(op, SimpleNamespace(identity="wvc-test:1:a")))
op.refresh_from_db()
self.stg.clone_volume.assert_called_once_with("base.qcow2", "copy", None, False)
self.stg.get_volume.assert_called_with("base.qcow2")
self.stg.clone_volume.assert_called_once_with(self.stg.get_volume.return_value, "copy", None, False)
self.assertEqual(op.intent["created"], "copy.qcow2")
self.assertIn(f"key=pool%3A{self.compute.pk}%3Apool-a", self.client.get(url).content.decode())