BSDCan2011 - Final (with audio).5

BSDCan 2011
The Technical BSD Conference

Speakers
Claudio Jeker
Schedule
Day Talks - 2 - 2011-05-14
Room DMS 1140
Start time 13:30
Duration 01:00
Info
ID 226
Language used for presentation English

vscsi(4) and iscsid

iSCSI initiator the OpenBSD way

The upcomming OpenBSD 4.9 includes an iSCSI initiator. Together with vscsi(4) it allows to connect OpenBSD systems to iSCSI targets instead of using SAS or Fibre Channel attached storage. The presentation will give a quick introduction to the iSCSI protocol, the vscsi(4) interface is explained including sample code and the design and implementation of iscsid is illustrated. A quick demonstration of iscsid and vscsi is possible.

In the beginning large storage networks had to be built with Fibre Channel. Since Fibre Channel is expensive an alternative way to attach block-level devices to servers was searched. A protocol using Ethernet or TCP/IP would be a good cost-effective alternative since there is already an extensive Ethernet infrastructure available in data centers. iSCSI is a protocol that transport SCSI commands and data over TCP. It combines two very popular protocols -- SCSI for block level I/O and TCP/IP for remote communication. While many iSCSI implementations are inside the kernel the one implemented in OpenBSD is written in userland similar to the NetBSD initiator. But unlike NetBSD's, OpenBSD's version does not use a userland filesystem to hook the iSCSI disks into the kernel. Instead access is performed via vscsi(4) -- a virtual scsibus -- which allows userland to talk directly to the kernel SCSI midlayer. Vscsi is implemented in roughly 600 lines of code exporting the scsibus to userland via 6 ioctl(2) plus the possibility to use poll(2) or kqueue(2) to allow simple I/O multiplexing. The vscsi device uses these ioctls to issue commands and send or receive data from the kernel. The use of this interface it is fairly simple and makes it possible to write an iSCSI initiator in userland. The userland process can offload all the complex SCSI protocol handling to vscsi and the kernel and "only" needs to implement the session establishment and error recovery.