[libvirt] [PATCH] qemu: add a check for node set when build memory device cmd

Peter Krempa pkrempa at redhat.com
Wed Mar 25 09:09:45 UTC 2015


On Wed, Mar 25, 2015 at 14:34:04 +0800, Luyao Huang wrote:
> When we set a host not exist nodemask in memory device and then
> start the vm, qemu will report error.
> 
>  # virsh start test3
>  error: Failed to start domain test3
>  error: internal error: process exited while connecting to monitor:
>  2015-03-25T01:12:17.205913Z qemu-kvm: -object memory-backend-ram,id=memdimm0
>  ,size=536870912,host-nodes=1-3,policy=bind: cannot bind memory to host NUMA nodes:
>  Invalid argument
> 
> We have some function to check this, and add a check when build
> memory cmd line will report error more early and clearly. And the
> check will be done when we start a vm have memory device and hotplug
> a memory device. The error will be:
> 
>  # virsh start test3
>  error: Failed to start domain test3
>  error: internal error: NUMA node 1 is unavailable

The error message is not ideal. I'll tweak the error code in
virNumaNodesetIsAvailable() to VIR_ERR_CONFIG_UNSUPPORTED.

> 
> Signed-off-by: Luyao Huang <lhuang at redhat.com>
> ---
>  src/qemu/qemu_command.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 99a19d6..04c8df7 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -4757,6 +4757,8 @@ qemuBuildMemoryBackendStr(unsigned long long size,
>      }
>  
>      if (nodemask) {
> +        if (!virNumaNodesetIsAvailable(nodemask))
> +            goto cleanup;
>          if (virJSONValueObjectAdd(props,
>                                    "m:host-nodes", nodemask,
>                                    "S:policy", qemuNumaPolicyTypeToString(mode),

ACK. I'll tweak the commit message though.

Peter
-------------- 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/20150325/6033c5a2/attachment-0001.sig>


More information about the libvir-list mailing list