mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 15:15:25 +00:00
2e14861224
Disk manufacturers are fond of quoting sizes in powers of 10, rather than powers of 2 (after all, 2.1 GB sounds larger than 2.0 GiB, even though the exact opposite is true). So, we might as well follow coreutils' lead in supporting three types of suffix: single letter ${u} (which we already had) and ${u}iB for the power of 2, and ${u}B for power of 10. Additionally, it is impossible to create a file with more than 2**63 bytes, since off_t is signed (if you have enough storage to even create one 8EiB file, I'm jealous). This now reports failure up front rather than down the road when the kernel finally refuses an impossible size. * docs/schemas/basictypes.rng (unit): Add suffixes. * src/conf/storage_conf.c (virStorageSize): Use new function. * docs/formatstorage.html.in: Document it. * tests/storagevolxml2xmlin/vol-file-backing.xml: Test it. * tests/storagevolxml2xmlin/vol-file.xml: Likewise.
16 lines
351 B
XML
16 lines
351 B
XML
<volume>
|
|
<name>sparse.img</name>
|
|
<source/>
|
|
<capacity unit="TiB">1</capacity>
|
|
<allocation unit="bytes">0</allocation>
|
|
<target>
|
|
<path>/var/lib/libvirt/images/sparse.img</path>
|
|
<permissions>
|
|
<mode>0</mode>
|
|
<owner>0744</owner>
|
|
<group>0</group>
|
|
<label>virt_image_t</label>
|
|
</permissions>
|
|
</target>
|
|
</volume>
|