[CentOS-virt] Best practices for LVM and virtualization

Wed Feb 10 11:22:10 UTC 2010
Manuel Wolfshant <wolfy at nobugconsulting.ro>

Mathieu Baudier wrote:
>> yes, you can add / remove disks to a VM without restarting the guest.
>> look at the xm block-attach  / block-detach commands
>>     
>
> My understanding is that xm is Xen specific (I'm using Qemu/KVM)
>
> I tried with virsh:
>
> virsh # attach-disk 6 /dev/mapper/vg_alma_fast-lv_test_virtlvm2 vdb
> Disk attached successfully
>
> virsh # dumpxml 6
> <domain type='kvm' id='6'>
> ...
>   <devices>
>     <emulator>/usr/libexec/qemu-kvm</emulator>
> ...
>     <disk type='block' device='disk'>
>       <source dev='/dev/mapper/vg_alma_fast-lv_test_virtlvm'/>
>       <target dev='vda' bus='virtio'/>
>     </disk>
>     <disk type='block' device='disk'>
>       <driver name='phy'/>
>       <source dev='/dev/mapper/vg_alma_fast-lv_test_virtlvm2'/>
>       <target dev='vdb' bus='virtio'/>
>     </disk>
> ...
>   </devices>
> </domain>
>
> But I still cannot see the disk using fdisk: there is no /dev/vdb.
>
>   
You also need to tell the guest that a new device exists... Unless it 
(the guest) has some hotswap abilities....