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

@ -370,7 +370,7 @@ class wvmStorage(wvmConnect):
def clone_volume(
self,
name,
vol,
target_file,
vol_fmt=None,
metadata=False,
@ -379,9 +379,11 @@ class wvmStorage(wvmConnect):
disk_owner_uid=0,
disk_owner_gid=0,
):
vol = self.get_volume(name)
"""A copy in this pool of vol, a volume of this pool or another; its name."""
if not vol_fmt:
vol_fmt = self.get_volume_format_type(name)
vol_fmt = util.get_xml_path(vol.XMLDesc(0), "/volume/target/format/@type")
if self.get_type() not in FILE_POOL_TYPES:
metadata = False # only a file has metadata to allocate
target_file = self.clone_name(target_file, vol_fmt, file_suffix)