]> xenbits.xensource.com Git - libvirt.git/commit
LXC: Fix handling of RAM filesystem size units
authorJán Tomko <jtomko@redhat.com>
Wed, 9 Oct 2013 12:17:13 +0000 (14:17 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 9 Oct 2013 15:44:45 +0000 (17:44 +0200)
commit3f029fb5319b9dc9cc2fbf8d1ba4505ee9e4b1e3
tree686f69fb5f6c00c078b63f7d74867c018802f323
parentfc9a416df7514d9f0731984c408b79cc3bd877e6
LXC: Fix handling of RAM filesystem size units

Since 76b644c when the support for RAM filesystems was introduced,
libvirt accepted the following XML:
<source usage='1024' unit='KiB'/>

This was parsed correctly and internally stored in bytes, but it
was formatted as (with an extra 's'):
<source usage='1024' units='KiB'/>
When read again, this was treated as if the units were missing,
meaning libvirt was unable to parse its own XML correctly.

The usage attribute was documented as being in KiB, but it was not
scaled if the unit was missing. Transient domains still worked,
because this was balanced by an extra 'k' in the mount options.

This patch:
Changes the parser to use 'units' instead of 'unit', as the latter
was never documented (fixing persistent domains) and some programs
(libvirt-glib, libvirt-sandbox) already parse the 'units' attribute.

Removes the extra 'k' from the tmpfs mount options, which is needed
because now we parse our own XML correctly.

Changes the default input unit to KiB to match documentation, fixing:
https://bugzilla.redhat.com/show_bug.cgi?id=1015689
docs/formatdomain.html.in
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
src/conf/domain_conf.h
src/lxc/lxc_container.c
tests/domainschematest
tests/lxcxml2xmldata/lxc-filesystem-ram.xml [new file with mode: 0644]
tests/lxcxml2xmloutdata/lxc-filesystem-ram.xml [new file with mode: 0644]
tests/lxcxml2xmltest.c