mirror of
https://github.com/libvirt/libvirt.git
synced 2026-10-02 12:20:06 -05:00
Introduce job completed event
The VIR_DOMAIN_EVENT_ID_JOB_COMPLETED event will be triggered once a job (such as migration) finishes and it will contain statistics for the job as one would get by calling virDomainGetJobStats. Thanks to this event it is now possible to get statistics of a completed migration of a transient domain on the source host. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
1 parent
a2374edf08
commit
f289300181
10 files changed
+250
-3
No files matched your search
@@ -11975,6 +11975,29 @@ virshEventMigrationIterationPrint(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virshEventPrint(opaque, &buf);
|
||||
}
|
||||
|
||||
static void
|
||||
virshEventJobCompletedPrint(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virDomainPtr dom,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
void *opaque)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
size_t i;
|
||||
char *value;
|
||||
|
||||
virBufferAsprintf(&buf, _("event 'job-completed' for domain %s:\n"),
|
||||
virDomainGetName(dom));
|
||||
for (i = 0; i < nparams; i++) {
|
||||
value = virTypedParameterToString(¶ms[i]);
|
||||
if (value) {
|
||||
virBufferAsprintf(&buf, "\t%s: %s\n", params[i].field, value);
|
||||
VIR_FREE(value);
|
||||
}
|
||||
}
|
||||
virshEventPrint(opaque, &buf);
|
||||
}
|
||||
|
||||
static vshEventCallback vshEventCallbacks[] = {
|
||||
{ "lifecycle",
|
||||
VIR_DOMAIN_EVENT_CALLBACK(virshEventLifecyclePrint), },
|
||||
@@ -12016,6 +12039,8 @@ static vshEventCallback vshEventCallbacks[] = {
|
||||
VIR_DOMAIN_EVENT_CALLBACK(virshEventDeviceAddedPrint), },
|
||||
{ "migration-iteration",
|
||||
VIR_DOMAIN_EVENT_CALLBACK(virshEventMigrationIterationPrint), },
|
||||
{ "job-completed",
|
||||
VIR_DOMAIN_EVENT_CALLBACK(virshEventJobCompletedPrint), },
|
||||
};
|
||||
verify(VIR_DOMAIN_EVENT_ID_LAST == ARRAY_CARDINALITY(vshEventCallbacks));
|
||||
|
||||
|
||||
Reference in new issue
Block a user