[libvirt] [PATCH 5/7] virsh: Edit inactive XML configuration of snapshot using snapshot-edit

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


Now, snapshot-edit will allow editing inactive XML configuration of snapshot
along with active XML configuration. When --active-only flag is used the
inactive XML will not be displayed and will be removed from snapshot.
--active-only flag is used when user doesn't what any non-persistent
configuration in domain after restoring the snapshot.

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

diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index 4b0a18d..48fc034 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -522,6 +522,10 @@ static const vshCmdOptDef opts_snapshot_edit[] = {
      .type = VSH_OT_BOOL,
      .help = N_("allow cloning to new name")
     },
+    {.name = "active-only",
+     .type = VSH_OT_BOOL,
+     .help = N_("allow editing active XML configuration and remove inactive XML")
+    },
     {.name = NULL}
 };
 
@@ -545,6 +549,9 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd)
         vshCommandOptBool(cmd, "snapshotname"))
         define_flags |= VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT;
 
+    if (vshCommandOptBool(cmd, "active-only"))
+        getxml_flags |= VIR_DOMAIN_XML_ACTIVE_ONLY;
+
     if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
         return false;
 
diff --git a/tools/virsh.pod b/tools/virsh.pod
index f899da7..0578f8f 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -4400,7 +4400,7 @@ With I<snapshotname>, this is a request to make the existing named
 snapshot become the current snapshot, without reverting the domain.
 
 =item B<snapshot-edit> I<domain> [I<snapshotname>] [I<--current>]
-{[I<--rename>] | [I<--clone>]}
+{[I<--rename>] | [I<--clone>]} [I<--active-only>]
 
 Edit the XML configuration file for I<snapshotname> of a domain.  If
 both I<snapshotname> and I<--current> are specified, also force the
@@ -4427,6 +4427,12 @@ a snapshot name must be done with care, since the contents of some
 snapshots, such as internal snapshots within a single qcow2 file, are
 accessible only from the original name.
 
+If I<--active-only> is specified, only active XML configuration of the
+snapshot is displayed to edit. Otherwise, both active and inactive XML
+configuration of the snapshot will be displayed to edit. When domain
+snapshot is edited with I<--active-only> flag, inactive XML configuration
+will be removed from snapshot. 
+
 =item B<snapshot-info> I<domain> {I<snapshot> | I<--current>}
 
 Output basic information about a named <snapshot>, or the current snapshot
-- 
1.8.3.1




More information about the libvir-list mailing list