qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 06/12] qmp: Expose qemu_announce_self as a qmp c


From: Vlad Yasevich
Subject: Re: [Qemu-devel] [PATCH 06/12] qmp: Expose qemu_announce_self as a qmp command
Date: Tue, 30 May 2017 10:43:13 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 05/30/2017 10:24 AM, Juan Quintela wrote:
> Vlad Yasevich <address@hidden> wrote:
>> On 05/30/2017 06:11 AM, Juan Quintela wrote:
>>> Vladislav Yasevich <address@hidden> wrote:
>>>> Add a qmp command that can trigger guest announcements.
>>>>
>>>> Based on work of Germano Veit Michel <address@hidden>
>>>>
>>>> Signed-off-by: Vladislav Yasevich <address@hidden>
>>>> ---
>>>>  migration/savevm.c | 14 ++++++++++++++
>>>>  qapi-schema.json   | 19 +++++++++++++++++++
>>>>  2 files changed, 33 insertions(+)
>>>>
>>>> diff --git a/migration/savevm.c b/migration/savevm.c
>>>> index a4097c9..b55ce6a 100644
>>>> --- a/migration/savevm.c
>>>> +++ b/migration/savevm.c
>>>> @@ -265,6 +265,20 @@ void qemu_announce_self(AnnounceParameters *params)
>>>>      qemu_announce_self_once(timer);
>>>>  }
>>>>  
>>>> +void qmp_announce_self(bool has_params, AnnounceParameters *params,
>>>> +                       Error **errp)
>>>> +{
>>>> +    AnnounceParameters announce_params;
>>>> +
>>>> +    memcpy(&announce_params, qemu_get_announce_params(),
>>>> +           sizeof(announce_params));
>>>> +
>>>> +    if (has_params)
>>>> +        qemu_set_announce_parameters(&announce_params, params);
>>>> +
>>>> +    qemu_announce_self(&announce_params);
>>>
>>> Are I missreading qemu_annouce_self()?
>>> My reading is that it passes announce_params to a timer (i.e. async
>>> function), but here announce_params is a local variable here, no?
>>>
>>
>> The AnnounceTimer holds a copy since each timer may have it's own values.
> 
> 
> 
>> AnnounceTimer *qemu_announce_timer_new(AnnounceParameters *params,
>>                                        QEMUClockType type)
>> {
>>    AnnounceTimer *timer = g_new(AnnounceTimer, 1);
>>
>>    timer->params = *params;
> 
> I have to remomember that C has learn how to copy structures long ago.
> 
> <repeat myself one hundred times>
> 
> I was missing the "*" on my previous reading, sorry for the noise.

that actually changed, since as Eric Pointed out, shallow copies shouldn't
be used.  In the v2 code, this uses qemu_set_announce_paramters(), but the copy
essentially remains.

-vlad
> 
>>    timer->round = params->rounds;
>>    timer->type = type;
>>
>>    return timer;
>> }
> 
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]