mirror of https://gitee.com/openkylin/libvirt.git
qemu: Forbid non-raw images for disk type='lun' with vitio-blk frontend
Historically the virtio-blk frontend by default enabled SCSI emulation and tried to do SCSI command passthrough. As this was enabled by default there's a fallback mechanism in place in cases when the backend doesn't support SCSI for any reason. This is not the case when disk type=lun is used with 'scsi-block' via 'virtio-scsi'. We did not restrict configurations when the user picks 'qcow2' or any other format as format of the disk, in which case the emulation is disabled as such configuration doesn't make sense. This patch unifies the approach so that 'raw' is required both when used via 'virtio-blk' and 'virtio-scsi' so that the user is presented with the expected configuration. Note that use of <disk type='lun'> is already very restrictive as it requires a block device or iSCSI storage. Additionally the scsi emulation is now deprecated by qemu with virtio-blk as it conflicts with virtio-1 and the alternative is to use 'virtio-scsi' which performs better and is along for a very long time. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
ec69f0190b
commit
b40ec75296
|
@ -10481,6 +10481,12 @@ qemuDomainDefValidateDiskLunSource(const virStorageSource *src)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (src->format != VIR_STORAGE_FILE_RAW) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("disk device 'lun' must use 'raw' format"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1997,14 +1997,6 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDomainDiskDef *disk,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI &&
|
||||
disk->src->format != VIR_STORAGE_FILE_RAW) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("disk device 'lun' using target 'scsi' must use "
|
||||
"'raw' format"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (qemuDomainDefValidateDiskLunSource(disk->src) < 0)
|
||||
return -1;
|
||||
|
||||
|
|
|
@ -27,10 +27,10 @@ server,nowait \
|
|||
-boot menu=on \
|
||||
-device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 \
|
||||
-usb \
|
||||
-drive file=/dev/sdfake,format=qcow2,if=none,id=drive-virtio-disk0 \
|
||||
-drive file=/dev/sdfake,format=raw,if=none,id=drive-virtio-disk0 \
|
||||
-device virtio-blk-pci,scsi=on,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\
|
||||
id=virtio-disk0,bootindex=2 \
|
||||
-drive file=/dev/sdfake2,format=qcow2,if=none,id=drive-virtio-disk1 \
|
||||
-drive file=/dev/sdfake2,format=raw,if=none,id=drive-virtio-disk1 \
|
||||
-device virtio-blk-pci,scsi=on,bus=pci.0,addr=0x5,drive=drive-virtio-disk1,\
|
||||
id=virtio-disk1 \
|
||||
-netdev user,id=hostnet0 \
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
<disk type='block' device='lun' rawio='yes'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source dev='/dev/sdfake'/>
|
||||
<target dev='vda' bus='virtio'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</disk>
|
||||
<disk type='block' device='lun'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source dev='/dev/sdfake2'/>
|
||||
<target dev='vdb' bus='virtio'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
<disk type='block' device='lun' rawio='yes'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source dev='/dev/sdfake'/>
|
||||
<target dev='vda' bus='virtio'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</disk>
|
||||
<disk type='block' device='lun'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source dev='/dev/sdfake2'/>
|
||||
<target dev='vdb' bus='virtio'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
|
||||
|
|
Loading…
Reference in New Issue