提交 b50b4ef3 编写于 作者: P Peter Krempa

qemu: command: Switch to bytes when formatting size for memory backends

QEMU's command line visitor as well as the JSON interface take bytes by
default for memory object sizes. Convert mebibytes to bytes so that we
can later refactor the existing code for hotplug purposes.
上级 a47174c5
......@@ -4650,7 +4650,7 @@ qemuBuildMemoryBackendStr(unsigned long long size,
virBufferAsprintf(&buf, "memory-backend-ram,id=%s%zu", aliasPrefix, id);
}
virBufferAsprintf(&buf, ",size=%lluM", size / 1024);
virBufferAsprintf(&buf, ",size=%llu", size * 1024);
if (userNodeset) {
if (!(nodemask = virBitmapFormat(userNodeset)))
......
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,id=ram-node0,prealloc=yes,\
mem-path=/dev/hugepages1G/libvirt/qemu,size=1024M,host-nodes=0-3,policy=bind \
mem-path=/dev/hugepages1G/libvirt/qemu,size=1073741824,host-nodes=0-3,\
policy=bind \
-numa node,nodeid=0,cpus=0,memdev=ram-node0 \
-object memory-backend-file,id=ram-node1,prealloc=yes,\
mem-path=/dev/hugepages2M/libvirt/qemu,size=1024M,host-nodes=0-3,policy=bind \
mem-path=/dev/hugepages2M/libvirt/qemu,size=1073741824,host-nodes=0-3,\
policy=bind \
-numa node,nodeid=1,cpus=1,memdev=ram-node1 \
-object memory-backend-file,id=ram-node2,prealloc=yes,\
mem-path=/dev/hugepages1G/libvirt/qemu,size=1024M,host-nodes=0-3,policy=bind \
mem-path=/dev/hugepages1G/libvirt/qemu,size=1073741824,host-nodes=0-3,\
policy=bind \
-numa node,nodeid=2,cpus=2,memdev=ram-node2 \
-object memory-backend-file,id=ram-node3,prealloc=yes,\
mem-path=/dev/hugepages1G/libvirt/qemu,size=1024M,host-nodes=3,policy=bind \
mem-path=/dev/hugepages1G/libvirt/qemu,size=1073741824,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
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,id=ram-node0,prealloc=yes,\
mem-path=/dev/hugepages2M/libvirt/qemu,size=256M \
mem-path=/dev/hugepages2M/libvirt/qemu,size=268435456 \
-numa node,nodeid=0,cpus=0,memdev=ram-node0 \
-object memory-backend-file,id=ram-node1,prealloc=yes,\
mem-path=/dev/hugepages2M/libvirt/qemu,size=768M \
mem-path=/dev/hugepages2M/libvirt/qemu,size=805306368 \
-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
......@@ -2,7 +2,7 @@ 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,id=ram-node1,prealloc=yes,\
mem-path=/dev/hugepages1G/libvirt/qemu,size=768M \
mem-path=/dev/hugepages1G/libvirt/qemu,size=805306368 \
-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
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,id=ram-node0,prealloc=yes,\
mem-path=/dev/hugepages1G/libvirt/qemu,size=1024M,host-nodes=0-3,policy=bind \
mem-path=/dev/hugepages1G/libvirt/qemu,size=1073741824,host-nodes=0-3,\
policy=bind \
-numa node,nodeid=0,cpus=0,memdev=ram-node0 \
-object memory-backend-file,id=ram-node1,prealloc=yes,\
mem-path=/dev/hugepages2M/libvirt/qemu,share=yes,size=1024M,host-nodes=0-3,\
policy=bind \
mem-path=/dev/hugepages2M/libvirt/qemu,share=yes,size=1073741824,\
host-nodes=0-3,policy=bind \
-numa node,nodeid=1,cpus=1,memdev=ram-node1 \
-object memory-backend-file,id=ram-node2,prealloc=yes,\
mem-path=/dev/hugepages1G/libvirt/qemu,share=no,size=1024M,host-nodes=0-3,\
policy=bind \
mem-path=/dev/hugepages1G/libvirt/qemu,share=no,size=1073741824,\
host-nodes=0-3,policy=bind \
-numa node,nodeid=2,cpus=2,memdev=ram-node2 \
-object memory-backend-file,id=ram-node3,prealloc=yes,\
mem-path=/dev/hugepages1G/libvirt/qemu,size=1024M,host-nodes=3,policy=bind \
mem-path=/dev/hugepages1G/libvirt/qemu,size=1073741824,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
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,id=ram-node0,size=32M,host-nodes=3,policy=preferred \
-object memory-backend-ram,id=ram-node0,size=33554432,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 \
......
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,id=ram-node0,size=20M,host-nodes=3,policy=preferred \
-object memory-backend-ram,id=ram-node0,size=20971520,host-nodes=3,\
policy=preferred \
-numa node,nodeid=0,cpus=0,memdev=ram-node0 \
-object memory-backend-ram,id=ram-node1,size=645M,host-nodes=0-7,policy=bind \
-object memory-backend-ram,id=ram-node1,size=676331520,host-nodes=0-7,\
policy=bind \
-numa node,nodeid=1,cpus=1-27,cpus=29,memdev=ram-node1 \
-object memory-backend-ram,id=ram-node2,size=23440M,\
-object memory-backend-ram,id=ram-node2,size=24578621440,\
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 \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册