提交 49a3a649 编写于 作者: P Peter Krempa

qemu: snapshot: Reject revertion from clearly bad states

Report errors on some states snapshots done by qemu should never reach
上级 aa7e76a5
......@@ -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 reversion"),
virDomainStateTypeToString(snap->def->state));
goto cleanup;
}
ret = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册