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
Status: CLOSED DUPLICATE of bug 589662
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt   
(Show other bugs)
Version: 6.0
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Daniel Veillard
QA Contact: Virtualization Bugs
Keywords: RHELNAK
Depends On:
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:
Story Points: ---
Clone Of:
Last Closed: 2010-08-18 08:27:37 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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):

[root@ibm-hs21-1 ~]# uname -r

How reproducible:

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"/>

[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 Product and 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
[root@test tmp]# rpm -q libvirt qemu-kvm qemu-img
[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'/>

[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 ?


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 ?


Comment 10 Daniel Berrange 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.


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]# 


Comment 12 Daniel Berrange 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.