On 10/30/2017 04:51 AM, Kothapally Madhu Pavan wrote:
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(a)linux.vnet.ibm.com>
---
tools/virsh-snapshot.c | 7 +++++++
tools/virsh.pod | 20 ++++++++++++++++++++
2 files changed, 27 insertions(+)
Hmm... ahhh... so patch 3 is dumping the inactive XML in the middle of
the active XML... And we're doing that for what reason? Why would the
snapshot XML need to be different?
If one can use --inactive flags for dumpxml to specifically dump the
"newDom" if it exists (or the "dom" if it doesn't), then it would
essentially follow how the domain does this (see qemuDomainFormatXML).
Looking back at patch 3 now, I guess generating XML for the inactive
within the context of active just doesn't seem right.
John
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