Skip to content

Commit

Permalink
event-test: Add VIR_DOMAIN_EVENT_ID_JOB_COMPLETED
Browse files Browse the repository at this point in the history
  • Loading branch information
pipo committed Apr 18, 2016
1 parent bb25001 commit 9e9a5cf
Showing 1 changed file with 34 additions and 11 deletions.
45 changes: 34 additions & 11 deletions examples/object-events/event-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,19 +624,12 @@ myNetworkEventCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
return 0;
}


static int
myDomainEventTunableCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainPtr dom,
virTypedParameterPtr params,
int nparams,
void *opaque ATTRIBUTE_UNUSED)
static void
eventTypedParamsPrint(virTypedParameterPtr params,
int nparams)
{
size_t i;

printf("%s EVENT: Domain %s(%d) tunable updated:\n",
__func__, virDomainGetName(dom), virDomainGetID(dom));

for (i = 0; i < nparams; i++) {
switch (params[i].type) {
case VIR_TYPED_PARAM_INT:
Expand Down Expand Up @@ -666,6 +659,20 @@ myDomainEventTunableCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
printf("\t%s: unknown type\n", params[i].field);
}
}
}


static int
myDomainEventTunableCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainPtr dom,
virTypedParameterPtr params,
int nparams,
void *opaque ATTRIBUTE_UNUSED)
{
printf("%s EVENT: Domain %s(%d) tunable updated:\n",
__func__, virDomainGetName(dom), virDomainGetID(dom));

eventTypedParamsPrint(params, nparams);

return 0;
}
Expand Down Expand Up @@ -778,6 +785,22 @@ myDomainEventMigrationIterationCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
}


static int
myDomainEventJobCompletedCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainPtr dom,
virTypedParameterPtr params,
int nparams,
void *opaque ATTRIBUTE_UNUSED)
{
printf("%s EVENT: Domain %s(%d) job completed:\n",
__func__, virDomainGetName(dom), virDomainGetID(dom));

eventTypedParamsPrint(params, nparams);

return 0;
}


static void
myFreeFunc(void *opaque)
{
Expand Down Expand Up @@ -828,7 +851,7 @@ struct domainEventData domainEvents[] = {
DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE, myDomainEventAgentLifecycleCallback),
DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_DEVICE_ADDED, myDomainEventDeviceAddedCallback),
DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION, myDomainEventMigrationIterationCallback),
/* VIR_DOMAIN_EVENT_ID_JOB_COMPLETED */
DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_JOB_COMPLETED, myDomainEventJobCompletedCallback),
/* VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED */
};

Expand Down

0 comments on commit 9e9a5cf

Please sign in to comment.