Virtio-scsi-for-bdm
Contents
Add virtio-scsi bus support for block device mapping
The corresponding BP is https://blueprints.launchpad.net/nova/+spec/add-virtio-scsi-bus-for-bdm
Virtio SCSI
VirtIO SCSI is a new para-virtualized SCSI controller device for KVM instances. It has been designed to replace virtio-blk, increase it's performance and improve scalability. The interface is capable of handling multiple block devices per virtual SCSI adapter, keeps the standard scsi device naming in the guests (e.x /dev/sda) and support SCSI devices passthrough.
Goals
- Boot from a cinder volume with virtio-scsi bus type
- Attach a volume to instance using virtio-scsi bus type
Use cases
- Improve performance in I/O-intensive applications
- Support virtio-scsi passthrough, and with "multi-attached-volumes" ([1]) together, can be used to support MSCS or Oracle RAC to run in cloud servers
Libvirt Driver Support
When using a volume with "scsi" bus type and not specify a scsi controller explicitly in the domain xml, libvirt will automatically generate a "lsi" controller. Virtio-Scsi controller can be specified as follows:
<controller type='scsi' index='0' model='virtio-scsi'/>
Notices
If we attach a Virtio-scsi volume to an instance already with a scsi controller other than "virtio-scsi" model, we must first attach a "virtio-scsi" controller with a "index" value different from exists scsi controllers, and then attach the volume and set the "controller" in "address" sub-element of disk config to the correct "index" value of the new attached "virtio-scsi" controller.
Related works
- Block-device-mapping-v2 extension has already support attach or boot from a volume which is connected to Instance via scsi bus type and multiple disk types. But cannot generate a virtio-scsi controller.
- Libvirt-virtio-scsi-driver BP ([2]) whose milestone target is icehouse-3 is aim to support generate a virtio-scsi controller when using an image with virtio-scsi property. But it seems not to take boot-from-volume and attach-volume into account.
Implementation
API support
Add "virtio-scsi" bus type to block-device-mapping-v2 extension, as follows:
--block-device id=xxx,source=volume,dest=volume,bus=virtio-scsi,type=lun
Boot from Virtio-scsi Passthrough volume
In libvirt driver, append the virtio-scsi controller (will be introduced by libvirt-virtio-scsi-driver BP [1]) if we booting from a volume with "virtio-scsi" bus type.
Attach Virtio-scsi Passthrough volume
- If current instance have not a virtio-scsi controller, we first attach a virtio-scsi controller with an unique "index" value.
- Set the "controller" of "address" sub-element for the volume's corresponding block-device config to the "index" of virtio-scsi controller
References
[1] https://blueprints.launchpad.net/cinder/+spec/multi-attach-volume [2] https://blueprints.launchpad.net/nova/+spec/libvirt-virtio-scsi-driver