[PATCH v14 03/15] conf: Validate virDomainMemoryDef::targetNode

Peter Krempa pkrempa at redhat.com
Wed Jul 27 13:32:36 UTC 2022


On Wed, Jul 27, 2022 at 12:34:49 +0200, Michal Privoznik wrote:
> Almost all of memory models we currently support allow setting
> virDomainMemoryDef::targetNode so that the memory module is
> associated with given guest NUMA node. And we do have a check
> whether the requested node is within bounds, but it's executed
> only when building QEMU's cmd line. Move it into validation
> phase.

The commit message should also point out, that while this commit is
moving the validation to a place that does _not_ validate all the
possible code paths, it's okay, because only the explicit memory device
has user-configurable target node which could break the assumption.

> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/conf/domain_validate.c                    | 13 ++++++
>  src/qemu/qemu_command.c                       |  9 ----
>  .../memory-hotplug-invalid-targetnode.err     |  1 +
>  .../memory-hotplug-invalid-targetnode.xml     | 42 +++++++++++++++++++
>  tests/qemuxml2argvtest.c                      |  1 +
>  5 files changed, 57 insertions(+), 9 deletions(-)
>  create mode 100644 tests/qemuxml2argvdata/memory-hotplug-invalid-targetnode.err
>  create mode 100644 tests/qemuxml2argvdata/memory-hotplug-invalid-targetnode.xml

Reviewed-by: Peter Krempa <pkrempa at redhat.com>


More information about the libvir-list mailing list