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

fix(vrtManager): a template's copy takes qcow2's options only as qcow2

The copy of a template for a new VM always got qcow2's compat and
lazy_refcounts, which libvirt refuses for a qcow template, and only a
dir pool named it as a file. Every pool of files now does, and only a
qcow2 copy gets those options. The pool types of files are one list,
which the cloud-init seed check also reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
catborise 2026-11-08 14:35:19 +03:00
parent f952d4e0d0
commit ff46ae509f
3 changed files with 34 additions and 10 deletions

View file

@ -5,7 +5,7 @@ import string
import pycdlib
from vrtManager import util
from vrtManager.connection import wvmConnect
from vrtManager.storage import wvmStorage
from vrtManager.storage import FILE_POOL_TYPES, wvmStorage
# libvirt's CPU modes a new VM can have; any other value is a CPU model's name (mode custom)
CPU_MODES = ("host-model", "host-passthrough", "maximum")
@ -88,10 +88,11 @@ class wvmCreate(wvmConnect):
storage_type = util.get_xml_path(stg.XMLDesc(0), "/pool/@type")
format = util.get_xml_path(vol.XMLDesc(0), "/volume/target/format/@type")
if storage_type == "dir":
if storage_type in FILE_POOL_TYPES:
clone += ".img"
else:
metadata = False
options = "<compat>1.1</compat><features><lazy_refcounts/></features>" if format == "qcow2" else ""
xml = f"""
<volume>
<name>{clone}</name>
@ -105,10 +106,7 @@ class wvmCreate(wvmConnect):
<mode>0644</mode>
<label>virt_image_t</label>
</permissions>
<compat>1.1</compat>
<features>
<lazy_refcounts/>
</features>
{options}
</target>
</volume>"""
stg.createXMLFrom(xml, vol, metadata)