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