[libvirt] [PATCH 0/3] make memory use in XML easier to read

As suggested here: https://www.redhat.com/archives/libvir-list/2012-February/msg00954.html Eric Blake (3): xml: output memory unit for clarity xml: drop unenforced minimum memory limit from RNG xml: allow scaled memory on input docs/formatdomain.html.in | 39 ++++- docs/schemas/domaincommon.rng | 27 +++- src/conf/domain_conf.c | 155 ++++++++++++++++---- src/conf/domain_conf.h | 12 +- tests/define-dev-segfault | 4 +- tests/domainschemadata/domain-lxc-simple.xml | 2 +- tests/domainschemadata/portprofile.xml | 2 +- .../qemu-simple-description-title.xml | 4 +- tests/domainschemadata/timers.xml | 4 +- tests/domainsnapshotxml2xmlout/disk_snapshot.xml | 4 +- tests/domainsnapshotxml2xmlout/full_domain.xml | 4 +- tests/domainsnapshotxml2xmlout/metadata.xml | 4 +- tests/openvzutilstest.c | 4 +- tests/qemuargv2xmltest.c | 5 +- .../qemuxml2argv-balloon-device-auto.xml | 4 +- .../qemuxml2argv-balloon-device.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-bios.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml | 4 +- .../qemuxml2argv-blkiotune-device.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-blkiotune.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml | 4 +- .../qemuxml2argv-boot-complex-bootindex.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-boot-complex.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-boot-floppy.xml | 4 +- ...uxml2argv-boot-menu-disable-drive-bootindex.xml | 4 +- .../qemuxml2argv-boot-menu-disable-drive.xml | 4 +- .../qemuxml2argv-boot-menu-disable.xml | 4 +- .../qemuxml2argv-boot-menu-enable.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-boot-multi.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-boot-network.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-boot-order.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-bootloader.xml | 4 +- .../qemuxml2argv-channel-guestfwd.xml | 4 +- .../qemuxml2argv-channel-spicevmc-old.xml | 2 +- .../qemuxml2argv-channel-spicevmc.xml | 2 +- .../qemuxml2argv-channel-virtio-auto.xml | 4 +- .../qemuxml2argv-channel-virtio.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-clock-france.xml | 4 +- .../qemuxml2argv-clock-localtime.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-clock-utc.xml | 4 +- .../qemuxml2argv-clock-variable.xml | 4 +- .../qemuxml2argv-console-compat-auto.xml | 4 +- .../qemuxml2argv-console-compat-chardev.xml | 4 +- .../qemuxml2argv-console-compat.xml | 4 +- .../qemuxml2argv-console-virtio-many.xml | 4 +- .../qemuxml2argv-console-virtio.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.xml | 4 +- .../qemuxml2argv-cpu-exact2-nofallback.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-cpu-fallback.xml | 4 +- .../qemuxml2argv-cpu-host-kvmclock.xml | 4 +- .../qemuxml2argv-cpu-host-model-fallback.xml | 4 +- .../qemuxml2argv-cpu-host-model-nofallback.xml | 4 +- .../qemuxml2argv-cpu-host-model.xml | 4 +- .../qemuxml2argv-cpu-host-passthrough.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-cpu-kvmclock.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-cpu-minimum1.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-cpu-minimum2.xml | 4 +- .../qemuxml2argv-cpu-nofallback.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-cpu-numa1.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-cpu-numa2.xml | 4 +- .../qemuxml2argv-cpu-qemu-host-passthrough.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-cpu-strict1.xml | 4 +- .../qemuxml2argv-cpu-topology1.xml | 4 +- .../qemuxml2argv-cpu-topology2.xml | 4 +- .../qemuxml2argv-cpu-topology3.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-cputune.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-disk-aio.xml | 4 +- .../qemuxml2argv-disk-cdrom-empty.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.xml | 4 +- .../qemuxml2argv-disk-copy_on_read.xml | 2 +- .../qemuxml2argv-disk-drive-boot-cdrom.xml | 4 +- .../qemuxml2argv-disk-drive-boot-disk.xml | 4 +- .../qemuxml2argv-disk-drive-cache-directsync.xml | 4 +- .../qemuxml2argv-disk-drive-cache-unsafe.xml | 4 +- .../qemuxml2argv-disk-drive-cache-v1-none.xml | 4 +- .../qemuxml2argv-disk-drive-cache-v1-wb.xml | 4 +- .../qemuxml2argv-disk-drive-cache-v1-wt.xml | 4 +- .../qemuxml2argv-disk-drive-cache-v2-none.xml | 4 +- .../qemuxml2argv-disk-drive-cache-v2-wb.xml | 4 +- .../qemuxml2argv-disk-drive-cache-v2-wt.xml | 4 +- ...muxml2argv-disk-drive-error-policy-enospace.xml | 4 +- .../qemuxml2argv-disk-drive-error-policy-stop.xml | 4 +- ...rgv-disk-drive-error-policy-wreport-rignore.xml | 4 +- .../qemuxml2argv-disk-drive-fat.xml | 4 +- .../qemuxml2argv-disk-drive-fmt-qcow.xml | 4 +- .../qemuxml2argv-disk-drive-network-nbd.xml | 4 +- .../qemuxml2argv-disk-drive-network-rbd-auth.xml | 4 +- ...emuxml2argv-disk-drive-network-rbd-ceph-env.xml | 4 +- .../qemuxml2argv-disk-drive-network-rbd.xml | 4 +- .../qemuxml2argv-disk-drive-network-sheepdog.xml | 4 +- .../qemuxml2argv-disk-drive-no-boot.xml | 4 +- .../qemuxml2argv-disk-drive-readonly-disk.xml | 4 +- .../qemuxml2argv-disk-drive-readonly-no-device.xml | 4 +- .../qemuxml2argv-disk-drive-shared.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-disk-floppy.xml | 4 +- .../qemuxml2argv-disk-ioeventfd.xml | 2 +- tests/qemuxml2argvdata/qemuxml2argv-disk-many.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-disk-order.xml | 4 +- .../qemuxml2argv-disk-sata-device.xml | 4 +- .../qemuxml2argv-disk-scsi-device-auto.xml | 4 +- .../qemuxml2argv-disk-scsi-device.xml | 4 +- .../qemuxml2argv-disk-snapshot.xml | 4 +- .../qemuxml2argv-disk-transient.xml | 4 +- .../qemuxml2argv-disk-usb-device.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-disk-usb.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-disk-virtio.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-disk-xenvbd.xml | 4 +- .../qemuxml2argv-encrypted-disk.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-event_idx.xml | 4 +- .../qemuxml2argv-floppy-drive-fat.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-fs9p.xml | 4 +- .../qemuxml2argv-graphics-listen-network.xml | 4 +- .../qemuxml2argv-graphics-listen-network2.xml | 4 +- .../qemuxml2argv-graphics-sdl-fullscreen.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml | 4 +- .../qemuxml2argv-graphics-spice-compression.xml | 4 +- .../qemuxml2argv-graphics-spice-qxl-vga.xml | 4 +- .../qemuxml2argv-graphics-spice-timeout.xml | 4 +- .../qemuxml2argv-graphics-spice.xml | 4 +- .../qemuxml2argv-graphics-vnc-sasl.xml | 4 +- .../qemuxml2argv-graphics-vnc-socket.xml | 4 +- .../qemuxml2argv-graphics-vnc-tls.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml | 4 +- .../qemuxml2argv-hostdev-pci-address-device.xml | 4 +- .../qemuxml2argv-hostdev-pci-address.xml | 4 +- .../qemuxml2argv-hostdev-usb-address-device.xml | 4 +- .../qemuxml2argv-hostdev-usb-address.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-hugepages.xml | 4 +- .../qemuxml2argv-input-usbmouse-addr.xml | 4 +- .../qemuxml2argv-input-usbmouse.xml | 4 +- .../qemuxml2argv-input-usbtablet.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-input-xen.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-kvmclock.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-lease.xml | 4 +- .../qemuxml2argv-machine-aliases1.xml | 4 +- .../qemuxml2argv-machine-aliases2.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-memtune.xml | 10 +- tests/qemuxml2argvdata/qemuxml2argv-metadata.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-migrate.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-minimal.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.xml | 4 +- .../qemuxml2argv-misc-no-reboot.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-misc-uuid.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-monitor-json.xml | 4 +- .../qemuxml2argv-multifunction-pci-device.xml | 4 +- .../qemuxml2argv-net-bandwidth.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-net-client.xml | 4 +- .../qemuxml2argv-net-eth-ifname.xml | 4 +- .../qemuxml2argv-net-eth-names.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-net-eth.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-net-mcast.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-net-server.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-net-user.xml | 4 +- .../qemuxml2argv-net-virtio-device.xml | 4 +- .../qemuxml2argv-net-virtio-netdev.xml | 4 +- .../qemuxml2argv-net-virtio-network-portgroup.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-net-virtio.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-no-shutdown.xml | 4 +- .../qemuxml2argv-nographics-vga.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-nographics.xml | 4 +- .../qemuxml2argv-numatune-memory.xml | 4 +- .../qemuxml2argv-parallel-tcp-chardev.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-pci-rom.xml | 4 +- .../qemuxml2argv-pseries-basic.xml | 2 +- .../qemuxml2argv-pseries-vio-address-clash.xml | 2 +- .../qemuxml2argv-pseries-vio-user-assigned.xml | 2 +- .../qemuxml2argvdata/qemuxml2argv-pseries-vio.xml | 2 +- .../qemuxml2argv-qemu-ns-no-env.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-qemu-ns.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-restore-v1.xml | 4 +- .../qemuxml2argv-restore-v2-fd.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-restore-v2.xml | 4 +- .../qemuxml2argv-seclabel-dynamic-baselabel.xml | 4 +- .../qemuxml2argv-seclabel-dynamic-override.xml | 4 +- .../qemuxml2argv-seclabel-dynamic.xml | 4 +- .../qemuxml2argv-seclabel-none.xml | 4 +- .../qemuxml2argv-seclabel-static-relabel.xml | 4 +- .../qemuxml2argv-seclabel-static.xml | 4 +- .../qemuxml2argv-serial-dev-chardev.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-serial-dev.xml | 4 +- .../qemuxml2argv-serial-file-chardev.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-serial-file.xml | 4 +- .../qemuxml2argv-serial-many-chardev.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-serial-many.xml | 4 +- .../qemuxml2argv-serial-pty-chardev.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-serial-pty.xml | 4 +- .../qemuxml2argv-serial-target-port-auto.xml | 4 +- .../qemuxml2argv-serial-tcp-chardev.xml | 4 +- .../qemuxml2argv-serial-tcp-telnet-chardev.xml | 4 +- .../qemuxml2argv-serial-tcp-telnet.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.xml | 4 +- .../qemuxml2argv-serial-udp-chardev.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml | 4 +- .../qemuxml2argv-serial-unix-chardev.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-serial-unix.xml | 4 +- .../qemuxml2argv-serial-vc-chardev.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-serial-vc.xml | 4 +- .../qemuxml2argv-smartcard-controller.xml | 4 +- .../qemuxml2argv-smartcard-host-certificates.xml | 4 +- .../qemuxml2argv-smartcard-host.xml | 4 +- ...qemuxml2argv-smartcard-passthrough-spicevmc.xml | 4 +- .../qemuxml2argv-smartcard-passthrough-tcp.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-smbios.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-smp.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-sound-device.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-sound.xml | 4 +- .../qemuxml2argv-usb-controller.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-usb-hub.xml | 4 +- .../qemuxml2argv-usb-ich9-companion.xml | 4 +- .../qemuxml2argv-usb-ich9-ehci-addr.xml | 4 +- .../qemuxml2argv-usb-piix3-controller.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-usb-ports.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-virtio-lun.xml | 4 +- .../qemuxml2argv-watchdog-device.xml | 4 +- .../qemuxml2argv-watchdog-dump.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-watchdog.xml | 4 +- .../qemuxml2xmlout-balloon-device-auto.xml | 4 +- .../qemuxml2xmlout-channel-virtio-auto.xml | 4 +- .../qemuxml2xmlout-console-compat-auto.xml | 4 +- .../qemuxml2xmlout-console-virtio.xml | 4 +- .../qemuxml2xmlout-disk-cdrom-empty.xml | 4 +- .../qemuxml2xmlout-disk-scsi-device-auto.xml | 4 +- .../qemuxml2xmlout-graphics-listen-network2.xml | 4 +- .../qemuxml2xmlout-graphics-spice-timeout.xml | 4 +- .../qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml | 4 +- .../qemuxml2xmlout-serial-target-port-auto.xml | 4 +- .../qemuxmlns-qemu-ns-commandline-ns0.xml | 4 +- .../qemuxmlns-qemu-ns-commandline-ns1.xml | 4 +- .../qemuxmlns-qemu-ns-commandline.xml | 4 +- .../qemuxmlns-qemu-ns-domain-commandline-ns0.xml | 4 +- .../qemuxmlns-qemu-ns-domain-commandline.xml | 4 +- .../qemuxmlnsdata/qemuxmlns-qemu-ns-domain-ns0.xml | 4 +- tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-boot-grub.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-bridge-ipaddr.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-curmem.xml | 4 +- .../sexpr2xml-disk-block-shareable.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-disk-block.xml | 4 +- .../sexpr2xml-disk-drv-blktap-qcow.xml | 4 +- .../sexpr2xml-disk-drv-blktap-raw.xml | 4 +- .../sexpr2xml-disk-drv-blktap2-raw.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-disk-file.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-legacy-vfb.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-net-ioemu.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml | 4 +- .../sexpr2xml-fv-serial-dev-2-ports.xml | 4 +- .../sexpr2xml-fv-serial-dev-2nd-port.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml | 4 +- .../sexpr2xml-fv-serial-tcp-telnet.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-sound.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-utc.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-v2.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-net-bridged.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-net-e1000.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-net-routed.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-pci-devs.xml | 4 +- .../sexpr2xml-pv-bootloader-cmdline.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-pv-bootloader.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-pv-localtime.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml | 4 +- .../sexpr2xml-pv-vfb-new-vncdisplay.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-pv-vfb-orig.xml | 4 +- .../sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-pv.xml | 4 +- tests/vmx2xmldata/vmx2xml-annotation.xml | 4 +- tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml | 4 +- tests/vmx2xmldata/vmx2xml-case-insensitive-2.xml | 4 +- tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml | 4 +- tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml | 4 +- tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml | 4 +- tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml | 4 +- tests/vmx2xmldata/vmx2xml-esx-in-the-wild-1.xml | 4 +- tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml | 4 +- tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml | 4 +- tests/vmx2xmldata/vmx2xml-esx-in-the-wild-4.xml | 4 +- tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml | 6 +- tests/vmx2xmldata/vmx2xml-esx-in-the-wild-6.xml | 4 +- tests/vmx2xmldata/vmx2xml-ethernet-bridged.xml | 4 +- tests/vmx2xmldata/vmx2xml-ethernet-custom.xml | 4 +- tests/vmx2xmldata/vmx2xml-ethernet-e1000.xml | 4 +- tests/vmx2xmldata/vmx2xml-ethernet-generated.xml | 4 +- tests/vmx2xmldata/vmx2xml-ethernet-other.xml | 4 +- tests/vmx2xmldata/vmx2xml-ethernet-static.xml | 4 +- tests/vmx2xmldata/vmx2xml-ethernet-vmxnet2.xml | 4 +- tests/vmx2xmldata/vmx2xml-ethernet-vpx.xml | 4 +- tests/vmx2xmldata/vmx2xml-floppy-device.xml | 4 +- tests/vmx2xmldata/vmx2xml-floppy-file.xml | 4 +- tests/vmx2xmldata/vmx2xml-graphics-vnc.xml | 4 +- tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-1.xml | 4 +- tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-2.xml | 4 +- tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-3.xml | 4 +- tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-4.xml | 4 +- tests/vmx2xmldata/vmx2xml-harddisk-ide-file.xml | 4 +- tests/vmx2xmldata/vmx2xml-harddisk-scsi-file.xml | 4 +- tests/vmx2xmldata/vmx2xml-minimal-64bit.xml | 4 +- tests/vmx2xmldata/vmx2xml-minimal.xml | 4 +- tests/vmx2xmldata/vmx2xml-parallel-device.xml | 4 +- tests/vmx2xmldata/vmx2xml-parallel-file.xml | 4 +- tests/vmx2xmldata/vmx2xml-scsi-driver.xml | 4 +- tests/vmx2xmldata/vmx2xml-scsi-writethrough.xml | 4 +- tests/vmx2xmldata/vmx2xml-serial-device.xml | 4 +- tests/vmx2xmldata/vmx2xml-serial-file.xml | 4 +- .../vmx2xmldata/vmx2xml-serial-network-client.xml | 4 +- .../vmx2xmldata/vmx2xml-serial-network-server.xml | 4 +- tests/vmx2xmldata/vmx2xml-serial-pipe.xml | 4 +- tests/vmx2xmldata/vmx2xml-smbios.xml | 4 +- tests/vmx2xmldata/vmx2xml-svga.xml | 4 +- tests/xmconfigdata/sexpr2xml-pv-bootloader.xml | 4 +- tests/xmconfigdata/test-escape-paths.xml | 4 +- tests/xmconfigdata/test-fullvirt-force-hpet.xml | 4 +- tests/xmconfigdata/test-fullvirt-force-nohpet.xml | 4 +- tests/xmconfigdata/test-fullvirt-localtime.xml | 4 +- tests/xmconfigdata/test-fullvirt-net-ioemu.xml | 4 +- tests/xmconfigdata/test-fullvirt-net-netfront.xml | 4 +- tests/xmconfigdata/test-fullvirt-new-cdrom.xml | 4 +- tests/xmconfigdata/test-fullvirt-old-cdrom.xml | 4 +- tests/xmconfigdata/test-fullvirt-parallel-tcp.xml | 4 +- .../test-fullvirt-serial-dev-2-ports.xml | 4 +- .../test-fullvirt-serial-dev-2nd-port.xml | 4 +- tests/xmconfigdata/test-fullvirt-serial-file.xml | 4 +- tests/xmconfigdata/test-fullvirt-serial-null.xml | 4 +- tests/xmconfigdata/test-fullvirt-serial-pipe.xml | 4 +- tests/xmconfigdata/test-fullvirt-serial-pty.xml | 4 +- tests/xmconfigdata/test-fullvirt-serial-stdio.xml | 4 +- .../test-fullvirt-serial-tcp-telnet.xml | 4 +- tests/xmconfigdata/test-fullvirt-serial-tcp.xml | 4 +- tests/xmconfigdata/test-fullvirt-serial-udp.xml | 4 +- tests/xmconfigdata/test-fullvirt-serial-unix.xml | 4 +- tests/xmconfigdata/test-fullvirt-sound.xml | 4 +- tests/xmconfigdata/test-fullvirt-usbmouse.xml | 4 +- .../test-fullvirt-usbtablet-no-bus.xml | 4 +- tests/xmconfigdata/test-fullvirt-usbtablet.xml | 4 +- tests/xmconfigdata/test-fullvirt-utc.xml | 4 +- tests/xmconfigdata/test-no-source-cdrom.xml | 4 +- tests/xmconfigdata/test-paravirt-net-e1000.xml | 4 +- tests/xmconfigdata/test-paravirt-net-vifname.xml | 4 +- .../test-paravirt-new-pvfb-vncdisplay.xml | 4 +- tests/xmconfigdata/test-paravirt-new-pvfb.xml | 4 +- .../test-paravirt-old-pvfb-vncdisplay.xml | 4 +- tests/xmconfigdata/test-paravirt-old-pvfb.xml | 4 +- tests/xmconfigdata/test-paravirt-vcpu.xml | 4 +- tests/xmconfigdata/test-pci-devs.xml | 4 +- tests/xml2sexprdata/xml2sexpr-boot-grub.xml | 2 +- tests/xml2sexprdata/xml2sexpr-bridge-ipaddr.xml | 2 +- tests/xml2sexprdata/xml2sexpr-curmem.xml | 4 +- .../xml2sexpr-disk-block-shareable.xml | 4 +- tests/xml2sexprdata/xml2sexpr-disk-block.xml | 2 +- tests/xml2sexprdata/xml2sexpr-disk-drv-blkback.xml | 2 +- .../xml2sexpr-disk-drv-blktap-qcow.xml | 2 +- .../xml2sexpr-disk-drv-blktap-raw.xml | 2 +- tests/xml2sexprdata/xml2sexpr-disk-drv-blktap.xml | 2 +- .../xml2sexpr-disk-drv-blktap2-raw.xml | 2 +- tests/xml2sexprdata/xml2sexpr-disk-drv-blktap2.xml | 2 +- tests/xml2sexprdata/xml2sexpr-disk-drv-loop.xml | 2 +- tests/xml2sexprdata/xml2sexpr-disk-file.xml | 2 +- tests/xml2sexprdata/xml2sexpr-escape.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-force-hpet.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-force-nohpet.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-kernel.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-localtime.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-net-ioemu.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-net-netfront.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-parallel-tcp.xml | 2 +- .../xml2sexpr-fv-serial-dev-2-ports.xml | 2 +- .../xml2sexpr-fv-serial-dev-2nd-port.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-serial-file.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-serial-null.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-serial-pipe.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-serial-pty.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-serial-stdio.xml | 2 +- .../xml2sexpr-fv-serial-tcp-telnet.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-serial-tcp.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-serial-udp.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-serial-unix.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-sound.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-usbmouse.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-usbtablet.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-utc.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-vncunused.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv.xml | 2 +- tests/xml2sexprdata/xml2sexpr-net-bridged.xml | 2 +- tests/xml2sexprdata/xml2sexpr-net-e1000.xml | 2 +- tests/xml2sexprdata/xml2sexpr-net-routed.xml | 2 +- tests/xml2sexprdata/xml2sexpr-no-source-cdrom.xml | 4 +- tests/xml2sexprdata/xml2sexpr-pci-devs.xml | 2 +- .../xml2sexpr-pv-bootloader-cmdline.xml | 2 +- tests/xml2sexprdata/xml2sexpr-pv-bootloader.xml | 2 +- tests/xml2sexprdata/xml2sexpr-pv-localtime.xml | 4 +- tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml | 2 +- tests/xml2sexprdata/xml2sexpr-pv-vfb-new-auto.xml | 2 +- tests/xml2sexprdata/xml2sexpr-pv-vfb-new.xml | 2 +- tests/xml2sexprdata/xml2sexpr-pv-vfb-orig.xml | 2 +- tests/xml2sexprdata/xml2sexpr-pv.xml | 2 +- tests/xml2vmxdata/xml2vmx-annotation.xml | 2 +- tests/xml2vmxdata/xml2vmx-cdrom-ide-device.xml | 2 +- tests/xml2vmxdata/xml2vmx-cdrom-ide-file.xml | 2 +- tests/xml2vmxdata/xml2vmx-cdrom-scsi-device.xml | 2 +- tests/xml2vmxdata/xml2vmx-cdrom-scsi-file.xml | 2 +- tests/xml2vmxdata/xml2vmx-esx-in-the-wild-1.xml | 4 +- tests/xml2vmxdata/xml2vmx-esx-in-the-wild-2.xml | 4 +- tests/xml2vmxdata/xml2vmx-esx-in-the-wild-3.xml | 4 +- tests/xml2vmxdata/xml2vmx-esx-in-the-wild-4.xml | 4 +- tests/xml2vmxdata/xml2vmx-esx-in-the-wild-5.xml | 6 +- tests/xml2vmxdata/xml2vmx-esx-in-the-wild-6.xml | 4 +- tests/xml2vmxdata/xml2vmx-ethernet-bridged.xml | 2 +- tests/xml2vmxdata/xml2vmx-ethernet-custom.xml | 2 +- tests/xml2vmxdata/xml2vmx-ethernet-e1000.xml | 2 +- tests/xml2vmxdata/xml2vmx-ethernet-generated.xml | 2 +- tests/xml2vmxdata/xml2vmx-ethernet-other.xml | 2 +- tests/xml2vmxdata/xml2vmx-ethernet-static.xml | 2 +- tests/xml2vmxdata/xml2vmx-ethernet-vmxnet2.xml | 2 +- tests/xml2vmxdata/xml2vmx-ethernet-vpx.xml | 2 +- tests/xml2vmxdata/xml2vmx-floppy-device.xml | 2 +- tests/xml2vmxdata/xml2vmx-floppy-file.xml | 2 +- tests/xml2vmxdata/xml2vmx-graphics-vnc.xml | 2 +- tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-1.xml | 4 +- tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-2.xml | 4 +- tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-3.xml | 4 +- tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-4.xml | 4 +- tests/xml2vmxdata/xml2vmx-harddisk-ide-file.xml | 2 +- tests/xml2vmxdata/xml2vmx-harddisk-scsi-file.xml | 2 +- tests/xml2vmxdata/xml2vmx-minimal-64bit.xml | 2 +- tests/xml2vmxdata/xml2vmx-minimal.xml | 2 +- tests/xml2vmxdata/xml2vmx-parallel-device.xml | 2 +- tests/xml2vmxdata/xml2vmx-parallel-file.xml | 2 +- tests/xml2vmxdata/xml2vmx-scsi-driver.xml | 2 +- tests/xml2vmxdata/xml2vmx-scsi-writethrough.xml | 2 +- tests/xml2vmxdata/xml2vmx-serial-device.xml | 2 +- tests/xml2vmxdata/xml2vmx-serial-file.xml | 2 +- .../xml2vmxdata/xml2vmx-serial-network-client.xml | 2 +- .../xml2vmxdata/xml2vmx-serial-network-server.xml | 2 +- tests/xml2vmxdata/xml2vmx-serial-pipe.xml | 2 +- tests/xml2vmxdata/xml2vmx-smbios.xml | 2 +- tests/xml2vmxdata/xml2vmx-svga.xml | 2 +- 458 files changed, 1008 insertions(+), 876 deletions(-) -- 1.7.7.6

