Bug 473882

Summary: [RHEL5.3]: xm block-detach no longer works
Product: Red Hat Enterprise Linux 5 Reporter: Chris Lalancette <clalance>
Component: xenAssignee: Chris Lalancette <clalance>
Status: CLOSED ERRATA QA Contact: Gurhan Ozen <gozen>
Severity: high Docs Contact:
Priority: high    
Version: 5.3CC: berrange, cward, ddutile, gozen, jburke, syeghiay, tao, xen-maint
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-01-20 21:13:11 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:
Bug Depends On:    
Bug Blocks: 465937, 465938, 475588    
Attachments:
Description Flags
Fix up block detach
none
Correct fix for block-detach none

Description Chris Lalancette 2008-12-01 10:12:09 UTC
Description of problem:
As reported by Don Dutile, xm block-detach no longer seems to work in the RHEL 5.3 beta.  The following sequence of actions:

# xm create -c rhel5pv_x86_64
# xm block-attach rhel5pv_x86_64 tap:aio:/var/lib/xen/images/test.dsk /dev/xvde w
# xm block-detach rhel5pv_x86_64 51776

Results in:

   Error: 51776 not connected
   Usage: xm block-detach <Domain> <DevId> [-f|--force]

   Destroy a domain's virtual block device.

Doing a bisection, this seems to have started with xen-3.0.3-74.el5; prior to that, xm block-detach seemed to work fine.

Comment 2 Chris Lalancette 2008-12-02 12:15:40 UTC
OK, I think I got it.  The patch to fix up a CVE caused this breakage by moving some stuff around in xenstore.  Luckily, I think it is pretty easy to fix; the attached patch seems to fix it for me.  I'll post this upstream as well, since I think the same problem probably exists there.

Chris Lalancette

Comment 3 Chris Lalancette 2008-12-02 12:16:15 UTC
Created attachment 325364 [details]
Fix up block detach

Comment 5 Daniel Berrangé 2008-12-03 20:45:11 UTC
Built into xen-3.0.3-78.el5

Comment 7 Daniel Berrangé 2008-12-10 14:38:57 UTC
This patch caused a regression in guest reboots for bz 471588

Comment 8 Daniel Berrangé 2008-12-10 14:41:18 UTC
Created attachment 326512 [details]
Correct fix for block-detach

There are two core problems with block detach

 - virsh & xm both pass 'type=vbd' even for TAP devices. This causes the wrong device controller to be used. This is the cause of the detach failure. This patch checks for the bogus type=vbd and fixes it

 - The /vm/$UUID/device/{vbd,tap}/$DEVID  path is not removed from xenstore, preventing a later re-attachment. This patch removes that path upon detach

Comment 10 Bill Burns 2008-12-10 20:47:17 UTC
*** Bug 475588 has been marked as a duplicate of this bug. ***

Comment 14 errata-xmlrpc 2009-01-20 21:13:11 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-0118.html