
On 23.06.2015 13:26, Mikhail Feoktistov wrote:
If the configuration of the instance has been modified, for example added disk or network device, then hypervisor sends event with prlIssuerType = PIE_DISPATCHER and EventType = PET_DSP_EVT_VM_CONFIG_CHANGED We should handle this event in prlsdkHandleVmEvent function to update instance's XML config. prlsdkHandleVmEvent is a common handler and it recieves many events. We don't need to handle all of them. Remove error message in case of unhandled events. --- src/vz/vz_sdk.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index 98f7a57..d4d48e8 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -1736,8 +1736,7 @@ prlsdkHandleVmEvent(vzConnPtr privconn, PRL_HANDLE prlEvent) prlEvent = PRL_INVALID_HANDLE; break; default: - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Can't handle event of type %d"), prlEventType); + VIR_DEBUG("Skipping event type %d", prlEventType); }
cleanup: @@ -1768,6 +1767,7 @@ prlsdkEventsHandler(PRL_HANDLE prlEvent, PRL_VOID_PTR opaque)
switch (prlIssuerType) { case PIE_VIRTUAL_MACHINE: + case PIE_DISPATCHER: prlsdkHandleVmEvent(privconn, prlEvent); // above function takes own of event prlEvent = PRL_INVALID_HANDLE;
So as switch on issuer_type doesn't solve event discrimitation task probably it would be better just to move to previous scheme. Previous scheme has 2 very similar switches in prlsdkHandleVmEvent and prlsdkEventsHandler and now I understand why. 1. SDK hides 3 types behind PHT_EVENT handles. 1. IOEvent 2. IOEventPackage 3. VMEvent and only VMEvent has PrlEvent_GetIssuerId method, other types responds PRL_UNIMPLEMENTED. Next we need an issuer_id for all events of interest but we don't know if is safe to call PrlEvent_GetIssuerId as we have no means to discriminate IOEvent and VMEvent. So we discriminate by checking the result of PrlEvent_GetType instead. Thus the only purpose of first switch is to call PrlEvent_GetIssuerId safely. The better approach will probably be to ask for PrlEvent_GetIssuerId always and don't treat PRL_UNIMPLEMENTED as error. This way we can get rid of the first switch.