diff mbox series

[3/3] qemu: monitor: check for common 'Error: ' string

Message ID 894724dd2d3f282f41cbc828dfbb7aa5d0812599.1554919494.git.crobinso@redhat.com
State Accepted
Commit 77bca8b730383d00bd097baa0b2bd83ad4108c04
Headers show
Series qemu: monitor: detect more snapshot errors | expand

Commit Message

Cole Robinson April 10, 2019, 6:29 p.m. UTC
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

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 src/qemu/qemu_monitor_text.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox series

Patch

diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 76095674ab..280cc58840 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -182,6 +182,7 @@  qemuMonitorTextCreateSnapshot(qemuMonitorPtr mon,
     if (strstr(reply, "Error while creating snapshot") ||
         strstr(reply, "Could not open VM state file") ||
         strstr(reply, "State blocked by non-migratable device") ||
+        strstr(reply, "Error: ") ||
         (strstr(reply, "Error") && strstr(reply, "while writing VM"))) {
         virReportError(VIR_ERR_OPERATION_FAILED,
                        _("Failed to take snapshot: %s"), reply);
@@ -229,6 +230,7 @@  int qemuMonitorTextLoadSnapshot(qemuMonitorPtr mon, const char *name)
                        _("Failed to load snapshot: %s"), reply);
         goto cleanup;
     } else if (strstr(reply, "Could not open VM state file") ||
+               strstr(reply, "Error: ") ||
                (strstr(reply, "Error") &&
                 (strstr(reply, "while loading VM state") ||
                  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")) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s", reply);
         goto cleanup;
-    } else if (strstr(reply, "Error") &&
-               strstr(reply, "while deleting snapshot")) {
+    } else if (strstr(reply, "Error: ") ||
+               (strstr(reply, "Error") &&
+                strstr(reply, "while deleting snapshot"))) {
         virReportError(VIR_ERR_OPERATION_FAILED,
                        _("Failed to delete snapshot: %s"), reply);
         goto cleanup;