Re: [PATCH v3 REBASE v2 1/2] qemu: prepare blockjob complete event error usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux