mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-08 14:29:56 +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.
25 lines
566 B
XML
25 lines
566 B
XML
<volume>
|
|
<name>sparse.img</name>
|
|
<source/>
|
|
<capacity unit='GB'>10</capacity>
|
|
<allocation unit='MiB'>0</allocation>
|
|
<target>
|
|
<path>/var/lib/libvirt/images/sparse.img</path>
|
|
<permissions>
|
|
<mode>0</mode>
|
|
<owner>0744</owner>
|
|
<group>0</group>
|
|
</permissions>
|
|
</target>
|
|
<backingStore>
|
|
<path>/var/lib/virt/images/master.img</path>
|
|
<format type='vmdk'/>
|
|
<permissions>
|
|
<mode>0744</mode>
|
|
<owner>1</owner>
|
|
<group>1</group>
|
|
<label>virt_image_t</label>
|
|
</permissions>
|
|
</backingStore>
|
|
</volume>
|