Bug 483180

Summary: disk detachment doesn't clean up Xen state fully, leaving block device unusable
Product: [Community] Virtualization Tools Reporter: Dmitrii <dmitriizagorodnov>
Component: libvirtAssignee: Daniel Veillard <veillard>
Status: CLOSED INSUFFICIENT_DATA QA Contact:
Severity: high Docs Contact:
Priority: low    
Version: unspecifiedCC: berrange, crobinso, xen-maint
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-05-26 02:01:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dmitrii 2009-01-30 02:24:47 UTC
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')

Comment 1 Cole Robinson 2010-05-26 02:01:06 UTC
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.