diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 9f417d27c6..5ca76d2d80 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -708,8 +708,15 @@ qemuMonitorJSONHandleIOError(qemuMonitor *mon, virJSONValue *data) action = "ignore"; } - if ((device = virJSONValueObjectGetString(data, "device")) == NULL) + if ((device = virJSONValueObjectGetString(data, "device")) == NULL) { VIR_WARN("missing device in disk io error event"); + } else { + /* 'device' was documented as mandatory in the qemu event, but later became + * optional, in which case an empty string is sent by qemu. Convert it back + * to NULL */ + if (*device == '\0') + device = NULL; + } nodename = virJSONValueObjectGetString(data, "node-name"); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 34a755a49a..edcd8ac3a8 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -840,9 +840,6 @@ qemuProcessHandleIOError(qemuMonitor *mon G_GNUC_UNUSED, virObjectLock(vm); priv = QEMU_DOMAIN_PRIVATE(vm); - if (*diskAlias == '\0') - diskAlias = NULL; - if (diskAlias) disk = qemuProcessFindDomainDiskByAliasOrQOM(vm, diskAlias, NULL); else if (nodename)