The test domain allows <memory>0</memory>, but the RNG was stating that memory had to be at least 4096000 bytes. Hypervisors should enforce their own limits, rather than complicating the RNG. Meanwhile, some copy and paste had introduced some fishy constructs in various unit tests. * docs/schemas/domaincommon.rng (memoryKB, memoryKBElement): Drop limit that isn't enforced in code. * src/conf/domain_conf.c (virDomainDefParseXML): Require current <= maximum. * tests/qemuxml2argvdata/*.xml: Fix offenders. --- docs/schemas/domaincommon.rng | 2 -- src/conf/domain_conf.c | 7 +++++++ .../qemuxml2argv-smartcard-controller.xml | 2 +- .../qemuxml2argv-smartcard-host-certificates.xml | 2 +- .../qemuxml2argv-smartcard-host.xml | 2 +- ...qemuxml2argv-smartcard-passthrough-spicevmc.xml | 2 +- .../qemuxml2argv-smartcard-passthrough-tcp.xml | 2 +- .../qemuxml2argv-usb-controller.xml | 2 +- tests/qemuxml2argvdata/qemuxml2argv-usb-hub.xml | 2 +- .../qemuxml2argv-usb-ich9-companion.xml | 2 +- .../qemuxml2argv-usb-ich9-ehci-addr.xml | 2 +- .../qemuxml2argv-usb-piix3-controller.xml | 2 +- tests/qemuxml2argvdata/qemuxml2argv-usb-ports.xml | 2 +- tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml | 2 +- tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml | 2 +- 15 files changed, 20 insertions(+), 15 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 6b62f73..68e3fdc 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3076,7 +3076,6 @@ <define name="memoryKB"> <data type="unsignedInt"> <param name="pattern">[0-9]+</param> - <param name="minInclusive">4000</param> </data> </define> <!-- Memory as an element, with optional units attribute --> @@ -3088,7 +3087,6 @@ </optional> <data type='unsignedInt'> <param name='pattern'>[0-9]+</param> - <param name='minInclusive'>4000</param> </data> </define> <define name="domainName"> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 07565bc..9dac731 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7275,6 +7275,13 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, &def->mem.cur_balloon) < 0) def->mem.cur_balloon = def->mem.max_balloon; + if (def->mem.cur_balloon > def->mem.max_balloon) { + virDomainReportError(VIR_ERR_INTERNAL_ERROR, + _("current memory '%luk' exceeds maximum '%luk'"), + def->mem.cur_balloon, def->mem.max_balloon); + goto error; + } + node = virXPathNode("./memoryBacking/hugepages", ctxt); if (node) def->mem.hugepage_backed = 1; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-controller.xml b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-controller.xml index b590066..601c308 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-controller.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-controller.xml @@ -2,7 +2,7 @@ <name>QEMUGuest1</name> <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> <memory units='KiB'>219136</memory> - <currentMemory units='KiB'>219200</currentMemory> + <currentMemory units='KiB'>219136</currentMemory> <vcpu>1</vcpu> <os> <type arch='i686' machine='pc'>hvm</type> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host-certificates.xml b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host-certificates.xml index 3a7ed3d..0293df5 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host-certificates.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host-certificates.xml @@ -2,7 +2,7 @@ <name>QEMUGuest1</name> <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> <memory units='KiB'>219136</memory> - <currentMemory units='KiB'>219200</currentMemory> + <currentMemory units='KiB'>219136</currentMemory> <vcpu>1</vcpu> <os> <type arch='i686' machine='pc'>hvm</type> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host.xml b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host.xml index fbf0ddc..30582b7 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host.xml @@ -2,7 +2,7 @@ <name>QEMUGuest1</name> <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> <memory units='KiB'>219136</memory> - <currentMemory units='KiB'>219200</currentMemory> + <currentMemory units='KiB'>219136</currentMemory> <vcpu>1</vcpu> <os> <type arch='i686' machine='pc'>hvm</type> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-spicevmc.xml b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-spicevmc.xml index 75fdd81..4c9ed0d 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-spicevmc.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-spicevmc.xml @@ -2,7 +2,7 @@ <name>QEMUGuest1</name> <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> <memory units='KiB'>219136</memory> - <currentMemory units='KiB'>219200</currentMemory> + <currentMemory units='KiB'>219136</currentMemory> <vcpu>1</vcpu> <os> <type arch='i686' machine='pc'>hvm</type> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-tcp.xml b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-tcp.xml index 70e025e..4b5bb47 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-tcp.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-tcp.xml @@ -2,7 +2,7 @@ <name>QEMUGuest1</name> <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> <memory units='KiB'>219136</memory> - <currentMemory units='KiB'>219200</currentMemory> + <currentMemory units='KiB'>219136</currentMemory> <vcpu>1</vcpu> <os> <type arch='i686' machine='pc'>hvm</type> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller.xml index 736a283..50c9282 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller.xml @@ -2,7 +2,7 @@ <name>QEMUGuest1</name> <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> <memory units='KiB'>219136</memory> - <currentMemory units='KiB'>219200</currentMemory> + <currentMemory units='KiB'>219136</currentMemory> <vcpu>1</vcpu> <os> <type arch='i686' machine='pc'>hvm</type> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-hub.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-hub.xml index b867f01..d20f3d9 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-hub.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-hub.xml @@ -2,7 +2,7 @@ <name>QEMUGuest1</name> <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> <memory units='KiB'>219136</memory> - <currentMemory units='KiB'>219200</currentMemory> + <currentMemory units='KiB'>219136</currentMemory> <vcpu>1</vcpu> <os> <type arch='i686' machine='pc'>hvm</type> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-companion.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-companion.xml index 6b20e67..cec9b0b 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-companion.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-companion.xml @@ -2,7 +2,7 @@ <name>QEMUGuest1</name> <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> <memory units='KiB'>219136</memory> - <currentMemory units='KiB'>219200</currentMemory> + <currentMemory units='KiB'>219136</currentMemory> <vcpu>1</vcpu> <os> <type arch='i686' machine='pc'>hvm</type> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.xml index 68b149e..4f00f44 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.xml @@ -2,7 +2,7 @@ <name>QEMUGuest1</name> <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> <memory units='KiB'>219136</memory> - <currentMemory units='KiB'>219200</currentMemory> + <currentMemory units='KiB'>219136</currentMemory> <vcpu>1</vcpu> <os> <type arch='i686' machine='pc'>hvm</type> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-piix3-controller.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-piix3-controller.xml index 214a38f..33421b0 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-piix3-controller.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-piix3-controller.xml @@ -2,7 +2,7 @@ <name>QEMUGuest1</name> <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> <memory units='KiB'>219136</memory> - <currentMemory units='KiB'>219200</currentMemory> + <currentMemory units='KiB'>219136</currentMemory> <vcpu>1</vcpu> <os> <type arch='i686' machine='pc'>hvm</type> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-ports.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-ports.xml index 038e008..5897bf1 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-ports.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-ports.xml @@ -2,7 +2,7 @@ <name>QEMUGuest1</name> <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> <memory units='KiB'>219136</memory> - <currentMemory units='KiB'>219200</currentMemory> + <currentMemory units='KiB'>219136</currentMemory> <vcpu>1</vcpu> <os> <type arch='i686' machine='pc'>hvm</type> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml index c7e34dc..b9a1cdd 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml @@ -2,7 +2,7 @@ <name>QEMUGuest1</name> <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> <memory units='KiB'>219136</memory> - <currentMemory units='KiB'>219200</currentMemory> + <currentMemory units='KiB'>219136</currentMemory> <vcpu>1</vcpu> <os> <type arch='i686' machine='pc'>hvm</type> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml index 6b4e1c7..e5a9ce8 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml @@ -2,7 +2,7 @@ <name>QEMUGuest1</name> <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> <memory units='KiB'>219136</memory> - <currentMemory units='KiB'>219200</currentMemory> + <currentMemory units='KiB'>219136</currentMemory> <vcpu>1</vcpu> <os> <type arch='i686' machine='pc'>hvm</type> -- 1.7.7.6

