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