Bug 658713 - virsh attach-disk --persistent unsupported on kvm
Summary: virsh attach-disk --persistent unsupported on kvm
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Eric Blake
QA Contact: Virtualization Bugs
Depends On:
TreeView+ depends on / blocked
Reported: 2010-12-01 03:36 UTC by Eric Blake
Modified: 2018-11-28 21:42 UTC (History)
9 users (show)

Fixed In Version: libvirt-0.9.2-1.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2011-12-06 10:52:53 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1513 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2011-12-06 01:23:30 UTC

Description Eric Blake 2010-12-01 03:36:24 UTC
Description of problem:
The only way to persistently add a disk to a qemu-kvm guest is to manually edit the xml, since qemudDomainAttachDeviceFlags rejects VIR_DOMAIN_DEVICE_MODIFY_CONFIG.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
[root@ntc164 utils]# qemu-img create /var/lib/libvirt/images/KVM-Guest-2.img 8G
Formatting '/var/lib/libvirt/images/KVM-Guest-2.img', fmt=raw, size=8388608 kB
[root@ntc164 utils]# virsh attach-disk KVM-Guest-1 /var/lib/libvirt/images/KVM-Guest-2.img hdb
error: Failed to attach disk
error: this function is not supported by the connection driver: disk bus 'ide' cannot be hotplugged.

[root@ntc164 utils]# virsh destroy KVM-Guest-1
Domain KVM-Guest-1 destroyed

[root@ntc164 utils]# virsh attach-disk KVM-Guest-1 /var/lib/libvirt/images/KVM-Guest-2.img hdb
error: Failed to attach disk
error: Requested operation is not valid: cannot attach device on inactive domain

[root@ntc164 utils]# virsh attach-disk KVM-Guest-1 /var/lib/libvirt/images/KVM-Guest-2.img hdb --type disk --driver qemu --subdriver raw  --mode readonly
error: No support for qemu in command 'attach-disk'

Actual results:
All attempts to use virsh shorthand fail; the only way to add the device is through 'virsh edit' or other full xml editing.

Expected results:
virsh attach-disk --persistent should avoid the need for a manual xml edit

Additional info:

Comment 2 Suzanne Yeghiayan 2011-03-28 21:14:59 UTC
Since RHEL 6.1 External Beta has begun, and this bug remains 
unresolved, it has been rejected as it is not proposed as an 
exception or blocker.

Red Hat invites you to ask your support representative to 
propose this request, if appropriate and relevant, in the 
next release of Red Hat Enterprise Linux.

Comment 4 Eric Blake 2011-06-20 16:43:36 UTC
Fixed upstream (and therefore will be picked up by rebase); upstream patch series includes:

commit f37c29c8aa32390c68eb79614d69c2bc7f6d5e8f
Author: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Date:   Fri Apr 22 12:10:28 2011 +0900

    libvirt/qemu - support persistent update of disks
    Support update of disks by MODIFY_CONFIG
    This patch includes changes for qemu's disk to support
    virDomainUpdateDeviceFlags() with VIR_DOMAIN_DEVICE_MODIFY_CONFIG.
    This patch adds support for CDROM/foppy disk types.
    Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

Comment 5 Daniel Veillard 2011-06-23 02:41:09 UTC
This should be fixed by the libvirt-0.9.2-1.el6 rebase

Comment 8 Huang Wenlong 2011-06-23 06:12:14 UTC
Version-Release number of selected component:


Test steps : 
1)qemu-img create /var/lib/libvirt/images/test-disk.img 8G

2)When the guest is active ,run the command 

#virsh attach-disk fedora14 /var/lib/libvirt/images/test-disk.img vdb --persistent
error: Failed to attach disk
error: operation failed: drive hotplug is not supported

3)destroy the guest 
# virsh destroy fedora14

3)When the guest is inactive ,run the command 
# virsh attach-disk fedora14 /var/lib/libvirt/images/test-disk.img vdb 
error: Failed to attach disk
error: Requested operation is not valid: cannot do live update a device on inactive domain

4)add --persistent option 
# virsh attach-disk fedora14 /var/lib/libvirt/images/test-disk.img vdb --persistent 
Disk attached successfully

So the --persistent is effective

Comment 10 Rita Wu 2011-07-06 10:28:39 UTC
Set it as VERIFIED per comment8

Comment 11 errata-xmlrpc 2011-12-06 10:52:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


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