I'm running Debian Wheezy Beta 4 with KVM based guest systems which run the same operating system. I'm using LibVirt to manage the virtualisation.
What I would like to do is to attach an LVM based block device to a running guest system through Virtio. If I would configure it through virsh edit [MACHINE]
it would look like this:
<disk type='block' device='disk'>
<driver name='qemu' type='raw' cache='none' io='native'/>
<source dev='/dev/volume_group/logical_volume'/>
<target dev='vdb' bus='virtio'/>
</disk>
I tried to find out how to do this with virsh attach-disk
. So far I figured the following:
virsh attach-disk guest /dev/volume_group/logical_volume vdb --driver qemu --type raw --cache none --persistent
How can I specify the target's bus
and driver's io
field? I really need these options to be exactly as specified in the XML.
I find the commandline way of specifying the options quite limited. Try using the
attach-device
action and specify the disk configuration in an XML file.with the
new-disk.xml
file containing the five lines you would add usingedit
.Add
--persistent
to have it update your machine's XML definition for you.update
Make sure to have the hotplug kernel modules loaded in the guest before adding the device:
You should then see the kernel throwing some debug messages in
dmesg
, like this:These days virsh(1) has all the command-line options, you can simply run e.g.:
virsh attach-disk --help
shows it all.