[libvirt] problem attaching/detaching disk

Wen Congyang wency at cn.fujitsu.com
Thu Mar 3 07:31:55 UTC 2011


At 03/03/2011 02:11 PM, Shi Jin Write:
> Hi there,
> 
> Attaching/detachnig virtio disk to a VM used to work fine with RHEL-5 but with RHEL-6 it seems to have problems.
> 
> Attaching seems to work. For example, I can do
> virsh attach-disk <vmname>  <qcow2 file name> vdb --driver file --subdriver qcow2
> However, it generates a bit weird XML:
>     <disk type='file' device='disk'>
>       <driver name='file' type='qcow2'/>
>       <source file='<file>/>
>       <target dev='vdb' bus='virtio'/>
>       <alias name='virtio-disk1'/>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
>     </disk>
> 
> In contrary, our original VM system disk has
>     <disk type='file' device='disk'>
>       <driver name='qemu' type='qcow2'/>
>       <source file='<sys disk image>'/>
>       <target dev='vda' bus='virtio'/>
>       <alias name='virtio-disk0'/>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
>     </disk>
> 
> Note the different of driver name: qemu vs file.
> I think qemu is the proper name to use.  This has been mentioned last year on this list [1]. I wonder if there has already been a proper fix for this problem.
> 
> More seriously about this is that I am not able to detach the just attached disk, most likely due to the problem of wrong driver name.
> [cloudadmin at test2 ~]$ virsh detach-disk one-52 vdb
> error: Failed to detach disk
> error: operation failed: detaching virtio-disk1 device failed: Device 'virtio-disk1' not found
This error message is reported by qemu.

I try to reproduce this bug with upstream libvirt and qemu, but it works fine to me:

# virsh attach-disk RHEL6RC /var/lib/libvirt/images/test3.img vdb  --driver file --subdriver qcow2
Disk attached successfully

# virsh detach-disk RHEL6RC vdb
Disk detached successfully

What is version of libvirt and qemu that you use?

> But if I tried to remove the vda which uses qemu as driver name it would work.
> [cloudadmin at test2 ~]$ virsh detach-disk one-52 vda
> Disk detached successfully
> 
> I also tried with raw disks to attach/detach and saw the same problems.
> 
> Thank you very much.
> Shi
> 
> 
> [1]: http://www.redhat.com/archives/libvir-list/2010-August/msg00449.html
>  
> --
> Shi Jin, PhD
> 
> 
>       
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
> 




More information about the libvir-list mailing list