Bug 234840 - Add a virsh block-attach/block-detach command
Add a virsh block-attach/block-detach command
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: libvirt (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Daniel Veillard
Depends On:
  Show dependency treegraph
Reported: 2007-04-02 10:58 EDT by Chris Lalancette
Modified: 2007-11-30 17:07 EST (History)
3 users (show)

See Also:
Fixed In Version: RHEA-2007-0643
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-11-07 12:26:48 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Chris Lalancette 2007-04-02 10:58:31 EDT
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 16:15:06 EDT
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 15:53:42 EDT
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 08:59:45 EDT
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 <veillard@redhat.com>

        * 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 12:26:48 EST
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.