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/Vir...
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
- Jussi
I found another post (2009, on fedora-virt list), which is relevant:
http://www.redhat.com/archives/fedora-virt/2009-December/msg00032.html
I have a CentOS 5.4 guest x86_64. If I remember well
(...)
hot add of scsi disk should work if there is already a scsi disk into the guest (and if the guest supports it).
Well, in my system there is no scsi disk on the guest (the guest only sees the img on which it runs), and I don't know how I could get one there. :-/
- Jussi
Now I could attach a disk to the KVM guest, using a virtio driver:
[root@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.
Here /dev/sdd is a separate disk, not used directly by either kvm host or guests. Before the operation, sdd1 was created with fdisk as a Linux partition. After the operation, I did mkfs.ext3 on the guest and then mounted the new filesystem.
But the Bonnie benchmark results for the KVM guest are not promising - they are about the same for the new external partition and for the guest's native filesystem.
Reads are in fact much slower on the external partition (27500 vs. 70000 k/s). (CPU load 4 vs. 12 %.) Writes are faster (121000 vs 98000 k/s). (CPU load 12 vs. 10 %.)
If these results are weighed with the cpu load, the differences even out.
Maybe the evennes is because the external partition is used with virtio drivers, same as the guest's native disk image.
So why bother? I think I will give each guest one disk image to run on, and that's it. Unless I find a better way to attach partitions to guests.
- Jussi