Bug 848989 - Documentation says filesystem type="ram" size in kibibytes, implementation uses bytes
Summary: Documentation says filesystem type="ram" size in kibibytes, implementation us...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: All
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-08-17 02:14 UTC by Matt Johnston
Modified: 2014-04-17 13:19 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-04-17 13:19:08 UTC
Embargoed:


Attachments (Terms of Use)

Description Matt Johnston 2012-08-17 02:14:55 UTC
Description of problem:
The documentation for filesystem type="ram" (http://libvirt.org/formatdomain.html) says size is kibibytes, it's actually interpreted as bytes:


File used for "virsh define":
    <filesystem type='ram'>
      <source usage='10000000'/>
      <target dir='/mnt/share'/>
    </filesystem>


In the container:
$ df -h /mnt/share/
Filesystem            Size  Used Avail Use% Mounted on
tmpfs                 9.6M     0  9.6M   0% /mnt


Output of "virsh edit":
    <filesystem type='ram' accessmode='passthrough'>
      <source usage='9' units='KiB'/>
      <target dir='/mnt/share'/>
    </filesystem>

Additional info:
libvirt 0.9.14 on centos 6.2, Linux 3.2.6

Comment 1 Ján Tomko 2014-04-17 13:19:08 UTC
Fixed upstream by:
commit 3f029fb5319b9dc9cc2fbf8d1ba4505ee9e4b1e3
Author:     Ján Tomko <jtomko>
AuthorDate: 2013-10-09 14:17:13 +0200
Commit:     Ján Tomko <jtomko>
CommitDate: 2013-10-09 17:44:45 +0200

    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

git describe: v1.1.3-77-g3f029fb contains: v1.1.4-rc1~156


Note You need to log in before you can comment on or make changes to this bug.