
On Fri, Oct 27, 2017 at 15:37:22 +0300, Nikolay Shirokovskiy wrote:
This patch pass event error up to the place where we can use it. Error is passed only for sync blockjob event mode as we can't use the error in async mode. In async mode we just pass the event details to the client thru event API but current blockjob event API can not carry extra parameter. ... diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index fdc8689..4bfad5d 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1000,6 +1000,7 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED, const char *diskAlias, int type, int status, + const char *error, void *opaque) { virQEMUDriverPtr driver = opaque; @@ -1021,6 +1022,9 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED, /* We have a SYNC API waiting for this event, dispatch it back */ diskPriv->blockJobType = type; diskPriv->blockJobStatus = status; + VIR_FREE(diskPriv->blockJobError); + if (error && VIR_STRDUP_QUIET(diskPriv->blockJobError, error) < 0) + VIR_WARN("Can not pass error message further: %s", error);
Checking error is not needed, you can just VIR_STRDUP it (NULL input is ignored without triggering an error). And I think we don't even need to emit the warning, we just won't have any error if there's not enough memory for making a copy of it. In other words, I think VIR_FREE(diskPriv->blockJobError); ignore_value(VIR_STRDUP_QUIET(diskPriv->blockJobError, error)); Would be sufficient. ACK with this small change. Jirka