On 09/14/2011 03:27 PM, Eric Blake wrote:
With this patch, it is hopefully a bit more obvious that for
snapshot-create-as, a literal '--diskspec' is mandatory if name
or description was omitted, but optional if all earlier options
were provided.

These all denote two diskspecs and a description:
virsh snapshot-create-as dom name desc vda vdb
virsh snapshot-create-as dom name desc --diskspec vda --diskspec vdb
virsh snapshot-create-as dom name desc --diskspec vda vdb
virsh snapshot-create-as dom name desc vda --diskspec vdb
virsh snapshot-create-as dom name desc --diskspec vda --diskspec vdb

Hmm, I'd better squash this in as well, so that we don't regress ;)

diff --git i/tests/virsh-optparse w/tests/virsh-optparse
index cd5e3eb..18252d2 100755
--- i/tests/virsh-optparse
+++ w/tests/virsh-optparse
@@ -80,13 +80,50 @@ cat <<\EOF > exp-out || framework_failure
   </disks>
 </domainsnapshot>

-
 EOF
-virsh -c $test_url snapshot-create-as --print-xml test \
+virsh -q -c $test_url snapshot-create-as --print-xml test \
   --diskspec 'vda,file=a&b,,c,snapshot=external' --description '1<2' \
   --diskspec vdb >out 2>>err || fail=1
 compare out exp-out || fail=1

+cat <<\EOF > exp-out || framework_failure
+<domainsnapshot>
+  <name>name</name>
+  <description>vda</description>
+  <disks>
+    <disk name='vdb'/>
+  </disks>
+</domainsnapshot>
+
+EOF
+virsh -q -c $test_url snapshot-create-as  --print-xml test name vda vdb \
+  >out 2>>err || fail=1
+compare out exp-out || fail=1
+
+cat <<\EOF > exp-out || framework_failure
+<domainsnapshot>
+  <name>name</name>
+  <description>desc</description>
+  <disks>
+    <disk name='vda'/>
+    <disk name='vdb'/>
+  </disks>
+</domainsnapshot>
+
+EOF
+for args in \
+    'test name desc vda vdb' \
+    'test name desc --diskspec vda vdb' \
+    'test name desc --diskspec vda --diskspec vdb' \
+    'test name desc vda vdb' \
+    'test --diskspec vda name --diskspec vdb desc' \
+    '--description desc --name name --domain test vda vdb' \
+; do
+  virsh -q -c $test_url snapshot-create-as --print-xml $args \
+    >out 2>>err || fail=1
+  compare out exp-out || fail=1
+done
+
 test -s err && fail=1

 (exit $fail); exit $fail

--
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to