qemu: monitor: check for common 'Error: ' string

qemu 4.0.0 will prefix most errors with 'Error: ', so consider any
string instance of that an error.

This fixes savevm failure detection when migration is blocked due to
usage of nested VMX

https://bugzilla.redhat.com/show_bug.cgi?id=1697997

Acked-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2019-04-10 13:56:54 -04:00
parent d9ed7bb1dd
commit 77bca8b730

View File

@ -182,6 +182,7 @@ qemuMonitorTextCreateSnapshot(qemuMonitorPtr mon,
if (strstr(reply, "Error while creating snapshot") || if (strstr(reply, "Error while creating snapshot") ||
strstr(reply, "Could not open VM state file") || strstr(reply, "Could not open VM state file") ||
strstr(reply, "State blocked by non-migratable device") || strstr(reply, "State blocked by non-migratable device") ||
strstr(reply, "Error: ") ||
(strstr(reply, "Error") && strstr(reply, "while writing VM"))) { (strstr(reply, "Error") && strstr(reply, "while writing VM"))) {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("Failed to take snapshot: %s"), reply); _("Failed to take snapshot: %s"), reply);
@ -229,6 +230,7 @@ int qemuMonitorTextLoadSnapshot(qemuMonitorPtr mon, const char *name)
_("Failed to load snapshot: %s"), reply); _("Failed to load snapshot: %s"), reply);
goto cleanup; goto cleanup;
} else if (strstr(reply, "Could not open VM state file") || } else if (strstr(reply, "Could not open VM state file") ||
strstr(reply, "Error: ") ||
(strstr(reply, "Error") && (strstr(reply, "Error") &&
(strstr(reply, "while loading VM state") || (strstr(reply, "while loading VM state") ||
strstr(reply, "while activating snapshot on")))) { strstr(reply, "while activating snapshot on")))) {
@ -266,8 +268,9 @@ int qemuMonitorTextDeleteSnapshot(qemuMonitorPtr mon, const char *name)
} else if (strstr(reply, "Snapshots not supported on device")) { } else if (strstr(reply, "Snapshots not supported on device")) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s", reply); virReportError(VIR_ERR_OPERATION_INVALID, "%s", reply);
goto cleanup; goto cleanup;
} else if (strstr(reply, "Error") && } else if (strstr(reply, "Error: ") ||
strstr(reply, "while deleting snapshot")) { (strstr(reply, "Error") &&
strstr(reply, "while deleting snapshot"))) {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("Failed to delete snapshot: %s"), reply); _("Failed to delete snapshot: %s"), reply);
goto cleanup; goto cleanup;