mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 07:05:28 +00:00
9ca16307f3
Since76b644c
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 (cherry picked from commit3f029fb531
) Conflicts: src/conf/domain_conf.c src/lxc/lxc_container.c
34 lines
964 B
XML
34 lines
964 B
XML
<domain type='lxc'>
|
|
<name>demo</name>
|
|
<uuid>8369f1ac-7e46-e869-4ca5-759d51478066</uuid>
|
|
<memory unit='KiB'>500000</memory>
|
|
<currentMemory unit='KiB'>500000</currentMemory>
|
|
<vcpu placement='static'>1</vcpu>
|
|
<os>
|
|
<type arch='x86_64'>exe</type>
|
|
<init>/bin/sh</init>
|
|
</os>
|
|
<clock offset='utc'/>
|
|
<on_poweroff>destroy</on_poweroff>
|
|
<on_reboot>restart</on_reboot>
|
|
<on_crash>destroy</on_crash>
|
|
<devices>
|
|
<emulator>/usr/libexec/libvirt_lxc</emulator>
|
|
<filesystem type='ram'>
|
|
<source usage='1048576'/>
|
|
<target dir='/mnt/mississippi'/>
|
|
</filesystem>
|
|
<filesystem type='ram'>
|
|
<source usage='1048576' units='bytes'/>
|
|
<target dir='/mnt/antananarivo'/>
|
|
</filesystem>
|
|
<filesystem type='ram'>
|
|
<source usage='1024' units='KiB'/>
|
|
<target dir='/mnt/ouagadougou'/>
|
|
</filesystem>
|
|
<console type='pty'>
|
|
<target type='lxc' port='0'/>
|
|
</console>
|
|
</devices>
|
|
</domain>
|