Description of problem: When detaching a block device from a Xen domain using either 'virsh detach-disk' or, programmatically via virDomainDetachDevice(), the block device is left in a "busy" state and cannot be used from then on, by virsh or anyone else, until the domain is terminated. The detach operation achieves partial success, though, as the device does indeed disappear inside the guest domain. On the same system, using the same domain and the same block device, xm block-attach and block-detach work flawlessly. Version-Release number of selected component (if applicable): libvirt / virsh 0.5.1 (problem also seen in 0.4.6) on 2.6.26-1-xen-amd64 How reproducible: consistently Steps to Reproduce: # losetup /dev/loop1 /path/to/partition.image # virsh attach-disk instance-name /dev/loop1 hda1 Disk attached successfully # virsh detach-disk instance-name hda1 Disk detached successfully # virsh attach-disk instance-name /dev/loop1 hda1 libvir: Xen Daemon error : POST operation failed: xend_post: error from xen daemon: (xend.err 'Invalid Configuration: The file "/dev/loop1" is already used')
The reported libvirt version is very old now (as well as this bug). If you can reproduce with a newer libvirt and xen version, please report that info here, along with your host distro, and we can reopen this bug. Closing.