[libvirt] [PATCH 2/4] virsh: Add timestamps to events

Andrea Bolognani abologna at redhat.com
Mon Dec 21 15:25:56 UTC 2015


On Mon, 2015-12-21 at 11:04 +0100, Jiri Denemark wrote:
> 
> @@ -12154,7 +12155,16 @@ virshEventPrint(virshDomEventData *data,
>      if (!data->loop && *data->count)
>          goto cleanup;
>  
> -    vshPrint(data->ctl, "%s", msg);
> +    if (data->timestamp) {
> +        char timestamp[VIR_TIME_STRING_BUFLEN];
> +
> +        if (virTimeStringNowRaw(timestamp) < 0)
> +            timestamp[0] = '\0';
> +
> +        vshPrint(data->ctl, "%s: %s", timestamp, msg);
> +    } else {
> +        vshPrint(data->ctl, "%s", msg);
> +    }

So the timestamp is not really for the moment the even occurred,
rather the moment it was printed. I don't know if the difference is
something we should really care about.

The signature for virConnectDomainEventGenericCallback, unlike the one
for virConnectDomainQemuMonitorEventCallback, does not provide timining
information. Would it be a good idea to maybe have a new kind of
callback for generic events that includes such information, instead of
using the timestamp from when we printed the message?

What about having qemu-monitor-event support --timestamp as well? I know
the timing information are already part of the output, but we could use
the same format used here (much more readable) and avoid duplicating
them in the message. POC attached.

Just bouncing back my ideas. You probably have very good reasons to be
doing it this way :)

Cheers.

-- 
Andrea Bolognani
Software Engineer - Virtualization Team
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-virsh-Add-timestamps-to-QEMU-monitor-events.patch
Type: text/x-patch
Size: 2478 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20151221/f7a92463/attachment-0001.bin>


More information about the libvir-list mailing list