Re: [PATCHv3] LXC: Fix handling of RAM filesystem size units

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

 



On 10/09/2013 08:13 AM, Ján Tomko wrote:
> 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.
> 

Also mention that programs in the wild parse and then pass in the
variant with the extra 's'.

> 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).
> 
> 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
> ---

I think we're finally at a sane state.

ACK with one nit:

> +++ b/src/lxc/lxc_container.c
> @@ -1428,7 +1428,7 @@ static int lxcContainerMountFSTmpfs(virDomainFSDefPtr fs,
>      VIR_DEBUG("usage=%lld sec=%s", fs->usage, sec_mount_options);
>  
>      if (virAsprintf(&data,
> -                    "size=%lldk%s", fs->usage, sec_mount_options) < 0)
> +                    "size=%lld%s", fs->usage, sec_mount_options) < 0)

Please also modify the .h file that declares fs->usage to add a comment
that we are storing it in-memory as bytes.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]