[libvirt] [PATCH 0/2] qemu: Properly detect if qemu is unable to do snapshot due to AHCI

Peter Krempa (2): qemu: monitor: Refactor error handling for 'savevm' qemu: snapshot: Correctly report qemu error on 'savevm' src/qemu/qemu_monitor_text.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) -- 2.6.2

Unify few error conditions into a single error reporting case. --- src/qemu/qemu_monitor_text.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 316a942..0801f84 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -2640,7 +2640,10 @@ int qemuMonitorTextSetDrivePassphrase(qemuMonitorPtr mon, return ret; } -int qemuMonitorTextCreateSnapshot(qemuMonitorPtr mon, const char *name) + +int +qemuMonitorTextCreateSnapshot(qemuMonitorPtr mon, + const char *name) { char *cmd = NULL; char *reply = NULL; @@ -2654,21 +2657,16 @@ int qemuMonitorTextCreateSnapshot(qemuMonitorPtr mon, const char *name) if (qemuMonitorHMPCommand(mon, cmd, &reply)) goto cleanup; - if (strstr(reply, "Error while creating snapshot") != NULL) { + if (strstr(reply, "Error while creating snapshot") || + strstr(reply, "Could not open VM state file") || + (strstr(reply, "Error") && strstr(reply, "while writing VM"))) { virReportError(VIR_ERR_OPERATION_FAILED, _("Failed to take snapshot: %s"), reply); goto cleanup; - } else if (strstr(reply, "No block device can accept snapshots") != NULL) { + } else if (strstr(reply, "No block device can accept snapshots")) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("this domain does not have a device to take snapshots")); goto cleanup; - } else if (strstr(reply, "Could not open VM state file") != NULL) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", reply); - goto cleanup; - } else if (strstr(reply, "Error") != NULL - && strstr(reply, "while writing VM") != NULL) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", reply); - goto cleanup; } ret = 0; -- 2.6.2

Since 'savevm' was not converted to QMP libvirt has to parse for error strings in the text monitor output. One of the unhandled errors is produced when qemu treats a device as unmigratable. As current qemu actually does support AHCI migration this bug is applicable only to older versions of qemu. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1293899 --- src/qemu/qemu_monitor_text.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 0801f84..bb87397 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -2659,6 +2659,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, "while writing VM"))) { virReportError(VIR_ERR_OPERATION_FAILED, _("Failed to take snapshot: %s"), reply); -- 2.6.2

On Fri, Jan 15, 2016 at 03:00:57PM +0100, Peter Krempa wrote:
Peter Krempa (2): qemu: monitor: Refactor error handling for 'savevm' qemu: snapshot: Correctly report qemu error on 'savevm'
src/qemu/qemu_monitor_text.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
ACK series
participants (2)
-
Pavel Hrdina
-
Peter Krempa