[libvirt] [PATCH 4/7] virsh: Dump inactive XML configuration of snapshot using snapshot-dumpxml

Kothapally Madhu Pavan kmp at linux.vnet.ibm.com
Mon Oct 30 08:51:53 UTC 2017


Now, snapshot-dumpxml will display inactive XML configuration of snapshot
along with active XML configuration. When --active-only flag is used the
inactive XML configuration will not be displayed.

Signed-off-by: Kothapally Madhu Pavan <kmp at linux.vnet.ibm.com>
---
 tools/virsh-snapshot.c |  7 +++++++
 tools/virsh.pod        | 20 ++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index 24cd4ab..4b0a18d 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -1667,6 +1667,10 @@ static const vshCmdOptDef opts_snapshot_dumpxml[] = {
      .type = VSH_OT_BOOL,
      .help = N_("include security sensitive information in XML dump")
     },
+    {.name = "active-only",
+     .type = VSH_OT_BOOL,
+     .help = N_("dump only active XML configuration and avoid inactive XML")
+    },
     {.name = NULL}
 };
 
@@ -1683,6 +1687,9 @@ cmdSnapshotDumpXML(vshControl *ctl, const vshCmd *cmd)
     if (vshCommandOptBool(cmd, "security-info"))
         flags |= VIR_DOMAIN_XML_SECURE;
 
+    if (vshCommandOptBool(cmd, "active-only"))
+        flags |= VIR_DOMAIN_XML_ACTIVE_ONLY;
+
     if (vshCommandOptStringReq(ctl, cmd, "snapshotname", &name) < 0)
         return false;
 
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 69cc423..f899da7 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -4489,11 +4489,31 @@ is specified, the list will be filtered to snapshots that use external
 files for disk images or memory state.
 
 =item B<snapshot-dumpxml> I<domain> I<snapshot> [I<--security-info>]
+[I<--active-only>]
 
 Output the snapshot XML for the domain's snapshot named I<snapshot>.
 Using I<--security-info> will also include security sensitive information.
 Use B<snapshot-current> to easily access the XML of the current snapshot.
 
+If I<--active-only> is specified, only active XML configuration of the
+snapshot is displayed. Otherwise, both active and inactive XML
+configuration of the snapshot will be displayed.
+
+When both active and inactive XML snapshot configurations are displayed,
+as inactive XML configuration will have same structure as active XML
+it is embedded within <inactiveDomain> tag as shown below:
+
+  <domainsnapshot>
+    ....
+    ....
+    <inactiveDomain>
+      <domain>
+        ....
+        ....
+      </domain>
+    </inactiveDomain>
+  </domainsnapshot>
+
 =item B<snapshot-parent> I<domain> {I<snapshot> | I<--current>}
 
 Output the name of the parent snapshot, if any, for the given
-- 
1.8.3.1




More information about the libvir-list mailing list