[PATCH 4/7] qemu: snapshot: Reject revertion from clearly bad states

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

 



Report errors on some states snapshots done by qemu should never reach
---
 src/qemu/qemu_driver.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7ab0f81..2d58b53 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14158,11 +14158,8 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
     case VIR_DOMAIN_SHUTDOWN:
     case VIR_DOMAIN_SHUTOFF:
     case VIR_DOMAIN_CRASHED:
-    case VIR_DOMAIN_NOSTATE:
-    case VIR_DOMAIN_BLOCKED:
         /* XXX: The following one is clearly wrong! */
     case VIR_DOMAIN_PMSUSPENDED:
-    case VIR_DOMAIN_LAST:
         /* 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
@@ -14227,6 +14224,15 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
             }
         }
         break;
+
+    case VIR_DOMAIN_NOSTATE:
+    case VIR_DOMAIN_BLOCKED:
+    case VIR_DOMAIN_LAST:
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Invalid target domain state '%s'. Refusing "
+                         "snapshot revertion "),
+                       virDomainStateTypeToString(snap->def->state));
+        goto cleanup;
     }

     ret = 0;
-- 
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]