[PATCH v2 22/27] qemu: Wire up <memory/> live update

Peter Krempa pkrempa at redhat.com
Fri Dec 4 12:27:58 UTC 2020


On Thu, Dec 03, 2020 at 13:36:25 +0100, Michal Privoznik wrote:
> As advertised in the previous commit, we want' to be able to
> change 'requested-size' attribute of virtio-mem on the fly. This
> commit does exactly that. Changing anything else is checked for
> and forbidden.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/conf/domain_conf.c       |  23 +++++
>  src/conf/domain_conf.h       |   3 +
>  src/libvirt_private.syms     |   1 +
>  src/qemu/qemu_driver.c       | 165 ++++++++++++++++++++++++++++++++++-
>  src/qemu/qemu_hotplug.c      |  18 ++++
>  src/qemu/qemu_hotplug.h      |   5 ++
>  src/qemu/qemu_monitor.c      |  13 +++
>  src/qemu/qemu_monitor.h      |   4 +
>  src/qemu/qemu_monitor_json.c |  15 ++++
>  src/qemu/qemu_monitor_json.h |   5 ++
>  10 files changed, 251 insertions(+), 1 deletion(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 0551f6f266..a4293f1749 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -18762,6 +18762,29 @@ virDomainMemoryFindInactiveByDef(virDomainDefPtr def,
>  }
>  
>  
> +ssize_t
> +virDomainMemoryFindByDeviceInfo(virDomainDefPtr def,
> +                                virDomainDeviceInfoPtr info)
> +{
> +    size_t i;
> +
> +    for (i = 0; i < def->nmems; i++) {
> +        virDomainMemoryDefPtr tmp = def->mems[i];
> +
> +        if (!virDomainDeviceInfoAddressIsEqual(&tmp->info, info))
> +            continue;
> +
> +        /* alias, if present */
> +        if (STRNEQ_NULLABLE(tmp->info.alias, info->alias))

This doesn't work as the comment expects it to:

STRNEQ_NULLABLE(NULL, NULL) == false
STRNEQ_NULLABLE("blah", NULL) == true
STRNEQ_NULLABLE(NULL, "blah") == true
STRNEQ_NULLABLE("blah", "blah") == false

Since info->alias is always set, it would not skip the condition if the
definition used for lookup didn't specify it.

> +            continue;
> +
> +        return i;
> +    }
> +
> +    return -1;
> +}
> +
> +
>  /**
>   * virDomainMemoryInsert:
>   *

[...]




More information about the libvir-list mailing list