On 22.06.2015 16:48, Maxim Nestratov wrote:
22.06.2015 16:44, Nikolay Shirokovskiy пишет:
>
> On 22.06.2015 16:00, Mikhail Feoktistov wrote:
>> 22.06.2015 14:22, Maxim Nestratov пишет:
>>> 22.06.2015 14:15, Mikhail Feoktistov пишет:
>>>> We need to handle events with PIE_DISPATCHER type.
>>> Could you please shed some more light on why we need this. I guess it fixes
some problem, so more explanation could be useful.
>> 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.
>>
> This was breaked by my commit c71f5f8cee3fe4078c3ab8aa7c46de7210b468c6
> The only event of issuer type PIE_VIRTUAL_MACHINE is performace event, all
> others events issuer type is PIE_VIRTUAL_MACHINE. I was miguided
> by event names:
> PET_DSP_EVT_VM_PERFSTATS
> PET_DSP_EVT_VM_UNREGISTERED
>
So what are others?
PIE_DISPATCHER
>>>> Do not write error messages to log in case of unhandled event types.
>>> Again, please explain why we shouldn't log them as errors if we return
them as failure.
>> prlsdkHandleVmEvent is a common handler and it recieves many events.
>> We handle only part of them. In case we don't handle event, we return error
code to a caller function,
>> which should make a decision whether to write error message to log.
> This also restores behaviour before named commit.
>>>> ---
>>>> src/parallels/parallels_sdk.c | 4 ++--
>>>> 1 files changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/src/parallels/parallels_sdk.c
b/src/parallels/parallels_sdk.c
>>>> index 34605ea..d208c19 100644
>>>> --- a/src/parallels/parallels_sdk.c
>>>> +++ b/src/parallels/parallels_sdk.c
>>>> @@ -1685,8 +1685,7 @@ prlsdkHandleVmEvent(parallelsConnPtr privconn,
PRL_HANDLE prlEvent)
>>>> return prlsdkHandleVmRemovedEvent(privconn, uuid);
>>>> break;
>>>> default:
>>>> - virReportError(VIR_ERR_INTERNAL_ERROR,
>>>> - _("Can't handle event of type %d"),
prlEventType);
>>>> + VIR_DEBUG("Skipping event type %d",
prlEventType);
>>>> return PRL_ERR_FAILURE;
>>>> }
>>>> @@ -1721,6 +1720,7 @@ prlsdkEventsHandler(PRL_HANDLE prlEvent,
PRL_VOID_PTR opaque)
>>>> switch (prlIssuerType) {
>>>> case PIE_VIRTUAL_MACHINE:
>>>> + case PIE_DISPATCHER:
>>>> pret = prlsdkHandleVmEvent(privconn, prlEvent);
>>>> break;
>>>> default: