]> xenbits.xensource.com Git - libvirt.git/commit
qemu: add new disk device='lun' for bus='virtio' & type='block'
authorLaine Stump <laine@laine.org>
Thu, 5 Jan 2012 03:48:38 +0000 (22:48 -0500)
committerLaine Stump <laine@laine.org>
Mon, 9 Jan 2012 15:55:53 +0000 (10:55 -0500)
commit177db087757e4adb02c211de56336a5991c8eb20
tree63b15ee0670a3dff1e63152a26a97f18dba211c2
parente8daeeb1362d52d2dd757303195569ed09761ba1
qemu: add new disk device='lun' for bus='virtio' & type='block'

In the past, generic SCSI commands issued from a guest to a virtio
disk were always passed through to the underlying disk by qemu, and
the kernel would also pass them on.

As a result of CVE-2011-4127 (see:
http://seclists.org/oss-sec/2011/q4/536), qemu now honors its
scsi=on|off device option for virtio-blk-pci (which enables/disables
passthrough of generic SCSI commands), and the kernel will only allow
the commands for physical devices (not for partitions or logical
volumes). The default behavior of qemu is still to allow sending
generic SCSI commands to physical disks that are presented to a guest
as virtio-blk-pci devices, but libvirt prefers to disable those
commands in the standard virtio block devices, enabling it only when
specifically requested (hopefully indicating that the requester
understands what they're asking for). For this purpose, a new libvirt
disk device type (device='lun') has been created.

device='lun' is identical to the default device='disk', except that:

1) It is only allowed if bus='virtio', type='block', and the qemu
   version is "new enough" to support it ("new enough" == qemu 0.11 or
   better), otherwise the domain will fail to start and a
   CONFIG_UNSUPPORTED error will be logged).

2) The option "scsi=on" will be added to the -device arg to allow
   SG_IO commands (if device !='lun', "scsi=off" will be added to the
   -device arg so that SG_IO commands are specifically forbidden).

Guests which continue to use disk device='disk' (the default) will no
longer be able to use SG_IO commands on the disk; those that have
their disk device changed to device='lun' will still be able to use SG_IO
commands.

*docs/formatdomain.html.in - document the new device attribute value.
*docs/schemas/domaincommon.rng - allow it in the RNG
*tests/* - update the args of several existing tests to add scsi=off, and
 add one new test that will test scsi=on.
*src/conf/domain_conf.c - update domain XML parser and formatter

*src/qemu/qemu_(command|driver|hotplug).c - treat
 VIR_DOMAIN_DISK_DEVICE_LUN *almost* identically to
 VIR_DOMAIN_DISK_DEVICE_DISK, except as indicated above.

Note that no support for this new device value was added to any
hypervisor drivers other than qemu, because it's unclear what it might
mean (if anything) to those drivers.
19 files changed:
docs/formatdomain.html.in
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
src/conf/domain_conf.h
src/qemu/qemu_command.c
src/qemu/qemu_driver.c
src/qemu/qemu_hotplug.c
tests/qemuhelptest.c
tests/qemuxml2argvdata/qemuxml2argv-boot-complex-bootindex.args
tests/qemuxml2argvdata/qemuxml2argv-boot-complex.args
tests/qemuxml2argvdata/qemuxml2argv-boot-order.args
tests/qemuxml2argvdata/qemuxml2argv-disk-ioeventfd.args
tests/qemuxml2argvdata/qemuxml2argv-disk-order.args
tests/qemuxml2argvdata/qemuxml2argv-encrypted-disk.args
tests/qemuxml2argvdata/qemuxml2argv-event_idx.args
tests/qemuxml2argvdata/qemuxml2argv-virtio-lun.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-virtio-lun.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c
tests/qemuxml2xmltest.c