[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: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 06/12] qmp: Expose qemu_announce_self as a qmp command |
Date: |
Fri, 26 May 2017 08:16:06 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 |
On 05/24/2017 01:05 PM, Vladislav Yasevich 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(+)
>
> +void qmp_announce_self(bool has_params, AnnounceParameters *params,
> + Error **errp)
> +{
> + AnnounceParameters announce_params;
> +
> + memcpy(&announce_params, qemu_get_announce_params(),
> + sizeof(announce_params));
Shallow copies of a QAPI type happen to work when the type is all scalar
(as AnnounceParameters currently is), but it's more robust to use
QAPI_CLONE() or QAPI_CLONE_MEMBERS() so that any future non-scalar
additions to the parameters type will be correctly copied without
introducing memory leaks or double frees.
Even this might be better:
AnnounceParameters announce_params = { 0 };
qemu_set_announce_parameters(&announce_params, qemu_get_announce_params());
> +
> + if (has_params)
> + qemu_set_announce_parameters(&announce_params, params);
> +
> + qemu_announce_self(&announce_params);
> +}
The QMP changes look okay. Do you have a testsuite covering the new QMP
command somewhere in the series?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
[Qemu-devel] [PATCH 07/12] migration: Allow for a limited number of announce timers, Vladislav Yasevich, 2017/05/24