Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 234840 - Add a virsh block-attach/block-detach command
Summary: Add a virsh block-attach/block-detach command
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: libvirt
Version: 5.0
Hardware: All
OS: Linux
Target Milestone: ---
: ---
Assignee: Daniel Veillard
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2007-04-02 14:58 UTC by Chris Lalancette
Modified: 2007-11-30 22:07 UTC (History)
3 users (show)

Fixed In Version: RHEA-2007-0643
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2007-11-07 17:26:48 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2007:0643 normal SHIPPED_LIVE libvirt enhancement update 2007-11-08 14:15:22 UTC

Description Chris Lalancette 2007-04-02 14:58:31 UTC
Description of problem:
It would be very useful to have virsh able to block-attach/block-detach devices,
as xm can currently do:

# xm block-attach <dom> <backend> <frontend> <mode>


# xm block-detach <dom> <vdev>

In particular it would be good to use a virsh block-attach command, and REALLY
useful to use the block-detach command; currently the block-detach syntax is
horrible since the user has to figure out what vdev corresponds to the block
device they originally attached.

Comment 2 RHEL Product and Program Management 2007-04-25 20:15:06 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update

Comment 3 Daniel Berrange 2007-06-14 19:53:42 UTC
In libvirt-0.2.3-1.el5 which was recently built for dist-5E-qu-candidate there
is a generic command line  'virsh device-attach' and 'virsh device-detach' which
allow a snippet of XML describing the libvirt device to be provided.


 # cat > newdev.xml <<EOF
    <disk type='file' device='disk'>
      <driver name='file'/>
      <source file='/var/lib/xen/images/mydata.img'/>
      <target dev='xvdb'/>
 # virsh attach-device myguest newdev.xml

NB, this only works for paravirt guests since HVM does not have device hotplug.

Comment 4 Daniel Veillard 2007-06-19 12:59:45 UTC
Added an extra patch which is upstream which work by giving the arguments 
directly on the command line instead of via an XML file. The patch was 
applied upstream:

Tue Jun 19 11:11:18 CEST 2007 Daniel Veillard <>

        * src/virsh.c: applied patch from Masayuki Sunou providing a pair
          of alternate attach/detach commands

I guess this really fixes the issue, a new package libvirt-0.2.3-3.el5
has been pushed to dist-5E-qu-candidate with those.


Comment 8 errata-xmlrpc 2007-11-07 17:26:48 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 the 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.

Note You need to log in before you can comment on or make changes to this bug.