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

fix(instances): allow editing disks that have no driver format

A disk without driver/@type could not be edited: the empty format was
rejected, and edit_disk would have written type=''. An empty format is
now accepted and edit_disk leaves the type attribute out.
This commit is contained in:
catborise 2026-10-02 23:58:55 +03:00
parent 0f611e6383
commit 479faaa4ca
4 changed files with 36 additions and 5 deletions

View file

@ -913,12 +913,12 @@ class wvmInstance(wvmConnect):
additionals += f"detect_zeroes='{detect_zeroes_mode}' "
xml_disk = f"<disk type='{old_disk_type}' device='{old_disk_device}'>"
# A disk without a driver type keeps having none.
type_attr = f"type='{format}' " if format else ""
if old_disk_device == "cdrom":
xml_disk += f"<driver name='{old_driver_name}' type='{format}'/>"
xml_disk += f"<driver name='{old_driver_name}' {type_attr}/>"
elif old_disk_device == "disk":
xml_disk += (
f"<driver name='{old_driver_name}' type='{format}' {additionals}/>"
)
xml_disk += f"<driver name='{old_driver_name}' {type_attr}{additionals}/>"
if disk_el.get("type") == "file":
xml_disk += f"<source file='{source}'/>"