[PATCH v3 2/3] snapshot: Introduce flag VIR_DOMAIN_SNAPSHOT_CREATE_UNSAFE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Introduce a flag that will allow to override safety checks in certain
snapshot configurations.
---
 include/libvirt/libvirt-domain-snapshot.h | 3 +++
 src/qemu/qemu_driver.c                    | 3 ++-
 tools/virsh-snapshot.c                    | 6 ++++++
 tools/virsh.pod                           | 6 +++++-
 4 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/include/libvirt/libvirt-domain-snapshot.h b/include/libvirt/libvirt-domain-snapshot.h
index 0f73f24b2..9d1da8710 100644
--- a/include/libvirt/libvirt-domain-snapshot.h
+++ b/include/libvirt/libvirt-domain-snapshot.h
@@ -70,6 +70,9 @@ typedef enum {
     VIR_DOMAIN_SNAPSHOT_CREATE_LIVE        = (1 << 8), /* create the snapshot
                                                           while the guest is
                                                           running */
+    VIR_DOMAIN_SNAPSHOT_CREATE_UNSAFE      = (1 << 9), /* override safety checks
+                                                          for certain
+                                                          configurations */
 } virDomainSnapshotCreateFlags;

 /* Take a snapshot of the current VM state */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 676295208..02cdd2f6b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14431,7 +14431,8 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
                   VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT |
                   VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE |
                   VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC |
-                  VIR_DOMAIN_SNAPSHOT_CREATE_LIVE, NULL);
+                  VIR_DOMAIN_SNAPSHOT_CREATE_LIVE |
+                  VIR_DOMAIN_SNAPSHOT_CREATE_UNSAFE, NULL);

     VIR_REQUIRE_FLAG_RET(VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE,
                          VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY,
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index 5c844a5ea..48ad6f2ef 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -364,6 +364,10 @@ static const vshCmdOptDef opts_snapshot_create_as[] = {
      .flags = VSH_OFLAG_REQ_OPT,
      .help = N_("memory attributes: [file=]name[,snapshot=type]")
     },
+    {.name = "unsafe",
+     .type = VSH_OT_BOOL,
+     .help = N_("override unsafe operation")
+    },
     {.name = "diskspec",
      .type = VSH_OT_ARGV,
      .help = N_("disk attributes: disk[,snapshot=type][,driver=type][,file=name]")
@@ -404,6 +408,8 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd)
         flags |= VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC;
     if (vshCommandOptBool(cmd, "live"))
         flags |= VIR_DOMAIN_SNAPSHOT_CREATE_LIVE;
+    if (vshCommandOptBool(cmd, "unsafe"))
+        flags |= VIR_DOMAIN_SNAPSHOT_CREATE_UNSAFE;

     if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
         return false;
diff --git a/tools/virsh.pod b/tools/virsh.pod
index ee7904611..62bca4b45 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -4104,7 +4104,7 @@ used to represent properties of snapshots.

 =item B<snapshot-create> I<domain> [I<xmlfile>] {[I<--redefine> [I<--current>]]
 | [I<--no-metadata>] [I<--halt>] [I<--disk-only>] [I<--reuse-external>]
-[I<--quiesce>] [I<--atomic>] [I<--live>]}
+[I<--quiesce>] [I<--atomic>] [I<--live>] [I<--unsafe>]}

 Create a snapshot for domain I<domain> with the properties specified in
 I<xmlfile>.  Normally, the only properties settable for a domain snapshot
@@ -4163,6 +4163,10 @@ the guest is running. Both disk snapshot and domain memory snapshot are
 taken. This increases the size of the memory image of the external
 checkpoint. This is currently supported only for external checkpoints.

+Certain snapshot configurations may be unsafe but historically used to work. You
+can specify the I<--unsafe> flag if a snapshot operation is forbidden due to
+being unsafe.
+
 Existence of snapshot metadata will prevent attempts to B<undefine>
 a persistent domain.  However, for transient domains, snapshot
 metadata is silently lost when the domain quits running (whether
-- 
2.12.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux