xml: <devices> <memballoon model='virtio' deflate-on-oom='on'/> </devices> qemu: qemu -device virtio-balloon-pci,...,deflate-on-oom=on --- src/qemu/qemu_command.c | 4 ++++ .../qemuxml2argv-balloon-device-deflate-off.args | 23 ++++++++++++++++++++ .../qemuxml2argv-balloon-device-deflate-off.xml | 25 ++++++++++++++++++++++ .../qemuxml2argv-balloon-device-deflate.args | 23 ++++++++++++++++++++ .../qemuxml2argv-balloon-device-deflate.xml | 25 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 4 ++++ 6 files changed, 104 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-balloon-device-deflate-off.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-balloon-device-deflate-off.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-balloon-device-deflate.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-balloon-device-deflate.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d2f37e4..227ba8a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5708,6 +5708,10 @@ qemuBuildMemballoonDevStr(virDomainDefPtr def, if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0) goto error; + if (dev->deflate > 0) + virBufferAsprintf(&buf, ",deflate-on-oom=%s", + virTristateSwitchTypeToString(dev->deflate)); + if (virBufferCheckError(&buf) < 0) goto error; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-deflate-off.args b/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-deflate-off.args new file mode 100644 index 0000000..1e64c1a --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-deflate-off.args @@ -0,0 +1,23 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-m 214 \ +-smp 1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-monitor unix:/tmp/test-monitor,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-ide0-0-0,format=raw \ +-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x12,deflate-on-oom=off diff --git a/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-deflate-off.xml b/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-deflate-off.xml new file mode 100644 index 0000000..5e536a1 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-deflate-off.xml @@ -0,0 +1,25 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + </disk> + <memballoon model='virtio' deflate-on-oom='off'> + <address type='pci' domain='0' bus='0' slot='18' function='0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-deflate.args b/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-deflate.args new file mode 100644 index 0000000..18a2df9 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-deflate.args @@ -0,0 +1,23 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-m 214 \ +-smp 1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-monitor unix:/tmp/test-monitor,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-ide0-0-0,format=raw \ +-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x12,deflate-on-oom=on diff --git a/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-deflate.xml b/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-deflate.xml new file mode 100644 index 0000000..efecbc6 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-deflate.xml @@ -0,0 +1,25 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + </disk> + <memballoon model='virtio' deflate-on-oom='on'> + <address type='pci' domain='0' bus='0' slot='18' function='0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 37f806e..42a6aed 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1194,6 +1194,10 @@ mymain(void) QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_BOOTINDEX, QEMU_CAPS_VIRTIO_S390); DO_TEST("balloon-device", QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); + DO_TEST("balloon-device-deflate", + QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); + DO_TEST("balloon-device-deflate-off", + QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); DO_TEST("balloon-device-auto", QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); DO_TEST("balloon-device-period", QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list