Implement "<transient shareBacking=yes/>" to virtinst to allow a transient disk to be shared across VMs. It is introduced to libvirt since: 75871da0ec qemu: Allow <transient> disks with images shared accross VMs Signed-off-by: Han Han <hhan@xxxxxxxxxx> --- tests/data/cli/compare/virt-install-many-devices.xml | 1 + tests/test_cli.py | 2 +- virtinst/cli.py | 1 + virtinst/devices/disk.py | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/data/cli/compare/virt-install-many-devices.xml b/tests/data/cli/compare/virt-install-many-devices.xml index 7c4b0d54..1c22083f 100644 --- a/tests/data/cli/compare/virt-install-many-devices.xml +++ b/tests/data/cli/compare/virt-install-many-devices.xml @@ -216,6 +216,7 @@ <driver name="qemu" type="raw"/> <source file="/var/lib/libvirt/images/disk.img"/> <target dev="vdp" bus="virtio"/> + <transient shareBacking="yes"/> </disk> <disk type="block" device="disk"> <driver name="qemu" type="raw" cache="none" io="native"/> diff --git a/tests/test_cli.py b/tests/test_cli.py index 0ab64182..2c3b6e5a 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -608,7 +608,7 @@ vcpus.vcpu1.id=2,vcpus.vcpu1.enabled=yes --disk path=/dev/disk-pool/diskvol7,device=lun,bus=scsi,reservations.managed=no,reservations.source.type=unix,reservations.source.path=/var/run/test/pr-helper0.sock,reservations.source.mode=client,\ source.reservations.managed=no,source.reservations.source.type=unix,source.reservations.source.path=/var/run/test/pr-helper0.sock,source.reservations.source.mode=client,target.rotation_rate=6000 --disk vol=iscsi-direct/unit:0:0:1 ---disk size=.0001,format=raw +--disk size=.0001,format=raw,transient=on,transient.shareBacking=yes --disk size=.0001,pool=disk-pool --disk path=%(EXISTIMG1)s,type=dir --disk path=/fooroot.img,size=.0001,transient=on diff --git a/virtinst/cli.py b/virtinst/cli.py index fe08c433..e2ea9278 100644 --- a/virtinst/cli.py +++ b/virtinst/cli.py @@ -3441,6 +3441,7 @@ class ParserDisk(VirtCLIParser): cls.add_arg("readonly", "read_only", is_onoff=True) cls.add_arg("shareable", "shareable", is_onoff=True) cls.add_arg("transient", "transient", is_onoff=True) + cls.add_arg("transient.shareBacking", "transient_shareBacking", is_onoff=True) cls.add_arg("target.bus", "bus") cls.add_arg("target.removable", "removable", is_onoff=True) diff --git a/virtinst/devices/disk.py b/virtinst/devices/disk.py index 0a0bb564..cd6dd4a4 100644 --- a/virtinst/devices/disk.py +++ b/virtinst/devices/disk.py @@ -476,6 +476,7 @@ class DeviceDisk(Device): read_only = XMLProperty("./readonly", is_bool=True) shareable = XMLProperty("./shareable", is_bool=True) transient = XMLProperty("./transient", is_bool=True) + transient_shareBacking = XMLProperty("./transient/@shareBacking", is_yesno=True) driver_cache = XMLProperty("./driver/@cache") driver_discard = XMLProperty("./driver/@discard") driver_detect_zeroes = XMLProperty("./driver/@detect_zeroes") -- 2.31.1