mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +00:00
vz: fix SDK event dispatching
Current version of SDK event dispatcing is incorrect. For most VM events (add, delete etc) issuer type is PIE_DISPATCHER. Actually analyzing issuer type doesn't have any benifints so this patch get rid of it. All dispatching is done only on event type. Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
This commit is contained in:
parent
2c05841246
commit
2854079496
@ -1697,21 +1697,33 @@ prlsdkHandlePerfEvent(vzConnPtr privconn,
|
|||||||
return PRL_ERR_SUCCESS;
|
return PRL_ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static PRL_RESULT
|
||||||
prlsdkHandleVmEvent(vzConnPtr privconn, PRL_HANDLE prlEvent)
|
prlsdkEventsHandler(PRL_HANDLE prlEvent, PRL_VOID_PTR opaque)
|
||||||
{
|
{
|
||||||
|
vzConnPtr privconn = opaque;
|
||||||
PRL_RESULT pret = PRL_ERR_FAILURE;
|
PRL_RESULT pret = PRL_ERR_FAILURE;
|
||||||
|
PRL_HANDLE_TYPE handleType;
|
||||||
char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
|
char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
|
||||||
unsigned char uuid[VIR_UUID_BUFLEN];
|
unsigned char uuid[VIR_UUID_BUFLEN];
|
||||||
PRL_UINT32 bufsize = ARRAY_CARDINALITY(uuidstr);
|
PRL_UINT32 bufsize = ARRAY_CARDINALITY(uuidstr);
|
||||||
PRL_EVENT_TYPE prlEventType;
|
PRL_EVENT_TYPE prlEventType;
|
||||||
|
|
||||||
pret = PrlEvent_GetType(prlEvent, &prlEventType);
|
pret = PrlHandle_GetType(prlEvent, &handleType);
|
||||||
prlsdkCheckRetGoto(pret, cleanup);
|
prlsdkCheckRetGoto(pret, cleanup);
|
||||||
|
|
||||||
|
/* Currently, there is no need to handle anything but events */
|
||||||
|
if (handleType != PHT_EVENT)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (privconn == NULL)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
pret = PrlEvent_GetIssuerId(prlEvent, uuidstr, &bufsize);
|
pret = PrlEvent_GetIssuerId(prlEvent, uuidstr, &bufsize);
|
||||||
prlsdkCheckRetGoto(pret, cleanup);
|
prlsdkCheckRetGoto(pret, cleanup);
|
||||||
|
|
||||||
|
pret = PrlEvent_GetType(prlEvent, &prlEventType);
|
||||||
|
prlsdkCheckRetGoto(pret, cleanup);
|
||||||
|
|
||||||
if (prlsdkUUIDParse(uuidstr, uuid) < 0)
|
if (prlsdkUUIDParse(uuidstr, uuid) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -1736,44 +1748,7 @@ prlsdkHandleVmEvent(vzConnPtr privconn, PRL_HANDLE prlEvent)
|
|||||||
prlEvent = PRL_INVALID_HANDLE;
|
prlEvent = PRL_INVALID_HANDLE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
VIR_DEBUG("Skipping event of type %d", prlEventType);
|
||||||
_("Can't handle event of type %d"), prlEventType);
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
PrlHandle_Free(prlEvent);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PRL_RESULT
|
|
||||||
prlsdkEventsHandler(PRL_HANDLE prlEvent, PRL_VOID_PTR opaque)
|
|
||||||
{
|
|
||||||
vzConnPtr privconn = opaque;
|
|
||||||
PRL_RESULT pret = PRL_ERR_FAILURE;
|
|
||||||
PRL_HANDLE_TYPE handleType;
|
|
||||||
PRL_EVENT_ISSUER_TYPE prlIssuerType = PIE_UNKNOWN;
|
|
||||||
|
|
||||||
pret = PrlHandle_GetType(prlEvent, &handleType);
|
|
||||||
prlsdkCheckRetGoto(pret, cleanup);
|
|
||||||
|
|
||||||
/* Currently, there is no need to handle anything but events */
|
|
||||||
if (handleType != PHT_EVENT)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (privconn == NULL)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
PrlEvent_GetIssuerType(prlEvent, &prlIssuerType);
|
|
||||||
prlsdkCheckRetGoto(pret, cleanup);
|
|
||||||
|
|
||||||
switch (prlIssuerType) {
|
|
||||||
case PIE_VIRTUAL_MACHINE:
|
|
||||||
prlsdkHandleVmEvent(privconn, prlEvent);
|
|
||||||
/* above function takes own of event */
|
|
||||||
prlEvent = PRL_INVALID_HANDLE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
VIR_DEBUG("Skipping event of issuer type %d", prlIssuerType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -1781,7 +1756,6 @@ prlsdkEventsHandler(PRL_HANDLE prlEvent, PRL_VOID_PTR opaque)
|
|||||||
return PRL_ERR_SUCCESS;
|
return PRL_ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int prlsdkSubscribeToPCSEvents(vzConnPtr privconn)
|
int prlsdkSubscribeToPCSEvents(vzConnPtr privconn)
|
||||||
{
|
{
|
||||||
PRL_RESULT pret = PRL_ERR_UNINITIALIZED;
|
PRL_RESULT pret = PRL_ERR_UNINITIALIZED;
|
||||||
|
Loading…
Reference in New Issue
Block a user