[libvirt-users] virsh snapshot-create --print-xml seems to ignore most arguments

Hi, I am wondering if the --print-xml option is working correctly. The output for two snapshot-create commands are the same, even though the first one includes additional options (no-metadata and atomic). I want to use the generated XML to create a snapshot via a perl script, and Sys::Virt only seems to support snapshots using a XML description of the arguments. timos@cerberus:~$ sudo virsh snapshot-create-as --domain web guest- state1 --diskspec hda,file=overlay1.qcow2 --disk-only --atomic --no- metadata --print-xml <domainsnapshot> <name>guest-state1</name> <disks> <disk name='hda'> <source file='overlay1.qcow2'/> </disk> </disks> </domainsnapshot> timos@cerberus:~$ sudo virsh snapshot-create-as --domain web guest- state1 --diskspec hda,file=overlay1.qcow2 --disk-only --print-xml <domainsnapshot> <name>guest-state1</name> <disks> <disk name='hda'> <source file='overlay1.qcow2'/> </disk> </disks> </domainsnapshot> My libvirt version is: Compiled against library: libvirt 5.6.0 Using library: libvirt 5.6.0 Using API: QEMU 5.6.0 Running hypervisor: QEMU 4.1.0 Regards, Timo

On 11/20/19 11:14 AM, Timo Schneider wrote:
Hi,
I am wondering if the --print-xml option is working correctly. The output for two snapshot-create commands are the same, even though the first one includes additional options (no-metadata and atomic).
--no-metadata and --atomic merely pass additional flags to the API call; they do not affect the XML. Remember, it is the combination of both the XML and the API flags that control what the API will do.
I want to use the generated XML to create a snapshot via a perl script, and Sys::Virt only seems to support snapshots using a XML description of the arguments.
Yes, the perl bindings don't have the convenience wrappers like virsh, so you'll need the XML; but the perl bindings DO let you also pass in flags for the case where virsh has bool options for setting a flag. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
participants (2)
-
Eric Blake
-
Timo Schneider