]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: enhance snapshot-create-as
authorEric Blake <eblake@redhat.com>
Wed, 15 Jun 2011 22:24:40 +0000 (16:24 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 20 Jun 2011 16:44:08 +0000 (10:44 -0600)
Similar to pool-create-as.

* tools/virsh.c (cmdSnapshotCreateAs): Add --print-xml.
* tools/virsh.pod: Document it.

tools/virsh.c
tools/virsh.pod

index a719aabfc5de0b0e86b10a600e6284f56760744e..a315f05c87c27e35aaa9375664211c743ae7e892 100644 (file)
@@ -11142,6 +11142,7 @@ static const vshCmdOptDef opts_snapshot_create_as[] = {
     {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
     {"name", VSH_OT_DATA, 0, N_("name of snapshot")},
     {"description", VSH_OT_DATA, 0, N_("description of snapshot")},
+    {"print-xml", VSH_OT_BOOL, 0, N_("print XML document rather than create")},
     {NULL, 0, 0, NULL}
 };
 
@@ -11186,6 +11187,12 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd)
         goto cleanup;
     }
 
+    if (vshCommandOptBool(cmd, "print-xml")) {
+        vshPrint(ctl, "%s\n",  buffer);
+        ret = true;
+        goto cleanup;
+    }
+
     snapshot = virDomainSnapshotCreateXML(dom, buffer, 0);
     if (snapshot == NULL)
         goto cleanup;
index b9c54de80cad7f4aa703be22ac106ce738e25f8d..023ab42d4436099356c625e3eebfcdebc517d901 100644 (file)
@@ -1422,11 +1422,13 @@ I<xmlfile>.  The only properties settable for a domain snapshot are the
 automatically filled in by libvirt.  If I<xmlfile> is completely omitted,
 then libvirt will choose a value for all fields.
 
-=item B<snapshot-create-as> I<domain> optional I<name> I<description>
+=item B<snapshot-create-as> I<domain> optional I<--print-xml>
+I<name> I<description>
 
 Create a snapshot for domain I<domain> with the given <name> and
 <description>; if either value is omitted, libvirt will choose a
-value.
+value.  If I<--print-xml> is specified, then XML appropriate for
+I<snapshot-create> is output, rather than actually creating a snapshot.
 
 =item B<snapshot-current> I<domain>