[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: |
Juan Quintela |
Subject: |
Re: [Qemu-devel] [PATCH 06/12] qmp: Expose qemu_announce_self as a qmp command |
Date: |
Tue, 30 May 2017 16:24:45 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
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.
> timer->round = params->rounds;
> timer->type = type;
>
> return timer;
>}
[Qemu-devel] [PATCH 07/12] migration: Allow for a limited number of announce timers, Vladislav Yasevich, 2017/05/24
[Qemu-devel] [PATCH 08/12] announce_timer: Add ability to reset an existing, Vladislav Yasevich, 2017/05/24