[PATCHv2 05/15] xml: output memory unit for clarity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make it obvious to 'dumpxml' readers what unit we are using,
since our default of KiB for memory (1024) differs from
qemu's default of MiB; while we use bytes for storage.

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 unit='"'KiB'>/"
$ find tests/*data tests/*out -name '*.xml' | \
  xargs sed -i 's/<\(capacity\|allocation\|available\)>/<\1 unit='"'bytes'>/"

followed by a few fixes for the stragglers.

* docs/schemas/basictypes.rng (unit): Add 'bytes'.
(scaledInteger): New define.
* docs/schemas/storagevol.rng (sizing): Use it.
* docs/schemas/storagepool.rng (sizing): Likewise.
* docs/schemas/domaincommon.rng (memoryKBElement): New define; use
for memory elements.
* src/conf/storage_conf.c (virStoragePoolDefFormat)
(virStorageVolDefFormat): Likewise.
* src/conf/domain_conf.h (_virDomainDef): Document unit used
internally.
* src/conf/storage_conf.h (_virStoragePoolDef, _virStorageVolDef):
Likewise.
* 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.
---

corresponds to memory v1 1/3;
v2: also output units for storage, use 'unit=' not 'units=', use common RNG

Portions of this patch elided to reduce mail size; see cover letter
for git repo to see entire patch.

 docs/schemas/basictypes.rng                        |   10 +++++++-
 docs/schemas/domaincommon.rng                      |   25 +++++++++++++++----
 docs/schemas/storagepool.rng                       |    6 ++--
 docs/schemas/storagevol.rng                        |   14 +---------
 src/conf/domain_conf.c                             |   21 ++++++++--------
 src/conf/domain_conf.h                             |   12 ++++----
 src/conf/storage_conf.c                            |   12 ++++----
 src/conf/storage_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-scsi-virtio-scsi.xml         |    4 +-
 .../qemuxml2argv-disk-scsi-vscsi.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/storagepoolxml2xmlout/pool-dir.xml           |    6 ++--
 tests/storagepoolxml2xmlout/pool-disk.xml          |    6 ++--
 tests/storagepoolxml2xmlout/pool-fs.xml            |    6 ++--
 tests/storagepoolxml2xmlout/pool-iscsi-auth.xml    |    6 ++--
 .../storagepoolxml2xmlout/pool-iscsi-multiiqn.xml  |    6 ++--
 .../pool-iscsi-vendor-product.xml                  |    6 ++--
 tests/storagepoolxml2xmlout/pool-iscsi.xml         |    6 ++--
 .../storagepoolxml2xmlout/pool-logical-create.xml  |    6 ++--
 tests/storagepoolxml2xmlout/pool-logical.xml       |    6 ++--
 tests/storagepoolxml2xmlout/pool-mpath.xml         |    6 ++--
 tests/storagepoolxml2xmlout/pool-netfs.xml         |    6 ++--
 tests/storagepoolxml2xmlout/pool-scsi.xml          |    6 ++--
 tests/storagevolxml2xmlout/vol-file-backing.xml    |    4 +-
 tests/storagevolxml2xmlout/vol-file.xml            |    4 +-
 tests/storagevolxml2xmlout/vol-logical-backing.xml |    4 +-
 tests/storagevolxml2xmlout/vol-logical.xml         |    4 +-
 tests/storagevolxml2xmlout/vol-partition.xml       |    4 +-
 tests/storagevolxml2xmlout/vol-qcow2.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-nat.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/vmx2xmldata/vmx2xml-ws-in-the-wild-1.xml     |    4 +-
 tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.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 +-
 485 files changed, 946 insertions(+), 933 deletions(-)

diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng
index 4f16fa7..a50349c 100644
--- a/docs/schemas/basictypes.rng
+++ b/docs/schemas/basictypes.rng
@@ -140,8 +140,16 @@

   <define name='unit'>
     <data type='string'>
-      <param name='pattern'>[kKmMgGtTpPeE]</param>
+      <param name='pattern'>(bytes)|[kKmMgGtTpPeE]</param>
     </data>
   </define>
+  <define name='scaledInteger'>
+    <optional>
+      <attribute name='unit'>
+        <ref name='unit'/>
+      </attribute>
+    </optional>
+    <ref name='unsignedLong'/>
+  </define>

 </grammar>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 3908733..c8b403e 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>
@@ -3079,12 +3079,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 unit attribute -->
+  <define name='memoryKBElement'>
+    <optional>
+      <attribute name='unit'>
+        <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/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng
index 6399f12..d4c80da 100644
--- a/docs/schemas/storagepool.rng
+++ b/docs/schemas/storagepool.rng
@@ -136,17 +136,17 @@
   <define name='sizing'>
     <optional>
       <element name='capacity'>
-        <ref name='unsignedLong'/>
+        <ref name='scaledInteger'/>
       </element>
     </optional>
     <optional>
       <element name='allocation'>
-        <ref name='unsignedLong'/>
+        <ref name='scaledInteger'/>
       </element>
     </optional>
     <optional>
       <element name='available'>
-        <ref name='unsignedLong'/>
+        <ref name='scaledInteger'/>
       </element>
     </optional>
   </define>
diff --git a/docs/schemas/storagevol.rng b/docs/schemas/storagevol.rng
index d06884c..8edb877 100644
--- a/docs/schemas/storagevol.rng
+++ b/docs/schemas/storagevol.rng
@@ -32,22 +32,12 @@
   <define name='sizing'>
     <optional>
       <element name='capacity'>
-        <optional>
-          <attribute name='unit'>
-            <ref name='unit'/>
-          </attribute>
-        </optional>
-        <ref name='unsignedLong'/>
+        <ref name='scaledInteger'/>
       </element>
     </optional>
     <optional>
       <element name='allocation'>
-        <optional>
-          <attribute name='unit'>
-            <ref name='unit'/>
-          </attribute>
-        </optional>
-        <ref name='unsignedLong'/>
+        <ref name='scaledInteger'/>
       </element>
     </optional>
   </define>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f9654f1..331d923 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11638,8 +11638,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 unit='KiB'>%lu</memory>\n",
+                      def->mem.max_balloon);
+    virBufferAsprintf(buf, "  <currentMemory unit='KiB'>%lu</currentMemory>\n",
                       def->mem.cur_balloon);

     /* add blkiotune only if there are any */
