[PATCHv2 2/2] qemu: snapshot: Forbid taking/reverting snapshots in PMSUSPENDED state

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

 



Qemu doesn't currently support them and behaves strangely. Just forbid
them.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1079162
---
 src/qemu/qemu_driver.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 91baa7d..eae23d3 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13401,9 +13401,14 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
     case VIR_DOMAIN_SHUTDOWN:
     case VIR_DOMAIN_SHUTOFF:
     case VIR_DOMAIN_CRASHED:
-    case VIR_DOMAIN_PMSUSPENDED:
         break;

+    case VIR_DOMAIN_PMSUSPENDED:
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("qemu doesn't support taking snapshots of "
+                         "PMSUSPENDED guests"));
+        goto cleanup;
+
         /* invalid states */
     case VIR_DOMAIN_NOSTATE:
     case VIR_DOMAIN_BLOCKED: /* invalid state, unused in qemu */
@@ -14178,8 +14183,6 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
     case VIR_DOMAIN_SHUTDOWN:
     case VIR_DOMAIN_SHUTOFF:
     case VIR_DOMAIN_CRASHED:
-        /* XXX: The following one is clearly wrong! */
-    case VIR_DOMAIN_PMSUSPENDED:
         /* Transitions 1, 4, 7 */
         /* Newer qemu -loadvm refuses to revert to the state of a snapshot
          * created by qemu-img snapshot -c.  If the domain is running, we
@@ -14245,6 +14248,12 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
         }
         break;

+    case VIR_DOMAIN_PMSUSPENDED:
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("qemu doesn't support reversion of snapshot taken in "
+                         "PMSUSPENDED state"));
+        goto cleanup;
+
     case VIR_DOMAIN_NOSTATE:
     case VIR_DOMAIN_BLOCKED:
     case VIR_DOMAIN_LAST:
-- 
2.0.0

--
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]