RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 619190 - virsh attach-device fails to attach a new device to a KVM guest
Summary: virsh attach-device fails to attach a new device to a KVM guest
Keywords:
Status: CLOSED DUPLICATE of bug 589662
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Daniel Veillard
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-07-28 20:02 UTC by Nandini Chandra
Modified: 2010-08-18 08:27 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-08-18 08:27:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Nandini Chandra 2010-07-28 20:02:47 UTC
Description of problem:
'virsh attach-device' fails to attach a new device to an active KVM guest.It fails with the following error message:

# virsh attach-device RHEL60beta2_kvm disk1.xml
error: Failed to attach device from disk1.xml
error: internal error unable to execute QEMU command '__com.redhat_drive_add': Device 'drive-virtio-disk1' could not be initialized

Version-Release number of selected component (if applicable):
libvirt-0.8.1-15.el6.x86_64
qemu-kvm-0.12.1.2-2.96.el6.x86_64
qemu-img-0.12.1.2-2.96.el6.x86_64

[root@ibm-hs21-1 ~]# uname -r
2.6.32-52.el6.x86_64
 

How reproducible:
Consistently

Steps to Reproduce:
1.[root@ibm-hs21-1 ~]# cat disk-block.xml
> <disk type='block' device='disk'>
> <source dev='/dev/sda3'/>
> <target dev='vdb' bus='virtio'/>
> </disk>

[root@ibm-hs21-1 ~]# ll /dev/sda3
brw-rw----. 1 root root 8, 3 Jul 26 21:54 /dev/sda3

2.[root@ibm-hs21-1 ~]# virsh attach-device rhel6beta2 disk-block.xml
 error: Failed to attach device from disk-block.xml
 error: internal error unable to execute QEMU command 
 '__com.redhat_drive_add': Device 'drive-virtio-disk1' could not be initialized

It doesn't work for disk type='block' as shown in the above example.

  
Actual results:
virsh attach-device fails to attach a device to an active domain.


Expected results:
virsh attach-device should attach a device to an active domain.

Additional info:
It works for disk type='file'.

[root@ibm-hs21-1 ~]# cat disk-file.xml
<disk type="file" device="disk">
 <source file="/root/dd.img"/>
 <target dev="vdc" bus="virtio"/>
</disk>

[root@ibm-hs21-1 ~]# ll /root/dd.img
-rw-r--r--. 1 root root 10485760 Jul 26 22:07 /root/dd.img

[root@ibm-hs21-1 ~]# virsh attach-device rhel6beta2 disk-file.xml
Device attached successfully

Comment 1 RHEL Program Management 2010-07-28 20:17:50 UTC
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **

Comment 2 Daniel Veillard 2010-07-30 17:35:03 UTC
Well, that works for me fine, I can't reproduce it with the
current stack:

[root@test tmp]# virsh attach-device test6.1 disk-block.xml
Device attached successfully

[root@test tmp]# getenforce
Enforcing
[root@test tmp]# rpm -q libvirt qemu-kvm qemu-img
libvirt-0.8.1-20.el6.x86_64
qemu-kvm-0.12.1.2-2.104.el6.x86_64
qemu-img-0.12.1.2-2.104.el6.x86_64
[root@test tmp]# ls -l /dev/sdb1
brw-rw----. 1 qemu qemu 8, 17 Jul 31 02:45 /dev/sdb1
[root@test tmp]# virsh detach-device test6.1 disk-block.xml
Device detached successfully

[root@test tmp]# ls -l /dev/sdb1
brw-rw----. 1 root disk 8, 17 Jul 31 03:28 /dev/sdb1
[root@test tmp]# cat disk-block.xml
<disk type='block' device='disk'>
  <source dev='/dev/sdb1'/>
  <target dev='vdb' bus='virtio'/>
</disk>


[root@test tmp]# 


In the guest I saw in dmesg the virtio-pci logs ending up with
 vbb: unknown partition table.

I also tried with an /dev/sr0 device read-only that worked fine too
and the attachemnt of a file based device also worked fine.

Could you double check with the recent stack as this seems to work
fine for me with current packages.
Also what kind of guest are you using ?
And did you get any error on the qemu logs ?

Daniel

Comment 7 Daniel Veillard 2010-08-12 09:06:32 UTC
I logged in the box yesterday and could reproduce the issue
it's very strange indeed, nothing seems to be wrong ... except that
specific command doesn't work, I will try to debug the issue further if you can keep the access to that machine and setup for me.
One question though, the guest is running for a week now, did you update any
of the libvirt or kvm packages on that box since then ?

Daniel

Comment 10 Daniel Berrangé 2010-08-17 10:12:30 UTC
> > And did you get any error on the qemu logs ?
> 
> /var/log/libvirt/qemu/rhel6beta2.log
> ----------
> qemu: could not open disk image /dev/sda3: Operation not permitted

What kernel version do you have, and are any of the 'cgroup' filesystems shown in /proc/mounts ?

I expect this is a duplicate of this kernel bug.

https://bugzilla.redhat.com/show_bug.cgi?id=589662

Comment 11 Daniel Veillard 2010-08-17 20:30:30 UTC
I logged on the test machine, stopped cgconfig, 
[root@ibm-hs21-1 tmp]# /etc/init.d/cgconfig stop
Stopping cgconfig service:                                 [  OK  ]
[root@ibm-hs21-1 tmp]# /etc/init.d/libvirtd restart
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]
[root@ibm-hs21-1 tmp]# 
[root@ibm-hs21-1 tmp]# virsh attach-device rhel6beta2 disk-block.xml
Device attached successfully

[root@ibm-hs21-1 tmp]# 


so that could be the problem, yes

[root@ibm-hs21-1 tmp]# ls /cgroup/
[root@ibm-hs21-1 tmp]# 

Daniel

Comment 12 Daniel Berrangé 2010-08-18 08:27:37 UTC

*** This bug has been marked as a duplicate of bug 589662 ***


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