Output is still in kibibytes, but input can now be in different scales for ease of typing. * src/conf/domain_conf.c (virDomainParseMemory): New helper. (virDomainDefParseXML): Use it when parsing. * docs/schemas/domaincommon.rng: Expand XML. * docs/formatdomain.html.in (elementsMemoryAllocation): Document scaling. --- docs/formatdomain.html.in | 39 ++++++++++--- docs/schemas/domaincommon.rng | 4 +- src/conf/domain_conf.c | 129 ++++++++++++++++++++++++++++++++++------ 3 files changed, 142 insertions(+), 30 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 5305f82..7a4a197 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -415,8 +415,8 @@ <pre> <domain> ... - <memory>524288</memory> - <currentMemory>524288</currentMemory> + <memory units='KiB'>524288</memory> + <currentMemory units='KiB'>524288</currentMemory> ... </domain> </pre> @@ -424,12 +424,27 @@ <dl> <dt><code>memory</code></dt> <dd>The maximum allocation of memory for the guest at boot time. - The units for this value are kilobytes (i.e. blocks of 1024 bytes)</dd> + The units for this value are determined by the optional + atttribute <code>units</code>, which defaults to "KiB" + (kibibytes, or blocks of 1024 bytes). Valid units are "b" or + "bytes" for bytes, "KB" for kilobytes (1,000), "k" or "KiB" + for kibibytes (1024), "MB" for megabytes (1,000,000), "M" or + "MiB" for mebibytes (1,048,576), "GB" for gigabytes + (1,000,000,000), "G" or "GiB" for gibibytes (1,073,741,824), + "TB" for terabytes (1,000,000,000,000), or "T" or "TiB" for + tebibytes (1,099,511,627,776). However, the value will be + rounded up to the nearest kibibyte by libvirt, and may be + further rounded to the granularity supported by the + hypervisor. As a sanity check, values less than 4000KiB are + not permitted. <span class='since'><code>units</code> since + 0.9.11</span></dd> <dt><code>currentMemory</code></dt> <dd>The actual allocation of memory for the guest. This value can be less than the maximum allocation, to allow for ballooning up the guests memory on the fly. If this is omitted, it defaults - to the same value as the <code>memory</code> element</dd> + to the same value as the <code>memory</code> element. + The <code>units</code> attribute behaves the same as + for <code>memory</code>.</dd> </dl> @@ -460,10 +475,10 @@ <domain> ... <memtune> - <hard_limit>1048576</hard_limit> - <soft_limit>131072</soft_limit> - <swap_hard_limit>2097152</swap_hard_limit> - <min_guarantee>65536</min_guarantee> + <hard_limit units='G'>1</hard_limit> + <soft_limit units='M'>128</soft_limit> + <swap_hard_limit units='G'>2</swap_hard_limit> + <min_guarantee units='bytes'>67108864</min_guarantee> </memtune> ... </domain> @@ -477,7 +492,13 @@ parameters are applied to the QEMU process as a whole. Thus, when counting them, one needs to add up guest RAM, guest video RAM, and some memory overhead of QEMU itself. The last piece is hard to - determine so one needs guess and try.</dd> + determine so one needs guess and try. For each tunable, it + is possible to designate which unit the number is in on + input, using the same values as + for <code><memory></code>. For backwards + compatibility, output is always in + KiB. <span class='since'><code>units</code> + since 0.9.11</span></dd> <dt><code>hard_limit</code></dt> <dd> The optional <code>hard_limit</code> element is the maximum memory the guest can use. The units for this value are kilobytes (i.e. blocks diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 68e3fdc..3d2e9f5 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3082,7 +3082,9 @@ <define name='memoryKBElement'> <optional> <attribute name='units'> - <value>KiB</value> + <data type='string'> + <param name='pattern'>([bB]([yY][tT][eE][sS]?)?)|([kKmMgGtT]([iI]?[bB])?)</param> + </data> </attribute> </optional> <data type='unsignedInt'> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9dac731..a869c70 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7141,6 +7141,96 @@ static int virDomainDefMaybeAddController(virDomainDefPtr def, return 0; } + +/* Parse a memory element located at XPATH within CTXT, and store the + * result into MEM. If REQUIRED, then the value must exist; + * otherwise, the value is optional, but must result in at least 4000 + * blocks if present. Return 0 on success, -1 on failure after + * issuing error. */ +static int +virDomainParseMemory(const char *xpath, xmlXPathContextPtr ctxt, + unsigned long *mem, bool required) +{ + char *xpath_full = NULL; + char *units = NULL; + int ret = -1; + unsigned long long bytes; + unsigned long long scale = 1; + + *mem = 0; + if (virAsprintf(&xpath_full, "string(%s)", xpath) < 0) { + virReportOOMError(); + goto cleanup; + } + if (virXPathULongLong(xpath_full, ctxt, &bytes) < 0) { + if (required) + virDomainReportError(VIR_ERR_XML_ERROR, + "%s", _("missing memory element")); + else + ret = 0; + goto cleanup; + } + VIR_FREE(xpath_full); + + if (virAsprintf(&xpath_full, "string(%s/@units)", xpath) < 0) { + virReportOOMError(); + goto cleanup; + } + units = virXPathString(xpath_full, ctxt); + if (!units) { + scale = 1024; + } else if (STRCASEEQ(units, "b") || STRCASEEQ(units, "byte") || + STRCASEEQ(units, "bytes")) { + /* no change */ + } else { + unsigned long long multiplier; + if (STRCASEEQ(units + 1, "") || STRCASEEQ(units + 1, "iB")) { + multiplier = 1024; + } else if (STRCASEEQ(units + 1, "B")) { + multiplier = 1000; + } else { + virDomainReportError(VIR_ERR_XML_ERROR, + _("unknown units '%s'"), units); + goto cleanup; + } + switch (c_tolower(*units)) { + case 't': + scale *= multiplier; + /* fallthrough */ + case 'g': + scale *= multiplier; + /* fallthrough */ + case 'm': + scale *= multiplier; + /* fallthrough */ + case 'k': + scale *= multiplier; + break; + default: + virDomainReportError(VIR_ERR_XML_ERROR, + _("unknown units '%s'"), units); + goto cleanup; + } + } + + if (bytes >= (ULLONG_MAX - 1023) / scale) { + virDomainReportError(VIR_ERR_XML_ERROR, + _("memory value %llu%s too large"), + bytes, units ? units : "KiB"); + goto cleanup; + } + bytes *= scale; + + /* Yes, we really do use kibibytes for our internal sizing. */ + *mem = VIR_DIV_UP(bytes, 1024); + ret = 0; +cleanup: + VIR_FREE(xpath_full); + VIR_FREE(units); + return ret; +} + + static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, xmlDocPtr xml, xmlNodePtr root, @@ -7264,22 +7354,21 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, goto error; /* Extract domain memory */ - if (virXPathULong("string(./memory[1])", ctxt, - &def->mem.max_balloon) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing memory element")); + if (virDomainParseMemory("./memory[1]", ctxt, + &def->mem.max_balloon, true) < 0) goto error; - } - if (virXPathULong("string(./currentMemory[1])", ctxt, - &def->mem.cur_balloon) < 0) - def->mem.cur_balloon = def->mem.max_balloon; + if (virDomainParseMemory("./currentMemory[1]", ctxt, + &def->mem.cur_balloon, false) < 0) + goto error; if (def->mem.cur_balloon > def->mem.max_balloon) { virDomainReportError(VIR_ERR_INTERNAL_ERROR, _("current memory '%luk' exceeds maximum '%luk'"), def->mem.cur_balloon, def->mem.max_balloon); goto error; + } else if (def->mem.cur_balloon == 0) { + def->mem.cur_balloon = def->mem.max_balloon; } node = virXPathNode("./memoryBacking/hugepages", ctxt); @@ -7318,21 +7407,21 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, VIR_FREE(nodes); /* Extract other memory tunables */ - if (virXPathULong("string(./memtune/hard_limit)", ctxt, - &def->mem.hard_limit) < 0) - def->mem.hard_limit = 0; + if (virDomainParseMemory("./memtune/hard_limit[1]", ctxt, + &def->mem.hard_limit, false) < 0) + goto error; - if (virXPathULong("string(./memtune/soft_limit[1])", ctxt, - &def->mem.soft_limit) < 0) - def->mem.soft_limit = 0; + if (virDomainParseMemory("./memtune/soft_limit[1]", ctxt, + &def->mem.soft_limit, false) < 0) + goto error; - if (virXPathULong("string(./memtune/min_guarantee[1])", ctxt, - &def->mem.min_guarantee) < 0) - def->mem.min_guarantee = 0; + if (virDomainParseMemory("./memtune/min_guarantee[1]", ctxt, + &def->mem.min_guarantee, false) < 0) + goto error; - if (virXPathULong("string(./memtune/swap_hard_limit[1])", ctxt, - &def->mem.swap_hard_limit) < 0) - def->mem.swap_hard_limit = 0; + if (virDomainParseMemory("./memtune/swap_hard_limit[1]", ctxt, + &def->mem.swap_hard_limit, false) < 0) + goto error; n = virXPathULong("string(./vcpu[1])", ctxt, &count); if (n == -2) { -- 1.7.7.6

On Wed, Feb 22, 2012 at 09:59:47PM -0700, Eric Blake wrote:
@@ -424,12 +424,27 @@ <dl> <dt><code>memory</code></dt> <dd>The maximum allocation of memory for the guest at boot time. - The units for this value are kilobytes (i.e. blocks of 1024 bytes)</dd> + The units for this value are determined by the optional + atttribute <code>units</code>, which defaults to "KiB" + (kibibytes, or blocks of 1024 bytes). Valid units are "b" or + "bytes" for bytes, "KB" for kilobytes (1,000), "k" or "KiB" + for kibibytes (1024), "MB" for megabytes (1,000,000), "M" or + "MiB" for mebibytes (1,048,576), "GB" for gigabytes + (1,000,000,000), "G" or "GiB" for gibibytes (1,073,741,824), + "TB" for terabytes (1,000,000,000,000), or "T" or "TiB" for + tebibytes (1,099,511,627,776). However, the value will be + rounded up to the nearest kibibyte by libvirt, and may be + further rounded to the granularity supported by the + hypervisor. As a sanity check, values less than 4000KiB are + not permitted. <span class='since'><code>units</code> since + 0.9.11</span></dd>
As mentioned in https://www.redhat.com/archives/libvir-list/2012-February/msg00969.html , this differs from http://libvirt.org/git/?p=libvirt.git;a=blob;f=docs/formatstorage.html.in;h=... which uses K for kilobytes (different from the 'k' used here, but would be rather confusing to have k and K mean different things), M for megabytes and so on. It would be nice to have the same meaning for the one-letter versions, and to add support for MB/MiB/... to the storage code for consistency. Christophe

On 02/22/2012 09:59 PM, Eric Blake wrote:
Output is still in kibibytes, but input can now be in different scales for ease of typing.
* src/conf/domain_conf.c (virDomainParseMemory): New helper. (virDomainDefParseXML): Use it when parsing. * docs/schemas/domaincommon.rng: Expand XML. * docs/formatdomain.html.in (elementsMemoryAllocation): Document scaling. --- docs/formatdomain.html.in | 39 ++++++++++--- docs/schemas/domaincommon.rng | 4 +- src/conf/domain_conf.c | 129 ++++++++++++++++++++++++++++++++++------ 3 files changed, 142 insertions(+), 30 deletions(-)
self-NACK to v1 - I forgot to add a unit test that exercises the new unit parsing, and...
+ tebibytes (1,099,511,627,776). However, the value will be + rounded up to the nearest kibibyte by libvirt, and may be + further rounded to the granularity supported by the + hypervisor. As a sanity check, values less than 4000KiB are + not permitted.
This statement is not true (I originally tried to make the C code match the RNG, but it caused too many testsuite failures, so I rebased and inserted 2/3 to fix the RNG instead, but forgot to touch this up again). I'll fix that in v2, along with a rename to unit='KiB' instead of units. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

Make it obvious to 'dumpxml' readers what unit we are using, since our default of KiB (1024) differs from qemu's default of MiB. Tests were updated via: $ find tests/*data tests/*out -name '*.xml' | \ xargs sed -i 's/\(<memory\|currentMemory\|hard_limit\|soft_limit\|min_guarantee\|swap_hard_limit\)>/\1 units='"'KiB'>/" followed by a few fixes for the stragglers. * docs/schemas/domaincommon.rng (memoryKBElement): New define; use for memory elements. * src/conf/domain_conf.c (virDomainDefFormatInternal): Add units. * src/conf/domain_conf.h (_virDomainDef): Document unit used internally. * tests/*data/*.xml: Update all tests. * tests/*out/*.xml: Likewise. * tests/define-dev-segfault: Likewise. * tests/openvzutilstest.c (testReadNetworkConf): Likewise. * tests/qemuargv2xmltest.c (blankProblemElements): Likewise. --- Redundant portions of the patch omitted to fix mailing list limits. This email won't apply, but the elided portions should be obvious. docs/schemas/domaincommon.rng | 25 +++++++++++++++---- src/conf/domain_conf.c | 21 ++++++++-------- src/conf/domain_conf.h | 12 ++++---- tests/define-dev-segfault | 4 +- tests/domainschemadata/domain-lxc-simple.xml | 2 +- tests/domainschemadata/portprofile.xml | 2 +- .../qemu-simple-description-title.xml | 4 +- tests/domainschemadata/timers.xml | 4 +- tests/domainsnapshotxml2xmlout/disk_snapshot.xml | 4 +- tests/domainsnapshotxml2xmlout/full_domain.xml | 4 +- tests/domainsnapshotxml2xmlout/metadata.xml | 4 +- tests/openvzutilstest.c | 4 +- tests/qemuargv2xmltest.c | 5 ++- .../qemuxml2argv-balloon-device-auto.xml | 4 +- .../qemuxml2argv-balloon-device.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-bios.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml | 4 +- .../qemuxml2argv-blkiotune-device.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-blkiotune.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml | 4 +- .../qemuxml2argv-boot-complex-bootindex.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-boot-complex.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-boot-floppy.xml | 4 +- ...uxml2argv-boot-menu-disable-drive-bootindex.xml | 4 +- .../qemuxml2argv-boot-menu-disable-drive.xml | 4 +- .../qemuxml2argv-boot-menu-disable.xml | 4 +- .../qemuxml2argv-boot-menu-enable.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-boot-multi.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-boot-network.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-boot-order.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-bootloader.xml | 4 +- .../qemuxml2argv-channel-guestfwd.xml | 4 +- .../qemuxml2argv-channel-spicevmc-old.xml | 2 +- .../qemuxml2argv-channel-spicevmc.xml | 2 +- .../qemuxml2argv-channel-virtio-auto.xml | 4 +- .../qemuxml2argv-channel-virtio.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-clock-france.xml | 4 +- .../qemuxml2argv-clock-localtime.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-clock-utc.xml | 4 +- .../qemuxml2argv-clock-variable.xml | 4 +- .../qemuxml2argv-console-compat-auto.xml | 4 +- .../qemuxml2argv-console-compat-chardev.xml | 4 +- .../qemuxml2argv-console-compat.xml | 4 +- .../qemuxml2argv-console-virtio-many.xml | 4 +- .../qemuxml2argv-console-virtio.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.xml | 4 +- .../qemuxml2argv-cpu-exact2-nofallback.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-cpu-fallback.xml | 4 +- .../qemuxml2argv-cpu-host-kvmclock.xml | 4 +- .../qemuxml2argv-cpu-host-model-fallback.xml | 4 +- .../qemuxml2argv-cpu-host-model-nofallback.xml | 4 +- .../qemuxml2argv-cpu-host-model.xml | 4 +- .../qemuxml2argv-cpu-host-passthrough.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-cpu-kvmclock.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-cpu-minimum1.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-cpu-minimum2.xml | 4 +- .../qemuxml2argv-cpu-nofallback.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-cpu-numa1.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-cpu-numa2.xml | 4 +- .../qemuxml2argv-cpu-qemu-host-passthrough.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-cpu-strict1.xml | 4 +- .../qemuxml2argv-cpu-topology1.xml | 4 +- .../qemuxml2argv-cpu-topology2.xml | 4 +- .../qemuxml2argv-cpu-topology3.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-cputune.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-disk-aio.xml | 4 +- .../qemuxml2argv-disk-cdrom-empty.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.xml | 4 +- .../qemuxml2argv-disk-copy_on_read.xml | 2 +- .../qemuxml2argv-disk-drive-boot-cdrom.xml | 4 +- .../qemuxml2argv-disk-drive-boot-disk.xml | 4 +- .../qemuxml2argv-disk-drive-cache-directsync.xml | 4 +- .../qemuxml2argv-disk-drive-cache-unsafe.xml | 4 +- .../qemuxml2argv-disk-drive-cache-v1-none.xml | 4 +- .../qemuxml2argv-disk-drive-cache-v1-wb.xml | 4 +- .../qemuxml2argv-disk-drive-cache-v1-wt.xml | 4 +- .../qemuxml2argv-disk-drive-cache-v2-none.xml | 4 +- .../qemuxml2argv-disk-drive-cache-v2-wb.xml | 4 +- .../qemuxml2argv-disk-drive-cache-v2-wt.xml | 4 +- ...muxml2argv-disk-drive-error-policy-enospace.xml | 4 +- .../qemuxml2argv-disk-drive-error-policy-stop.xml | 4 +- ...rgv-disk-drive-error-policy-wreport-rignore.xml | 4 +- .../qemuxml2argv-disk-drive-fat.xml | 4 +- .../qemuxml2argv-disk-drive-fmt-qcow.xml | 4 +- .../qemuxml2argv-disk-drive-network-nbd.xml | 4 +- .../qemuxml2argv-disk-drive-network-rbd-auth.xml | 4 +- ...emuxml2argv-disk-drive-network-rbd-ceph-env.xml | 4 +- .../qemuxml2argv-disk-drive-network-rbd.xml | 4 +- .../qemuxml2argv-disk-drive-network-sheepdog.xml | 4 +- .../qemuxml2argv-disk-drive-no-boot.xml | 4 +- .../qemuxml2argv-disk-drive-readonly-disk.xml | 4 +- .../qemuxml2argv-disk-drive-readonly-no-device.xml | 4 +- .../qemuxml2argv-disk-drive-shared.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-disk-floppy.xml | 4 +- .../qemuxml2argv-disk-ioeventfd.xml | 2 +- tests/qemuxml2argvdata/qemuxml2argv-disk-many.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-disk-order.xml | 4 +- .../qemuxml2argv-disk-sata-device.xml | 4 +- .../qemuxml2argv-disk-scsi-device-auto.xml | 4 +- .../qemuxml2argv-disk-scsi-device.xml | 4 +- .../qemuxml2argv-disk-snapshot.xml | 4 +- .../qemuxml2argv-disk-transient.xml | 4 +- .../qemuxml2argv-disk-usb-device.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-disk-usb.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-disk-virtio.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-disk-xenvbd.xml | 4 +- .../qemuxml2argv-encrypted-disk.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-event_idx.xml | 4 +- .../qemuxml2argv-floppy-drive-fat.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-fs9p.xml | 4 +- .../qemuxml2argv-graphics-listen-network.xml | 4 +- .../qemuxml2argv-graphics-listen-network2.xml | 4 +- .../qemuxml2argv-graphics-sdl-fullscreen.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml | 4 +- .../qemuxml2argv-graphics-spice-compression.xml | 4 +- .../qemuxml2argv-graphics-spice-qxl-vga.xml | 4 +- .../qemuxml2argv-graphics-spice-timeout.xml | 4 +- .../qemuxml2argv-graphics-spice.xml | 4 +- .../qemuxml2argv-graphics-vnc-sasl.xml | 4 +- .../qemuxml2argv-graphics-vnc-socket.xml | 4 +- .../qemuxml2argv-graphics-vnc-tls.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml | 4 +- .../qemuxml2argv-hostdev-pci-address-device.xml | 4 +- .../qemuxml2argv-hostdev-pci-address.xml | 4 +- .../qemuxml2argv-hostdev-usb-address-device.xml | 4 +- .../qemuxml2argv-hostdev-usb-address.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-hugepages.xml | 4 +- .../qemuxml2argv-input-usbmouse-addr.xml | 4 +- .../qemuxml2argv-input-usbmouse.xml | 4 +- .../qemuxml2argv-input-usbtablet.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-input-xen.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-kvmclock.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-lease.xml | 4 +- .../qemuxml2argv-machine-aliases1.xml | 4 +- .../qemuxml2argv-machine-aliases2.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-memtune.xml | 10 ++++---- tests/qemuxml2argvdata/qemuxml2argv-metadata.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-migrate.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-minimal.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.xml | 4 +- .../qemuxml2argv-misc-no-reboot.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-misc-uuid.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-monitor-json.xml | 4 +- .../qemuxml2argv-multifunction-pci-device.xml | 4 +- .../qemuxml2argv-net-bandwidth.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-net-client.xml | 4 +- .../qemuxml2argv-net-eth-ifname.xml | 4 +- .../qemuxml2argv-net-eth-names.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-net-eth.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-net-mcast.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-net-server.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-net-user.xml | 4 +- .../qemuxml2argv-net-virtio-device.xml | 4 +- .../qemuxml2argv-net-virtio-netdev.xml | 4 +- .../qemuxml2argv-net-virtio-network-portgroup.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-net-virtio.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-no-shutdown.xml | 4 +- .../qemuxml2argv-nographics-vga.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-nographics.xml | 4 +- .../qemuxml2argv-numatune-memory.xml | 4 +- .../qemuxml2argv-parallel-tcp-chardev.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-pci-rom.xml | 4 +- .../qemuxml2argv-pseries-basic.xml | 2 +- .../qemuxml2argv-pseries-vio-address-clash.xml | 2 +- .../qemuxml2argv-pseries-vio-user-assigned.xml | 2 +- .../qemuxml2argvdata/qemuxml2argv-pseries-vio.xml | 2 +- .../qemuxml2argv-qemu-ns-no-env.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-qemu-ns.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-restore-v1.xml | 4 +- .../qemuxml2argv-restore-v2-fd.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-restore-v2.xml | 4 +- .../qemuxml2argv-seclabel-dynamic-baselabel.xml | 4 +- .../qemuxml2argv-seclabel-dynamic-override.xml | 4 +- .../qemuxml2argv-seclabel-dynamic.xml | 4 +- .../qemuxml2argv-seclabel-none.xml | 4 +- .../qemuxml2argv-seclabel-static-relabel.xml | 4 +- .../qemuxml2argv-seclabel-static.xml | 4 +- .../qemuxml2argv-serial-dev-chardev.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-serial-dev.xml | 4 +- .../qemuxml2argv-serial-file-chardev.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-serial-file.xml | 4 +- .../qemuxml2argv-serial-many-chardev.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-serial-many.xml | 4 +- .../qemuxml2argv-serial-pty-chardev.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-serial-pty.xml | 4 +- .../qemuxml2argv-serial-target-port-auto.xml | 4 +- .../qemuxml2argv-serial-tcp-chardev.xml | 4 +- .../qemuxml2argv-serial-tcp-telnet-chardev.xml | 4 +- .../qemuxml2argv-serial-tcp-telnet.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.xml | 4 +- .../qemuxml2argv-serial-udp-chardev.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml | 4 +- .../qemuxml2argv-serial-unix-chardev.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-serial-unix.xml | 4 +- .../qemuxml2argv-serial-vc-chardev.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-serial-vc.xml | 4 +- .../qemuxml2argv-smartcard-controller.xml | 4 +- .../qemuxml2argv-smartcard-host-certificates.xml | 4 +- .../qemuxml2argv-smartcard-host.xml | 4 +- ...qemuxml2argv-smartcard-passthrough-spicevmc.xml | 4 +- .../qemuxml2argv-smartcard-passthrough-tcp.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-smbios.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-smp.xml | 4 +- .../qemuxml2argvdata/qemuxml2argv-sound-device.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-sound.xml | 4 +- .../qemuxml2argv-usb-controller.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-usb-hub.xml | 4 +- .../qemuxml2argv-usb-ich9-companion.xml | 4 +- .../qemuxml2argv-usb-ich9-ehci-addr.xml | 4 +- .../qemuxml2argv-usb-piix3-controller.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-usb-ports.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-virtio-lun.xml | 4 +- .../qemuxml2argv-watchdog-device.xml | 4 +- .../qemuxml2argv-watchdog-dump.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-watchdog.xml | 4 +- .../qemuxml2xmlout-balloon-device-auto.xml | 4 +- .../qemuxml2xmlout-channel-virtio-auto.xml | 4 +- .../qemuxml2xmlout-console-compat-auto.xml | 4 +- .../qemuxml2xmlout-console-virtio.xml | 4 +- .../qemuxml2xmlout-disk-cdrom-empty.xml | 4 +- .../qemuxml2xmlout-disk-scsi-device-auto.xml | 4 +- .../qemuxml2xmlout-graphics-listen-network2.xml | 4 +- .../qemuxml2xmlout-graphics-spice-timeout.xml | 4 +- .../qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml | 4 +- .../qemuxml2xmlout-serial-target-port-auto.xml | 4 +- .../qemuxmlns-qemu-ns-commandline-ns0.xml | 4 +- .../qemuxmlns-qemu-ns-commandline-ns1.xml | 4 +- .../qemuxmlns-qemu-ns-commandline.xml | 4 +- .../qemuxmlns-qemu-ns-domain-commandline-ns0.xml | 4 +- .../qemuxmlns-qemu-ns-domain-commandline.xml | 4 +- .../qemuxmlnsdata/qemuxmlns-qemu-ns-domain-ns0.xml | 4 +- tests/qemuxmlnsdata/qemuxmlns-qemu-ns-domain.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-boot-grub.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-bridge-ipaddr.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-curmem.xml | 4 +- .../sexpr2xml-disk-block-shareable.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-disk-block.xml | 4 +- .../sexpr2xml-disk-drv-blktap-qcow.xml | 4 +- .../sexpr2xml-disk-drv-blktap-raw.xml | 4 +- .../sexpr2xml-disk-drv-blktap2-raw.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-disk-file.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-legacy-vfb.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-net-ioemu.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml | 4 +- .../sexpr2xml-fv-serial-dev-2-ports.xml | 4 +- .../sexpr2xml-fv-serial-dev-2nd-port.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml | 4 +- .../sexpr2xml-fv-serial-tcp-telnet.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-sound.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-utc.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-v2.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-net-bridged.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-net-e1000.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-net-routed.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-pci-devs.xml | 4 +- .../sexpr2xml-pv-bootloader-cmdline.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-pv-bootloader.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-pv-localtime.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml | 4 +- .../sexpr2xml-pv-vfb-new-vncdisplay.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-pv-vfb-orig.xml | 4 +- .../sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-pv.xml | 4 +- tests/vmx2xmldata/vmx2xml-annotation.xml | 4 +- tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml | 4 +- tests/vmx2xmldata/vmx2xml-case-insensitive-2.xml | 4 +- tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml | 4 +- tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml | 4 +- tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml | 4 +- tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml | 4 +- tests/vmx2xmldata/vmx2xml-esx-in-the-wild-1.xml | 4 +- tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml | 4 +- tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml | 4 +- tests/vmx2xmldata/vmx2xml-esx-in-the-wild-4.xml | 4 +- tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml | 6 ++-- tests/vmx2xmldata/vmx2xml-esx-in-the-wild-6.xml | 4 +- tests/vmx2xmldata/vmx2xml-ethernet-bridged.xml | 4 +- tests/vmx2xmldata/vmx2xml-ethernet-custom.xml | 4 +- tests/vmx2xmldata/vmx2xml-ethernet-e1000.xml | 4 +- tests/vmx2xmldata/vmx2xml-ethernet-generated.xml | 4 +- tests/vmx2xmldata/vmx2xml-ethernet-other.xml | 4 +- tests/vmx2xmldata/vmx2xml-ethernet-static.xml | 4 +- tests/vmx2xmldata/vmx2xml-ethernet-vmxnet2.xml | 4 +- tests/vmx2xmldata/vmx2xml-ethernet-vpx.xml | 4 +- tests/vmx2xmldata/vmx2xml-floppy-device.xml | 4 +- tests/vmx2xmldata/vmx2xml-floppy-file.xml | 4 +- tests/vmx2xmldata/vmx2xml-graphics-vnc.xml | 4 +- tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-1.xml | 4 +- tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-2.xml | 4 +- tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-3.xml | 4 +- tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-4.xml | 4 +- tests/vmx2xmldata/vmx2xml-harddisk-ide-file.xml | 4 +- tests/vmx2xmldata/vmx2xml-harddisk-scsi-file.xml | 4 +- tests/vmx2xmldata/vmx2xml-minimal-64bit.xml | 4 +- tests/vmx2xmldata/vmx2xml-minimal.xml | 4 +- tests/vmx2xmldata/vmx2xml-parallel-device.xml | 4 +- tests/vmx2xmldata/vmx2xml-parallel-file.xml | 4 +- tests/vmx2xmldata/vmx2xml-scsi-driver.xml | 4 +- tests/vmx2xmldata/vmx2xml-scsi-writethrough.xml | 4 +- tests/vmx2xmldata/vmx2xml-serial-device.xml | 4 +- tests/vmx2xmldata/vmx2xml-serial-file.xml | 4 +- .../vmx2xmldata/vmx2xml-serial-network-client.xml | 4 +- .../vmx2xmldata/vmx2xml-serial-network-server.xml | 4 +- tests/vmx2xmldata/vmx2xml-serial-pipe.xml | 4 +- tests/vmx2xmldata/vmx2xml-smbios.xml | 4 +- tests/vmx2xmldata/vmx2xml-svga.xml | 4 +- tests/xmconfigdata/sexpr2xml-pv-bootloader.xml | 4 +- tests/xmconfigdata/test-escape-paths.xml | 4 +- tests/xmconfigdata/test-fullvirt-force-hpet.xml | 4 +- tests/xmconfigdata/test-fullvirt-force-nohpet.xml | 4 +- tests/xmconfigdata/test-fullvirt-localtime.xml | 4 +- tests/xmconfigdata/test-fullvirt-net-ioemu.xml | 4 +- tests/xmconfigdata/test-fullvirt-net-netfront.xml | 4 +- tests/xmconfigdata/test-fullvirt-new-cdrom.xml | 4 +- tests/xmconfigdata/test-fullvirt-old-cdrom.xml | 4 +- tests/xmconfigdata/test-fullvirt-parallel-tcp.xml | 4 +- .../test-fullvirt-serial-dev-2-ports.xml | 4 +- .../test-fullvirt-serial-dev-2nd-port.xml | 4 +- tests/xmconfigdata/test-fullvirt-serial-file.xml | 4 +- tests/xmconfigdata/test-fullvirt-serial-null.xml | 4 +- tests/xmconfigdata/test-fullvirt-serial-pipe.xml | 4 +- tests/xmconfigdata/test-fullvirt-serial-pty.xml | 4 +- tests/xmconfigdata/test-fullvirt-serial-stdio.xml | 4 +- .../test-fullvirt-serial-tcp-telnet.xml | 4 +- tests/xmconfigdata/test-fullvirt-serial-tcp.xml | 4 +- tests/xmconfigdata/test-fullvirt-serial-udp.xml | 4 +- tests/xmconfigdata/test-fullvirt-serial-unix.xml | 4 +- tests/xmconfigdata/test-fullvirt-sound.xml | 4 +- tests/xmconfigdata/test-fullvirt-usbmouse.xml | 4 +- .../test-fullvirt-usbtablet-no-bus.xml | 4 +- tests/xmconfigdata/test-fullvirt-usbtablet.xml | 4 +- tests/xmconfigdata/test-fullvirt-utc.xml | 4 +- tests/xmconfigdata/test-no-source-cdrom.xml | 4 +- tests/xmconfigdata/test-paravirt-net-e1000.xml | 4 +- tests/xmconfigdata/test-paravirt-net-vifname.xml | 4 +- .../test-paravirt-new-pvfb-vncdisplay.xml | 4 +- tests/xmconfigdata/test-paravirt-new-pvfb.xml | 4 +- .../test-paravirt-old-pvfb-vncdisplay.xml | 4 +- tests/xmconfigdata/test-paravirt-old-pvfb.xml | 4 +- tests/xmconfigdata/test-paravirt-vcpu.xml | 4 +- tests/xmconfigdata/test-pci-devs.xml | 4 +- tests/xml2sexprdata/xml2sexpr-boot-grub.xml | 2 +- tests/xml2sexprdata/xml2sexpr-bridge-ipaddr.xml | 2 +- tests/xml2sexprdata/xml2sexpr-curmem.xml | 4 +- .../xml2sexpr-disk-block-shareable.xml | 4 +- tests/xml2sexprdata/xml2sexpr-disk-block.xml | 2 +- tests/xml2sexprdata/xml2sexpr-disk-drv-blkback.xml | 2 +- .../xml2sexpr-disk-drv-blktap-qcow.xml | 2 +- .../xml2sexpr-disk-drv-blktap-raw.xml | 2 +- tests/xml2sexprdata/xml2sexpr-disk-drv-blktap.xml | 2 +- .../xml2sexpr-disk-drv-blktap2-raw.xml | 2 +- tests/xml2sexprdata/xml2sexpr-disk-drv-blktap2.xml | 2 +- tests/xml2sexprdata/xml2sexpr-disk-drv-loop.xml | 2 +- tests/xml2sexprdata/xml2sexpr-disk-file.xml | 2 +- tests/xml2sexprdata/xml2sexpr-escape.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-force-hpet.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-force-nohpet.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-kernel.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-localtime.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-net-ioemu.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-net-netfront.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-parallel-tcp.xml | 2 +- .../xml2sexpr-fv-serial-dev-2-ports.xml | 2 +- .../xml2sexpr-fv-serial-dev-2nd-port.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-serial-file.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-serial-null.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-serial-pipe.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-serial-pty.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-serial-stdio.xml | 2 +- .../xml2sexpr-fv-serial-tcp-telnet.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-serial-tcp.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-serial-udp.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-serial-unix.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-sound.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-usbmouse.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-usbtablet.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-utc.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv-vncunused.xml | 2 +- tests/xml2sexprdata/xml2sexpr-fv.xml | 2 +- tests/xml2sexprdata/xml2sexpr-net-bridged.xml | 2 +- tests/xml2sexprdata/xml2sexpr-net-e1000.xml | 2 +- tests/xml2sexprdata/xml2sexpr-net-routed.xml | 2 +- tests/xml2sexprdata/xml2sexpr-no-source-cdrom.xml | 4 +- tests/xml2sexprdata/xml2sexpr-pci-devs.xml | 2 +- .../xml2sexpr-pv-bootloader-cmdline.xml | 2 +- tests/xml2sexprdata/xml2sexpr-pv-bootloader.xml | 2 +- tests/xml2sexprdata/xml2sexpr-pv-localtime.xml | 4 +- tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml | 2 +- tests/xml2sexprdata/xml2sexpr-pv-vfb-new-auto.xml | 2 +- tests/xml2sexprdata/xml2sexpr-pv-vfb-new.xml | 2 +- tests/xml2sexprdata/xml2sexpr-pv-vfb-orig.xml | 2 +- tests/xml2sexprdata/xml2sexpr-pv.xml | 2 +- tests/xml2vmxdata/xml2vmx-annotation.xml | 2 +- tests/xml2vmxdata/xml2vmx-cdrom-ide-device.xml | 2 +- tests/xml2vmxdata/xml2vmx-cdrom-ide-file.xml | 2 +- tests/xml2vmxdata/xml2vmx-cdrom-scsi-device.xml | 2 +- tests/xml2vmxdata/xml2vmx-cdrom-scsi-file.xml | 2 +- tests/xml2vmxdata/xml2vmx-esx-in-the-wild-1.xml | 4 +- tests/xml2vmxdata/xml2vmx-esx-in-the-wild-2.xml | 4 +- tests/xml2vmxdata/xml2vmx-esx-in-the-wild-3.xml | 4 +- tests/xml2vmxdata/xml2vmx-esx-in-the-wild-4.xml | 4 +- tests/xml2vmxdata/xml2vmx-esx-in-the-wild-5.xml | 6 ++-- tests/xml2vmxdata/xml2vmx-esx-in-the-wild-6.xml | 4 +- tests/xml2vmxdata/xml2vmx-ethernet-bridged.xml | 2 +- tests/xml2vmxdata/xml2vmx-ethernet-custom.xml | 2 +- tests/xml2vmxdata/xml2vmx-ethernet-e1000.xml | 2 +- tests/xml2vmxdata/xml2vmx-ethernet-generated.xml | 2 +- tests/xml2vmxdata/xml2vmx-ethernet-other.xml | 2 +- tests/xml2vmxdata/xml2vmx-ethernet-static.xml | 2 +- tests/xml2vmxdata/xml2vmx-ethernet-vmxnet2.xml | 2 +- tests/xml2vmxdata/xml2vmx-ethernet-vpx.xml | 2 +- tests/xml2vmxdata/xml2vmx-floppy-device.xml | 2 +- tests/xml2vmxdata/xml2vmx-floppy-file.xml | 2 +- tests/xml2vmxdata/xml2vmx-graphics-vnc.xml | 2 +- tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-1.xml | 4 +- tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-2.xml | 4 +- tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-3.xml | 4 +- tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-4.xml | 4 +- tests/xml2vmxdata/xml2vmx-harddisk-ide-file.xml | 2 +- tests/xml2vmxdata/xml2vmx-harddisk-scsi-file.xml | 2 +- tests/xml2vmxdata/xml2vmx-minimal-64bit.xml | 2 +- tests/xml2vmxdata/xml2vmx-minimal.xml | 2 +- tests/xml2vmxdata/xml2vmx-parallel-device.xml | 2 +- tests/xml2vmxdata/xml2vmx-parallel-file.xml | 2 +- tests/xml2vmxdata/xml2vmx-scsi-driver.xml | 2 +- tests/xml2vmxdata/xml2vmx-scsi-writethrough.xml | 2 +- tests/xml2vmxdata/xml2vmx-serial-device.xml | 2 +- tests/xml2vmxdata/xml2vmx-serial-file.xml | 2 +- .../xml2vmxdata/xml2vmx-serial-network-client.xml | 2 +- .../xml2vmxdata/xml2vmx-serial-network-server.xml | 2 +- tests/xml2vmxdata/xml2vmx-serial-pipe.xml | 2 +- tests/xml2vmxdata/xml2vmx-smbios.xml | 2 +- tests/xml2vmxdata/xml2vmx-svga.xml | 2 +- 457 files changed, 862 insertions(+), 847 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index e276a92..6b62f73 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -412,11 +412,11 @@ <define name="resources"> <interleave> <element name="memory"> - <ref name="memoryKB"/> + <ref name="memoryKBElement"/> </element> <optional> <element name="currentMemory"> - <ref name="memoryKB"/> + <ref name="memoryKBElement"/> </element> </optional> <optional> @@ -461,25 +461,25 @@ <!-- Maximum memory the VM can use --> <optional> <element name="hard_limit"> - <ref name="memoryKB"/> + <ref name="memoryKBElement"/> </element> </optional> <!-- Minimum memory ascertained for the VM during contention --> <optional> <element name="soft_limit"> - <ref name="memoryKB"/> + <ref name="memoryKBElement"/> </element> </optional> <!-- Minimum amount of memory required to start the VM --> <optional> <element name="min_guarantee"> - <ref name="memoryKB"/> + <ref name="memoryKBElement"/> </element> </optional> <!-- Maximum swap area the VM can use --> <optional> <element name="swap_hard_limit"> - <ref name="memoryKB"/> + <ref name="memoryKBElement"/> </element> </optional> </element> @@ -3072,12 +3072,25 @@ <param name="maxInclusive">1000</param> </data> </define> + <!-- Memory as an attribute is in KiB, no way to express a unit --> <define name="memoryKB"> <data type="unsignedInt"> <param name="pattern">[0-9]+</param> <param name="minInclusive">4000</param> </data> </define> + <!-- Memory as an element, with optional units attribute --> + <define name='memoryKBElement'> + <optional> + <attribute name='units'> + <value>KiB</value> + </attribute> + </optional> + <data type='unsignedInt'> + <param name='pattern'>[0-9]+</param> + <param name='minInclusive'>4000</param> + </data> + </define> <define name="domainName"> <data type="string"> <!-- Use literal newline instead of \n for bug in libxml2 2.7.6 --> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b0c3fa6..07565bc 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11610,8 +11610,9 @@ virDomainDefFormatInternal(virDomainDefPtr def, xmlIndentTreeOutput = oldIndentTreeOutput; } - virBufferAsprintf(buf, " <memory>%lu</memory>\n", def->mem.max_balloon); - virBufferAsprintf(buf, " <currentMemory>%lu</currentMemory>\n", + virBufferAsprintf(buf, " <memory units='KiB'>%lu</memory>\n", + def->mem.max_balloon); + virBufferAsprintf(buf, " <currentMemory units='KiB'>%lu</currentMemory>\n", def->mem.cur_balloon); /* add blkiotune only if there are any */ @@ -11652,20 +11653,20 @@ virDomainDefFormatInternal(virDomainDefPtr def, def->mem.swap_hard_limit) virBufferAddLit(buf, " <memtune>\n"); if (def->mem.hard_limit) { - virBufferAsprintf(buf, " <hard_limit>%lu</hard_limit>\n", - def->mem.hard_limit); + virBufferAsprintf(buf, " <hard_limit units='KiB'>" + "%lu</hard_limit>\n", def->mem.hard_limit); } if (def->mem.soft_limit) { - virBufferAsprintf(buf, " <soft_limit>%lu</soft_limit>\n", - def->mem.soft_limit); + virBufferAsprintf(buf, " <soft_limit units='KiB'>" + "%lu</soft_limit>\n", def->mem.soft_limit); } if (def->mem.min_guarantee) { - virBufferAsprintf(buf, " <min_guarantee>%lu</min_guarantee>\n", - def->mem.min_guarantee); + virBufferAsprintf(buf, " <min_guarantee units='KiB'>" + "%lu</min_guarantee>\n", def->mem.min_guarantee); } if (def->mem.swap_hard_limit) { - virBufferAsprintf(buf, " <swap_hard_limit>%lu</swap_hard_limit>\n", - def->mem.swap_hard_limit); + virBufferAsprintf(buf, " <swap_hard_limit units='KiB'>" + "%lu</swap_hard_limit>\n", def->mem.swap_hard_limit); } if (def->mem.hard_limit || def->mem.soft_limit || def->mem.min_guarantee || def->mem.swap_hard_limit) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 9c8792a..3103a49 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1451,13 +1451,13 @@ struct _virDomainDef { } blkio; struct { - unsigned long max_balloon; - unsigned long cur_balloon; + unsigned long max_balloon; /* in kibibytes */ + unsigned long cur_balloon; /* in kibibytes */ unsigned long hugepage_backed; - unsigned long hard_limit; - unsigned long soft_limit; - unsigned long min_guarantee; - unsigned long swap_hard_limit; + unsigned long hard_limit; /* in kibibytes */ + unsigned long soft_limit; /* in kibibytes */ + unsigned long min_guarantee; /* in kibibytes */ + unsigned long swap_hard_limit; /* in kibibytes */ } mem; unsigned short vcpus; unsigned short maxvcpus; diff --git a/tests/define-dev-segfault b/tests/define-dev-segfault index 0a0532b..3ddd6b6 100755 --- a/tests/define-dev-segfault +++ b/tests/define-dev-segfault @@ -20,8 +20,8 @@ cat <<\EOF > D.xml || fail=1 <domain type='test'> <name>D</name> <uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid> - <memory>262144</memory> - <currentMemory>262144</currentMemory> + <memory units='KiB'>262144</memory> + <currentMemory units='KiB'>262144</currentMemory> <vcpu>1</vcpu> <os> <type arch='i686' machine='pc'>hvm</type> diff --git a/tests/domainschemadata/domain-lxc-simple.xml b/tests/domainschemadata/domain-lxc-simple.xml index 653bbc7..e1c1dc1 100644 --- a/tests/domainschemadata/domain-lxc-simple.xml +++ b/tests/domainschemadata/domain-lxc-simple.xml @@ -5,7 +5,7 @@ <type>exe</type> <init>/sh</init> </os> - <memory>500000</memory> + <memory units='KiB'>500000</memory> <devices> <filesystem type='mount'> <source dir='/root/container'/> diff --git a/tests/domainschemadata/portprofile.xml b/tests/domainschemadata/portprofile.xml index e51301d..c549699 100644 --- a/tests/domainschemadata/portprofile.xml ... diff --git a/tests/openvzutilstest.c b/tests/openvzutilstest.c index 7f5ddc9..5b8c3fa 100644 --- a/tests/openvzutilstest.c +++ b/tests/openvzutilstest.c @@ -78,8 +78,8 @@ testReadNetworkConf(const void *data ATTRIBUTE_UNUSED) const char *expected = "<domain type='openvz'>\n" " <uuid>00000000-0000-0000-0000-000000000000</uuid>\n" - " <memory>0</memory>\n" - " <currentMemory>0</currentMemory>\n" + " <memory units='KiB'>0</memory>\n" + " <currentMemory units='KiB'>0</currentMemory>\n" " <vcpu>0</vcpu>\n" " <os>\n" " <type>exe</type>\n" diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c index 51f5aed..e13b87a 100644 --- a/tests/qemuargv2xmltest.c +++ b/tests/qemuargv2xmltest.c @@ -22,8 +22,9 @@ static int blankProblemElements(char *data) { if (virtTestClearLineRegex("<name>[[:alnum:]]+</name>", data) < 0 || virtTestClearLineRegex("<uuid>([[:alnum:]]|-)+</uuid>", data) < 0 || - virtTestClearLineRegex("<memory>[[:digit:]]+</memory>", data) < 0 || - virtTestClearLineRegex("<currentMemory>[[:digit:]]+</currentMemory>", data) < 0 || + virtTestClearLineRegex("<memory.*>[[:digit:]]+</memory>", data) < 0 || + virtTestClearLineRegex("<currentMemory.*>[[:digit:]]+</currentMemory>", + data) < 0 || virtTestClearLineRegex("<readonly/>", data) < 0 || virtTestClearLineRegex("<sharable/>", data) < 0) return -1; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-auto.xml b/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-auto.xml index 9315621..503b92b 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-auto.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-balloon-device-auto.xml @@ -1,8 +1,8 @@ <domain type='qemu'> <name>QEMUGuest1</name> <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> - <memory>219100</memory> - <currentMemory>219100</currentMemory> + <memory units='KiB'>219100</memory> + <currentMemory units='KiB'>219100</currentMemory> <vcpu>1</vcpu> <os> <type arch='i686' machine='pc'>hvm</type> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-balloon-device.xml b/tests/qemuxml2argvdata/qemuxml2argv-balloon-device.xml index 8ac3c09..ffe459d 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-balloon-device.xml ... diff --git a/tests/xml2vmxdata/xml2vmx-svga.xml b/tests/xml2vmxdata/xml2vmx-svga.xml index b7db4c8..9f93ef9 100644 --- a/tests/xml2vmxdata/xml2vmx-svga.xml +++ b/tests/xml2vmxdata/xml2vmx-svga.xml @@ -1,7 +1,7 @@ <domain type='vmware'> <name>minimal</name> <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> - <memory>4096</memory> + <memory units='KiB'>4096</memory> <os> <type>hvm</type> </os> -- 1.7.7.6

2012/2/23 Eric Blake <eblake@redhat.com>:
Make it obvious to 'dumpxml' readers what unit we are using, since our default of KiB (1024) differs from qemu's default of MiB.
diff --git a/tests/xml2vmxdata/xml2vmx-svga.xml b/tests/xml2vmxdata/xml2vmx-svga.xml index b7db4c8..9f93ef9 100644 --- a/tests/xml2vmxdata/xml2vmx-svga.xml +++ b/tests/xml2vmxdata/xml2vmx-svga.xml @@ -1,7 +1,7 @@ <domain type='vmware'> <name>minimal</name> <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> - <memory>4096</memory> + <memory units='KiB'>4096</memory> <os> <type>hvm</type> </os>
Good idea, but why did you decide to name the attribute "units" (plural) instead of "unit"? As a value can only have one unit the attribute name "units" is misleading. -- Matthias Bolte http://photron.blogspot.com

On Thu, Feb 23, 2012 at 08:56:50AM +0100, Matthias Bolte wrote:
2012/2/23 Eric Blake <eblake@redhat.com>:
Make it obvious to 'dumpxml' readers what unit we are using, since our default of KiB (1024) differs from qemu's default of MiB.
diff --git a/tests/xml2vmxdata/xml2vmx-svga.xml b/tests/xml2vmxdata/xml2vmx-svga.xml index b7db4c8..9f93ef9 100644 --- a/tests/xml2vmxdata/xml2vmx-svga.xml +++ b/tests/xml2vmxdata/xml2vmx-svga.xml @@ -1,7 +1,7 @@ <domain type='vmware'> <name>minimal</name> <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> - <memory>4096</memory> + <memory units='KiB'>4096</memory> <os> <type>hvm</type> </os>
Good idea, but why did you decide to name the attribute "units" (plural) instead of "unit"? As a value can only have one unit the attribute name "units" is misleading.
Agreed, especially since <volume><allocation> already uses "unit" Christophe

On 02/23/2012 02:55 AM, Christophe Fergeau wrote:
On Thu, Feb 23, 2012 at 08:56:50AM +0100, Matthias Bolte wrote:
2012/2/23 Eric Blake <eblake@redhat.com>:
Make it obvious to 'dumpxml' readers what unit we are using, since our default of KiB (1024) differs from qemu's default of MiB.
diff --git a/tests/xml2vmxdata/xml2vmx-svga.xml b/tests/xml2vmxdata/xml2vmx-svga.xml index b7db4c8..9f93ef9 100644 --- a/tests/xml2vmxdata/xml2vmx-svga.xml +++ b/tests/xml2vmxdata/xml2vmx-svga.xml @@ -1,7 +1,7 @@ <domain type='vmware'> <name>minimal</name> <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> - <memory>4096</memory> + <memory units='KiB'>4096</memory> <os> <type>hvm</type> </os>
Good idea, but why did you decide to name the attribute "units" (plural) instead of "unit"? As a value can only have one unit the attribute name "units" is misleading.
Agreed, especially since <volume><allocation> already uses "unit"
Eek. conf/storage_conf.c is using 'k' as 1024, but documenting it as kilobyte in formatstorage.html.in. Yes, I can make the code for unit parsing shared between the two; for consistency, the one letter suffix will be the power of 2, the two letter with B suffix is power of 10, and the three letter with iB suffix is power of 2 (this is how coreutils does it, by the way, so it's not that unusual). That means some refactoring - moving the unit parsing code into a shared location that both storage_conf and domain_conf can use. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Christophe Fergeau
-
Eric Blake
-
Matthias Bolte