@@ -11680,20 +11681,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 unit='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 unit='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 unit='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 unit='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 d98a551..2aa489d 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1454,13 +1454,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/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 87f3d6a..07f3f5b 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1,7 +1,7 @@
 /*
  * storage_conf.c: config handling for storage driver
  *
- * Copyright (C) 2006-2011 Red Hat, Inc.
+ * Copyright (C) 2006-2012 Red Hat, Inc.
  * Copyright (C) 2006-2008 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -897,11 +897,11 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def) {
     virUUIDFormat(def->uuid, uuid);
     virBufferAsprintf(&buf,"  <uuid>%s</uuid>\n", uuid);

-    virBufferAsprintf(&buf,"  <capacity>%llu</capacity>\n",
+    virBufferAsprintf(&buf,"  <capacity unit='bytes'>%llu</capacity>\n",
                       def->capacity);
-    virBufferAsprintf(&buf,"  <allocation>%llu</allocation>\n",
+    virBufferAsprintf(&buf,"  <allocation unit='bytes'>%llu</allocation>\n",
                       def->allocation);
-    virBufferAsprintf(&buf,"  <available>%llu</available>\n",
+    virBufferAsprintf(&buf,"  <available unit='bytes'>%llu</available>\n",
                       def->available);

     if (virStoragePoolSourceFormat(&buf, options, &def->source) < 0)
@@ -1262,9 +1262,9 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool,
     }
     virBufferAddLit(&buf, "  </source>\n");

-    virBufferAsprintf(&buf,"  <capacity>%llu</capacity>\n",
+    virBufferAsprintf(&buf,"  <capacity unit='bytes'>%llu</capacity>\n",
                       def->capacity);
-    virBufferAsprintf(&buf,"  <allocation>%llu</allocation>\n",
+    virBufferAsprintf(&buf,"  <allocation unit='bytes'>%llu</allocation>\n",
                       def->allocation);

     if (virStorageVolTargetDefFormat(options, &buf,
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index dfed0bf..1ef9295 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -1,7 +1,7 @@
 /*
  * storage_conf.h: config handling for storage driver
  *
- * Copyright (C) 2006-2008, 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2006-2008, 2010-2012 Red Hat, Inc.
  * Copyright (C) 2006-2008 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -92,8 +92,8 @@ struct _virStorageVolDef {

     unsigned int building;

-    unsigned long long allocation;
-    unsigned long long capacity;
+    unsigned long long allocation; /* bytes */
+    unsigned long long capacity; /* bytes */

     virStorageVolSource source;
     virStorageVolTarget target;
@@ -262,9 +262,9 @@ struct _virStoragePoolDef {
     unsigned char uuid[VIR_UUID_BUFLEN];
     int type; /* virStoragePoolType */

-    unsigned long long allocation;
-    unsigned long long capacity;
-    unsigned long long available;
+    unsigned long long allocation; /* bytes */
+    unsigned long long capacity; /* bytes */
+    unsigned long long available; /* bytes */

     virStoragePoolSource source;
     virStoragePoolTarget target;
diff --git a/tests/define-dev-segfault b/tests/define-dev-segfault
index 0a0532b..0c37f6d 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 unit='KiB'>262144</memory>
+  <currentMemory unit='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..e61434f 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 unit='KiB'>500000</memory>
     <devices>
         <filesystem type='mount'>
             <source dir='/root/container'/>
...

diff --git a/tests/domainsnapshotxml2xmlout/metadata.xml b/tests/domainsnapshotxml2xmlout/metadata.xml
index 263cbba..1a27773 100644
--- a/tests/domainsnapshotxml2xmlout/metadata.xml
+++ b/tests/domainsnapshotxml2xmlout/metadata.xml
@@ -13,8 +13,8 @@
       <app1:foo xmlns:app1="http://foo.org/";>fooish</app1:foo>
       <app2:bar xmlns:app2="http://bar.com/"; maman="baz">barish</app2:bar>
     </metadata>
-    <memory>219100</memory>
-    <currentMemory>219100</currentMemory>
+    <memory unit='KiB'>219100</memory>
+    <currentMemory unit='KiB'>219100</currentMemory>
     <vcpu cpuset='1-4,8-20,525'>1</vcpu>
     <os>
       <type arch='i686' machine='pc'>hvm</type>
diff --git a/tests/openvzutilstest.c b/tests/openvzutilstest.c
index 7f5ddc9..05121fe 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 unit='KiB'>0</memory>\n"
+        "  <currentMemory unit='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..fc909ae 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 unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
   <vcpu>1</vcpu>
   <os>
     <type arch='i686' machine='pc'>hvm</type>
...

diff --git a/tests/xml2vmxdata/xml2vmx-svga.xml b/tests/xml2vmxdata/xml2vmx-svga.xml
index b7db4c8..1148848 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 unit='KiB'>4096</memory>
   <os>
     <type>hvm</type>
   </os>
-- 
1.7.7.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]