[CentOS-virt] KVM, virsh attach-disk problems

Sat Apr 23 14:58:25 UTC 2011
Jussi Hirvi <listmember at greenspot.fi>

Greetings, list!

I hope you forgive cross-posting - I only now found this list.

I am in the process of configuring a KVM stack of about 8 vms. Mostly I 
am concerned about performance, as there will be a lot of I/O.

My last problem is this: I try to add a fresh, unformatted disk 
partition to a KVM guest. I follow the directions given here:

http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html-single/Virtualization/index.html#proc-Virtualization-Adding_storage_devices_to_guests-Adding_physical_block_devices_to_virtualized_guests

First I check that the module acpiphp is present on the guest. It is.

On the host I write:

virsh attach-disk test1 /dev/sdb1 sda --driver tap --mode shareable

- test1 is my guest domain
- /dev/sdb1 is the name of the unformatted partition on the host
- sda is what it is supposed to be called on the guest (the name is
unused on the guest)
- the example in RHEL Virtualization guide says "--mode readonly". This
does not sound right for a hard disk; hence I try "--mode shareable";
the error (see below) however is the same, whichever I use

Now, the command above produces this error. I find no google results
with this error text. Can someone tell, what causes the error?

 > > error: Failed to attach disk error: operation failed: adding scsi
 > > disk controller failed: type scsi not a hotpluggable PCI device.
 > > failed to add if=scsi

I found a post (2009, on fedora-virt list), which is relevant:

http://www.redhat.com/archives/fedora-virt/2009-December/msg00032.html

Otherwise, I have found almost nothing!

BTW, I can attach a disk to the KVM guest, using a virtio driver:

 > > [root at 113 info]# virsh attach-disk test1 /dev/sdd1 vdb
 > > --driver virtio --mode shareable
  > Disk attached successfully

I have not seen any mention anywhere about using virtio drivers like 
this. And the problem with this is that the new disk does not survive 
guest reboot. At guest startup virsh complains about the virtio drivers.

- Jussi

-- 
Jussi Hirvi * Green Spot
Suvilahdenkatu 1 B 78 * 00500 Helsinki * Finland
Tel. +358 9 493 981 * Mobile +358 40 771 2098 (only sms)
jussi.hirvi at greenspot.fi * http://www.greenspot.fi