KVM - The Linux Kernel-Based Virtual Machine
News, Blogs and Resources on the Linux (KVM) Kernel-Based Virtual Machine

Virtio SCSI

With the recent release of Fedora 17 comes a new KVM storage stack called virtio-scsi.  Using this functionality is currently limited to command line operation.  However there's already virtio-scsi code in upstream libvirt so virt-manager and other libvirt based tools will be supporting virtio-scsi soon.  

One caveat about this new stack is that it does require guest drivers and Fedora 17 is the only guest so far supporting it. Virtio-scsi drivers will be available for linux guests from kernel version 3.4 so check your linux version if you'd like to try it.   Guest drivers for windows however are not available yet. 

 

virtio-scsi-on-fedora-17

 

Why a new linux kvm storage stack?

You might be asking yourself why a new storage stack for KVM.  The primary reasons the KVM developers came up with a new storage stack was more about the major shortcomings of the virtio-block stack.  These shortcomings were listed in a mailing list discussion describing the virtio scsi design draft specifications and are shown below.

Limitations of virtio-block:

  • scalability limitations
  • limited flexibility
  • limited extensibility

This doesn't mean that virtio-block will be going away though, it will still be useful for non-scsi block devices.  

 

Getting started with Virtio-SCSI

To verify that your version of qemu supports virtio-scsi devices run the following command on your linux host.

qemu-kvm -device ?

Piping this output to grep doesn't do any good so you'll have to scroll the long list of devices for the following output

name "virtio-scsi-pci", bus PCI, alias "virtio-scsi"

Once your output shows that device, your version of kvm supports virtio-scsi devices.

To get started download the recently released Fedora 17 iso to your linux kvm host.  Next invoke kvm using a command line like the following where -cdrom argument points to your iso file.  

qemu-kvm -drive if=none,id=hd,file=/path/to/fedora17.img \
-device virtio-scsi-pci,id=scsi \
--enable-kvm \
-device scsi-hd,drive=hd \
-cdrom /path/to/fedora17.iso

Go through the process of installing Fedora 17.  When you're finished installing Fedora 17, reboot and your Fedora 17 guest with the following command

qemu-kvm -drive if=none,id=cd,file=/path/to/fedora17.iso \
-device scsi-cd,drive=cd,bootindex=0 \
-drive if=none,id=hd,file=/path/to/fedora17.img \
-device virtio-scsi-pci,id=scsi \
--enable-kvm \
-device scsi-hd,drive=hd

Virtual disks in your guest will be shown as /dev/sdX devices rather than /dev/vdX when using virtio-block. 

It would be much nicer to test this with a management tool like virt-manager, proxmox or oVirt but new features are always available in command line and libvirt long before the management tools.  Give it a try and please post any comments or questions you have.

See Also

Comments

grep

qemu-kvm -device '?' 2>&1 | grep virtio-scsi

Thanks. That command works.

Thanks. That command works.

respect to

creating the guest

Thanks

Hi, I see 'Fedora 17' is the

Hi,
I see 'Fedora 17' is the only supported guest OS.
I tried to make it work on RHEL6.2. But I see 2 issues :

1) virtio-scsi controller fails to add as persistent.
2) I can attach the sda disk. But the guest does not see it.
Virsh command line adds it properly.Also, Virt manager displays
the device. But the same is not reflected on the guest.

Any insight ?

thanks.

Old devices

I hope that KVM&QEMU developers realize that Virtio will have to be supported for at least a few years. There are many Win VMs in production tied to specific VM hardware and will break (or in case of OEM reactivated) if the underlying block architecture is no longer supported. Sometimes MS will not want to activate OEM copy of Windows if used in virtual environments (especially non Hyper-V) and buying new Windows Server is not like buying a candy bar.

http://www.thislinux.org/2012

Post new comment

The content of this field is kept private and will not be shown publicly.
Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.