[PATCH v2 10/13] qemu: Refresh the actual size of virtio-mem on monitor reconnect
Peter Krempa
pkrempa at redhat.com
Thu Feb 18 16:17:08 UTC 2021
On Thu, Feb 18, 2021 at 14:31:05 +0100, Michal Privoznik wrote:
> If the QEMU driver restarts it loses the track of the actual size
> of virtio-mem (because it's runtime type of information and thus
> not stored in XML) and therefore, we have to refresh it when
> reconnecting to the domain monitor.
>
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
> src/qemu/qemu_domain.c | 37 ++++++++++++++++++++----
> src/qemu/qemu_monitor.h | 3 ++
> src/qemu/qemu_monitor_json.c | 56 ++++++++++++++++++++++--------------
> src/qemu/qemu_process.c | 3 ++
> 4 files changed, 72 insertions(+), 27 deletions(-)
[...]
> int qemuMonitorGetMemoryDeviceInfo(qemuMonitorPtr mon,
> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index 9ce7ba52ba..09e898442d 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -8238,7 +8238,6 @@ qemuMonitorJSONGetMemoryDeviceInfo(qemuMonitorPtr mon,
> virJSONValuePtr cmd;
> virJSONValuePtr reply = NULL;
> virJSONValuePtr data = NULL;
> - qemuMonitorMemoryDeviceInfoPtr meminfo = NULL;
> size_t i;
>
> if (!(cmd = qemuMonitorJSONMakeCommand("query-memory-devices", NULL)))
> @@ -8259,6 +8258,9 @@ qemuMonitorJSONGetMemoryDeviceInfo(qemuMonitorPtr mon,
>
> for (i = 0; i < virJSONValueArraySize(data); i++) {
> virJSONValuePtr elem = virJSONValueArrayGet(data, i);
> + g_autofree qemuMonitorMemoryDeviceInfoPtr meminfo = NULL;
> + virJSONValuePtr dimminfo;
> + const char *devalias;
> const char *type;
../../../libvirt/src/qemu/qemu_monitor_json.c:8335:13: error: ‘devalias’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
8335 | if (virHashAddEntry(info, devalias, meminfo) < 0)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
More information about the libvir-list
mailing list