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

Luyao Huang lhuang at redhat.com
Wed Mar 25 06:34:04 UTC 2015


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

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),
-- 
1.8.3.1




More information about the libvir-list mailing list