[libvirt] [RFC PATCH 06/12] qemu: memdev: Add infrastructure to load memory device information

Ján Tomko jtomko at redhat.com
Tue Feb 3 16:56:03 UTC 2015


On Fri, Jan 30, 2015 at 02:21:03PM +0100, Peter Krempa wrote:
> When using 'acpi-dimm' memory devices with qemu, some of the information
> like the slot number and base address need to be reloaded from qemu
> after process start so that it reflects the actual state. The state then
> allows to use memory devices across migrations.
> ---
>  src/qemu/qemu_domain.c       |  43 ++++++++++++++++
>  src/qemu/qemu_domain.h       |   4 ++
>  src/qemu/qemu_monitor.c      |  45 +++++++++++++++++
>  src/qemu/qemu_monitor.h      |  14 ++++++
>  src/qemu/qemu_monitor_json.c | 116 +++++++++++++++++++++++++++++++++++++++++++
>  src/qemu/qemu_monitor_json.h |   5 ++
>  src/qemu/qemu_process.c      |   4 ++
>  7 files changed, 231 insertions(+)
> 

> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index da5c14d..333a69a 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -6569,3 +6569,119 @@ qemuMonitorJSONGetIOThreads(qemuMonitorPtr mon,
>      virJSONValueFree(reply);
>      return ret;
>  }
> +
> +
> +int
> +qemuMonitorJSONGetMemoryDeviceInfo(qemuMonitorPtr mon,
> +                                   virHashTablePtr info)
> +{
> +    int ret = -1;
> +    virJSONValuePtr cmd;
> +    virJSONValuePtr reply = NULL;
> +    virJSONValuePtr data = NULL;
> +    qemuMonitorMemoryDeviceInfoPtr meminfo = NULL;
> +    ssize_t n;
> +    size_t i;
> +
> +    if (!(cmd = qemuMonitorJSONMakeCommand("query-memory-devices", NULL)))
> +        return -1;
> +
> +    ret = qemuMonitorJSONCommand(mon, cmd, &reply);
> +
> +    if (ret == 0)
> +        ret = qemuMonitorJSONCheckError(cmd, reply);

Missing check for a missing command.

> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index b0f7b1c..ba7c8e2 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -4871,6 +4871,10 @@ int qemuProcessStart(virConnectPtr conn,
>      if (qemuDomainUpdateDeviceList(driver, vm, asyncJob) < 0)
>          goto cleanup;
> 
> +    VIR_DEBUG("Updating info of memory devices");
> +    if (qemuDomainUpdateMemoryDeviceInfo(driver, vm, asyncJob) < 0)
> +        goto cleanup;

Return value of -2 should not be fatal.

Jan

> +
>      /* Technically, qemuProcessStart can be called from inside
>       * QEMU_ASYNC_JOB_MIGRATION_IN, but we are okay treating this like
>       * a sync job since no other job can call into the domain until
> -- 
> 2.2.2
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150203/690cfa15/attachment-0001.sig>


More information about the libvir-list mailing list