Move the alias as the second formated argument and tweak the tests so that a future refactor that will change the order doesn't break tests. --- src/qemu/qemu_command.c | 9 ++++----- .../qemuxml2argvdata/qemuxml2argv-hugepages-pages.args | 16 ++++++++-------- .../qemuxml2argv-hugepages-pages2.args | 8 ++++---- .../qemuxml2argv-hugepages-pages3.args | 4 ++-- .../qemuxml2argv-hugepages-shared.args | 18 ++++++++++-------- .../qemuxml2argv-numatune-memnode-no-memory.args | 2 +- .../qemuxml2argv-numatune-memnode.args | 6 +++--- 7 files changed, 32 insertions(+), 31 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c65f187..2d89c2d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4623,8 +4623,8 @@ qemuBuildMemoryBackendStr(unsigned long long size, if (!(mem_path = qemuGetHugepagePath(&cfg->hugetlbfs[i]))) goto cleanup; - virBufferAsprintf(&buf, "memory-backend-file,prealloc=yes,mem-path=%s", - mem_path); + virBufferAsprintf(&buf, "memory-backend-file,id=%s%zu", aliasPrefix, id); + virBufferAsprintf(&buf, ",prealloc=yes,mem-path=%s", mem_path); switch (memAccess) { case VIR_MEM_ACCESS_SHARED: @@ -4647,11 +4647,10 @@ qemuBuildMemoryBackendStr(unsigned long long size, goto cleanup; } - virBufferAddLit(&buf, "memory-backend-ram"); + virBufferAsprintf(&buf, "memory-backend-ram,id=%s%zu", aliasPrefix, id); } - virBufferAsprintf(&buf, ",size=%lluM,id=%s%zu", size / 1024, - aliasPrefix, id); + virBufferAsprintf(&buf, ",size=%lluM", size / 1024); if (userNodeset) { if (!(nodemask = virBitmapFormat(userNodeset))) diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages.args b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages.args index 042683a..b954fbc 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages.args @@ -1,16 +1,16 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ /usr/bin/qemu -S -M pc -m 4096 -smp 4 \ --object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages1G/libvirt/qemu,\ -size=1024M,id=ram-node0,host-nodes=0-3,policy=bind \ +-object memory-backend-file,id=ram-node0,prealloc=yes,\ +mem-path=/dev/hugepages1G/libvirt/qemu,size=1024M,host-nodes=0-3,policy=bind \ -numa node,nodeid=0,cpus=0,memdev=ram-node0 \ --object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages2M/libvirt/qemu,\ -size=1024M,id=ram-node1,host-nodes=0-3,policy=bind \ +-object memory-backend-file,id=ram-node1,prealloc=yes,\ +mem-path=/dev/hugepages2M/libvirt/qemu,size=1024M,host-nodes=0-3,policy=bind \ -numa node,nodeid=1,cpus=1,memdev=ram-node1 \ --object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages1G/libvirt/qemu,\ -size=1024M,id=ram-node2,host-nodes=0-3,policy=bind \ +-object memory-backend-file,id=ram-node2,prealloc=yes,\ +mem-path=/dev/hugepages1G/libvirt/qemu,size=1024M,host-nodes=0-3,policy=bind \ -numa node,nodeid=2,cpus=2,memdev=ram-node2 \ --object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages1G/libvirt/qemu,\ -size=1024M,id=ram-node3,host-nodes=3,policy=bind \ +-object memory-backend-file,id=ram-node3,prealloc=yes,\ +mem-path=/dev/hugepages1G/libvirt/qemu,size=1024M,host-nodes=3,policy=bind \ -numa node,nodeid=3,cpus=3,memdev=ram-node3 \ -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages2.args b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages2.args index 9211bc6..90ab776 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages2.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages2.args @@ -1,10 +1,10 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ /usr/bin/qemu -S -M pc -m 1024 -smp 2 \ --object memory-backend-file,prealloc=yes,\ -mem-path=/dev/hugepages2M/libvirt/qemu,size=256M,id=ram-node0 \ +-object memory-backend-file,id=ram-node0,prealloc=yes,\ +mem-path=/dev/hugepages2M/libvirt/qemu,size=256M \ -numa node,nodeid=0,cpus=0,memdev=ram-node0 \ --object memory-backend-file,prealloc=yes,\ -mem-path=/dev/hugepages2M/libvirt/qemu,size=768M,id=ram-node1 \ +-object memory-backend-file,id=ram-node1,prealloc=yes,\ +mem-path=/dev/hugepages2M/libvirt/qemu,size=768M \ -numa node,nodeid=1,cpus=1,memdev=ram-node1 \ -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ -usb -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages3.args b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages3.args index f81947e..b932520 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages3.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages3.args @@ -1,8 +1,8 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ /usr/bin/qemu -S -M pc -m 1024 -smp 2 \ -numa node,nodeid=0,cpus=0,mem=256 \ --object memory-backend-file,prealloc=yes,\ -mem-path=/dev/hugepages1G/libvirt/qemu,size=768M,id=ram-node1 \ +-object memory-backend-file,id=ram-node1,prealloc=yes,\ +mem-path=/dev/hugepages1G/libvirt/qemu,size=768M \ -numa node,nodeid=1,cpus=1,memdev=ram-node1 \ -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-shared.args b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-shared.args index a7c7d92..b51de1b 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-shared.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-shared.args @@ -1,16 +1,18 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ /usr/bin/qemu -S -M pc -m 4096 -smp 4 \ --object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages1G/libvirt/qemu,\ -size=1024M,id=ram-node0,host-nodes=0-3,policy=bind \ +-object memory-backend-file,id=ram-node0,prealloc=yes,\ +mem-path=/dev/hugepages1G/libvirt/qemu,size=1024M,host-nodes=0-3,policy=bind \ -numa node,nodeid=0,cpus=0,memdev=ram-node0 \ --object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages2M/libvirt/qemu,\ -share=on,size=1024M,id=ram-node1,host-nodes=0-3,policy=bind \ +-object memory-backend-file,id=ram-node1,prealloc=yes,\ +mem-path=/dev/hugepages2M/libvirt/qemu,share=on,size=1024M,host-nodes=0-3,\ +policy=bind \ -numa node,nodeid=1,cpus=1,memdev=ram-node1 \ --object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages1G/libvirt/qemu,\ -share=off,size=1024M,id=ram-node2,host-nodes=0-3,policy=bind \ +-object memory-backend-file,id=ram-node2,prealloc=yes,\ +mem-path=/dev/hugepages1G/libvirt/qemu,share=off,size=1024M,host-nodes=0-3,\ +policy=bind \ -numa node,nodeid=2,cpus=2,memdev=ram-node2 \ --object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages1G/libvirt/qemu,\ -size=1024M,id=ram-node3,host-nodes=3,policy=bind \ +-object memory-backend-file,id=ram-node3,prealloc=yes,\ +mem-path=/dev/hugepages1G/libvirt/qemu,size=1024M,host-nodes=3,policy=bind \ -numa node,nodeid=3,cpus=3,memdev=ram-node3 \ -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-no-memory.args b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-no-memory.args index 2addf97..4f1f2aa 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-no-memory.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-no-memory.args @@ -1,6 +1,6 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ /usr/bin/kvm -S -M pc -m 64 -smp 2 \ --object memory-backend-ram,size=32M,id=ram-node0,host-nodes=3,policy=preferred \ +-object memory-backend-ram,id=ram-node0,size=32M,host-nodes=3,policy=preferred \ -numa node,nodeid=0,cpus=0,memdev=ram-node0 \ -numa node,nodeid=1,cpus=1,mem=32 \ -nographic -monitor unix:/tmp/test-monitor,server,nowait \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.args b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.args index e4beb98..18007d5 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.args @@ -1,10 +1,10 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ /usr/bin/kvm -S -M pc -m 24104 -smp 32 \ --object memory-backend-ram,size=20M,id=ram-node0,host-nodes=3,policy=preferred \ +-object memory-backend-ram,id=ram-node0,size=20M,host-nodes=3,policy=preferred \ -numa node,nodeid=0,cpus=0,memdev=ram-node0 \ --object memory-backend-ram,size=645M,id=ram-node1,host-nodes=0-7,policy=bind \ +-object memory-backend-ram,id=ram-node1,size=645M,host-nodes=0-7,policy=bind \ -numa node,nodeid=1,cpus=1-27,cpus=29,memdev=ram-node1 \ --object memory-backend-ram,size=23440M,id=ram-node2,\ +-object memory-backend-ram,id=ram-node2,size=23440M,\ host-nodes=1-2,host-nodes=5,host-nodes=7,policy=bind \ -numa node,nodeid=2,cpus=28,cpus=30-31,memdev=ram-node2 \ -nographic -monitor unix:/tmp/test-monitor,server,nowait \ -- 2.2.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list