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

Ján Tomko jtomko at redhat.com
Wed Oct 9 15:45:04 UTC 2013


On 10/09/2013 04:58 PM, Eric Blake wrote:
> 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'.
> 

...

> 
> I think we're finally at a sane state.
> 
> ACK with one nit:

Pushed with the added comment and amended commit message.

Jan

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





More information about the libvir-list mailing list