mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
qemu: Forbid 'cdrom' on 'sd' bus
We can't set the type of the device on the 'sd' bus and realistically a cdrom doesn't even make sense there. Forbid it. Note that the output of in disk-cdrom-bus-other.x86_64-latest.args switched to blockdev as it's no longer locked out due to use of a disk on 'sd' bus. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
7288da8dc8
commit
59a3adbcf2
@ -1946,9 +1946,10 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDomainDiskDef *disk,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM &&
|
if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM &&
|
||||||
disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO) {
|
(disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO ||
|
||||||
|
disk->bus == VIR_DOMAIN_DISK_BUS_SD)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("disk type 'virtio' of '%s' does not support ejectable media"),
|
_("disk type of '%s' does not support ejectable media"),
|
||||||
disk->dst);
|
disk->dst);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -28,14 +28,13 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
|||||||
-no-acpi \
|
-no-acpi \
|
||||||
-boot strict=on \
|
-boot strict=on \
|
||||||
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
|
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
|
||||||
-drive file=/root/boot.iso,format=raw,if=none,id=drive-usb-disk0,readonly=on \
|
-blockdev '{"driver":"file","filename":"/root/boot.iso",\
|
||||||
-device usb-storage,bus=usb.0,port=1,drive=drive-usb-disk0,id=usb-disk0,\
|
"node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \
|
||||||
|
-blockdev '{"node-name":"libvirt-2-format","read-only":true,"driver":"raw",\
|
||||||
|
"file":"libvirt-2-storage"}' \
|
||||||
|
-device usb-storage,bus=usb.0,port=1,drive=libvirt-2-format,id=usb-disk0,\
|
||||||
removable=off \
|
removable=off \
|
||||||
-drive if=none,id=drive-usb-disk1,readonly=on \
|
-device usb-storage,bus=usb.0,port=2,id=usb-disk1,removable=off \
|
||||||
-device usb-storage,bus=usb.0,port=2,drive=drive-usb-disk1,id=usb-disk1,\
|
|
||||||
removable=off \
|
|
||||||
-drive file=/root/boot2.iso,format=raw,if=sd,index=2,readonly=on \
|
|
||||||
-drive if=sd,index=3,readonly=on \
|
|
||||||
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
|
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
|
||||||
resourcecontrol=deny \
|
resourcecontrol=deny \
|
||||||
-msg timestamp=on
|
-msg timestamp=on
|
||||||
|
@ -26,17 +26,6 @@
|
|||||||
<target dev='sdb' bus='usb'/>
|
<target dev='sdb' bus='usb'/>
|
||||||
<readonly/>
|
<readonly/>
|
||||||
</disk>
|
</disk>
|
||||||
<disk type='file' device='cdrom'>
|
|
||||||
<driver name='qemu' type='raw'/>
|
|
||||||
<source file='/root/boot2.iso'/>
|
|
||||||
<target dev='sdc' bus='sd'/>
|
|
||||||
<readonly/>
|
|
||||||
</disk>
|
|
||||||
<disk type='file' device='cdrom'>
|
|
||||||
<driver name='qemu' type='raw'/>
|
|
||||||
<target dev='sdd' bus='sd'/>
|
|
||||||
<readonly/>
|
|
||||||
</disk>
|
|
||||||
<controller type='usb' index='0'/>
|
<controller type='usb' index='0'/>
|
||||||
<controller type='ide' index='0'/>
|
<controller type='ide' index='0'/>
|
||||||
<controller type='pci' index='0' model='pci-root'/>
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
|
@ -26,17 +26,6 @@
|
|||||||
<target dev='sdb' bus='usb'/>
|
<target dev='sdb' bus='usb'/>
|
||||||
<readonly/>
|
<readonly/>
|
||||||
</disk>
|
</disk>
|
||||||
<disk type='file' device='cdrom'>
|
|
||||||
<driver name='qemu' type='raw'/>
|
|
||||||
<source file='/root/boot2.iso'/>
|
|
||||||
<target dev='sdc' bus='sd'/>
|
|
||||||
<readonly/>
|
|
||||||
</disk>
|
|
||||||
<disk type='file' device='cdrom'>
|
|
||||||
<driver name='qemu' type='raw'/>
|
|
||||||
<target dev='sdd' bus='sd'/>
|
|
||||||
<readonly/>
|
|
||||||
</disk>
|
|
||||||
<controller type='usb' index='0'>
|
<controller type='usb' index='0'>
|
||||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||||
</controller>
|
</controller>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user