mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
conf: restrict external snapshots to backing store formats
Domain snapshots should only permit an external snapshot into a storage format that permits a backing chain, since the new snapshot file necessarily must be backed by the existing file. The C code for the qemu driver is a little bit stricter in currently enforcing only qcow2 or qed, but at the XML parser level, including virt-xml-validate, it is fairly easy to enforce that a user can't request a 'raw' external snapshot. * docs/schemas/storagecommon.rng (storageFormat): Split out... (storageFormatBacking): ...new sublist. * docs/schemas/domainsnapshot.rng (disksnapshotdriver): Use new type. * src/util/virstoragefile.h (virStorageFileFormat): Rearrange for easier code management. * src/util/virstoragefile.c (virStorageFileFormat, fileTypeInfo): Likewise. * src/conf/snapshot_conf.c (virDomainSnapshotDiskDefParseXML): Use new marker to limit selection of formats. Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
committed by
Jiri Denemark
parent
4f596a070d
commit
db7d7c0ee8
@@ -184,7 +184,7 @@
|
||||
<element name='driver'>
|
||||
<optional>
|
||||
<attribute name='type'>
|
||||
<ref name='storageFormat'/>
|
||||
<ref name='storageFormatBacking'/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<empty/>
|
||||
|
||||
@@ -52,23 +52,30 @@
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<!-- split the list of known storage formats into two, those where
|
||||
we know how to follow backing chains, and all others -->
|
||||
<define name='storageFormatBacking'>
|
||||
<choice>
|
||||
<value>cow</value>
|
||||
<value>qcow</value>
|
||||
<value>qcow2</value>
|
||||
<value>qed</value>
|
||||
<value>vmdk</value>
|
||||
</choice>
|
||||
</define>
|
||||
<define name='storageFormat'>
|
||||
<choice>
|
||||
<value>raw</value>
|
||||
<value>dir</value>
|
||||
<value>bochs</value>
|
||||
<value>cloop</value>
|
||||
<value>cow</value>
|
||||
<value>dmg</value>
|
||||
<value>iso</value>
|
||||
<value>qcow</value>
|
||||
<value>qcow2</value>
|
||||
<value>qed</value>
|
||||
<value>vmdk</value>
|
||||
<value>vpc</value>
|
||||
<value>vdi</value>
|
||||
<value>fat</value>
|
||||
<value>vhd</value>
|
||||
<value>vdi</value>
|
||||
<ref name='storageFormatBacking'/>
|
||||
</choice>
|
||||
</define>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user