On 08/15/2011 05:33 PM, Eric Blake wrote:
I'll tweak the subject line a bit, since it is really one attribute and
one sub-element. Also, I'm squashing in these test files to validate
rng schema parsing; but until I add support in qemu to handle
<transient/>, there is no corresponding .args for the transient test.
.../qemuxml2argv-disk-snapshot.args | 7 ++++
.../qemuxml2argv-disk-snapshot.xml | 39
++++++++++++++++++++
.../qemuxml2argv-disk-transient.xml | 27 ++++++++++++++
tests/qemuxml2argvtest.c | 2 +
4 files changed, 75 insertions(+), 0 deletions(-)
diff --git c/tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.args
i/tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.args
new file mode 100644
index 0000000..7e62942
--- /dev/null
+++ i/tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu
-S -M \
+pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
+-no-acpi -boot c \
+-drive
file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0,format=qcow2,cache=none \
+-drive
file=/dev/HostVG/QEMUGuest3,if=ide,bus=2,unit=0,format=qcow2,cache=none \
+-drive
file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,bus=1,unit=0,format=raw \
+-net none -serial none -parallel none -usb
diff --git c/tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.xml
i/tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.xml
new file mode 100644
index 0000000..aeb2315
--- /dev/null
+++ i/tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.xml
@@ -0,0 +1,39 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory>219100</memory>
+ <currentMemory>219100</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk' snapshot='internal'>
+ <driver name='qemu' type='qcow2' cache='none'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0'
unit='0'/>
+ </disk>
+ <disk type='block' device='cdrom' snapshot='no'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest2'/>
+ <target dev='hdc' bus='ide'/>
+ <readonly/>
+ <address type='drive' controller='0' bus='1'
unit='0'/>
+ </disk>
+ <disk type='block' device='disk' snapshot='external'>
+ <driver name='qemu' type='qcow2' cache='none'/>
+ <source dev='/dev/HostVG/QEMUGuest3'/>
+ <target dev='hdb' bus='ide'/>
+ <address type='drive' controller='0' bus='2'
unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git c/tests/qemuxml2argvdata/qemuxml2argv-disk-transient.xml
i/tests/qemuxml2argvdata/qemuxml2argv-disk-transient.xml
new file mode 100644
index 0000000..df49c48
--- /dev/null
+++ i/tests/qemuxml2argvdata/qemuxml2argv-disk-transient.xml
@@ -0,0 +1,27 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory>219100</memory>
+ <currentMemory>219100</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='qcow2' cache='none'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <transient/>
+ <address type='drive' controller='0' bus='0'
unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git c/tests/qemuxml2argvtest.c i/tests/qemuxml2argvtest.c
index 6e8da5e..c7b1707 100644
--- c/tests/qemuxml2argvtest.c
+++ i/tests/qemuxml2argvtest.c
@@ -359,6 +359,8 @@ mymain(void)
DO_TEST("disk-ioeventfd", false,
QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_IOEVENTFD,
QEMU_CAPS_VIRTIO_TX_ALG, QEMU_CAPS_DEVICE);
+ DO_TEST("disk-snapshot", false,
+ QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_CACHE_V2,
QEMU_CAPS_DRIVE_FORMAT);
DO_TEST("event_idx", false,
QEMU_CAPS_DRIVE,
QEMU_CAPS_VIRTIO_BLK_EVENT_IDX,
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org