mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu: Supply correct default type for 'dir' based VIR_STORAGE_TYPE_VOLUME
Our code would skip adding the default type in this cases, but since we know that the only reasonable option here is 'fat' we can add it while starting the VM. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
99917ade0a
commit
7d5b283065
@ -14217,10 +14217,16 @@ qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk,
|
||||
{
|
||||
qemuDomainPrepareDiskCachemode(disk);
|
||||
|
||||
/* add raw file format if the storage pool did not fill it in */
|
||||
/* set default format for storage pool based disks */
|
||||
if (disk->src->type == VIR_STORAGE_TYPE_VOLUME &&
|
||||
disk->src->format <= VIR_STORAGE_FILE_NONE)
|
||||
disk->src->format = VIR_STORAGE_FILE_RAW;
|
||||
disk->src->format <= VIR_STORAGE_FILE_NONE) {
|
||||
int actualType = virStorageSourceGetActualType(disk->src);
|
||||
|
||||
if (actualType == VIR_STORAGE_TYPE_DIR)
|
||||
disk->src->format = VIR_STORAGE_FILE_FAT;
|
||||
else
|
||||
disk->src->format = VIR_STORAGE_FILE_RAW;
|
||||
}
|
||||
|
||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) {
|
||||
if (qemuDomainPrepareDiskSourceBlockdev(disk, priv, cfg) < 0)
|
||||
|
@ -36,4 +36,8 @@ readonly=on \
|
||||
readonly=on \
|
||||
-device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\
|
||||
id=virtio-disk0 \
|
||||
-drive file=fat:/some/dir/device/vol2,if=none,id=drive-virtio-disk1,\
|
||||
readonly=on \
|
||||
-device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk1,\
|
||||
id=virtio-disk1 \
|
||||
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
|
||||
|
@ -43,6 +43,12 @@
|
||||
<target dev='vda' bus='virtio'/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<disk type='volume' device='disk'>
|
||||
<driver name='qemu'/>
|
||||
<source pool='pool-disk' volume='dir+vol2'/>
|
||||
<target dev='vdb' bus='virtio'/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<controller type='usb' index='0'/>
|
||||
<controller type='ide' index='0'/>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
|
@ -44,6 +44,13 @@
|
||||
<readonly/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</disk>
|
||||
<disk type='volume' device='disk'>
|
||||
<driver name='qemu'/>
|
||||
<source pool='pool-disk' volume='dir+vol2'/>
|
||||
<target dev='vdb' bus='virtio'/>
|
||||
<readonly/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
|
||||
</disk>
|
||||
<controller type='usb' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
|
Loading…
Reference in New Issue
Block a user