[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] problem attaching/detaching disk

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'/>

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'/>

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 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
But if I tried to remove the vda which uses qemu as driver name it would work.
[cloudadmin 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.

[1]: http://www.redhat.com/archives/libvir-list/2010-August/msg00449.html
Shi Jin, PhD


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]