Bug 847355

Summary: libvirtError virDomainAttachDevice() failed
Product: [Fedora] Fedora Reporter: Mads Kiilerich <mads>
Component: virt-managerAssignee: Cole Robinson <crobinso>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: berrange, crobinso, dpierce, hbrock, jforbes, mads, virt-maint
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-10-31 01:09:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mads Kiilerich 2012-08-10 17:03:40 UTC
When trying to add hardware to my f16 instance running on f17 host it fails. The details tell a stacktrace also shown in the debug output:

2012-08-10 18:55:20,700 (addhardware:1152): Adding device:
    <redirdev bus='usb' type='spicevmc'/>
2012-08-10 18:55:20,713 (addhardware:1159): Device could not be hotplugged: internal error unable to execute QEMU command 'device_add': Property 'usb-redir.chardev' can't find value 'charredir0'
2012-08-10 18:55:20,719 (error:80): dialog message: Are you sure you want to add this device? : internal error unable to execute QEMU command 'device_add': Property 'usb-redir.chardev' can't find value 'charredir0'

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/addhardware.py", line 1157, in add_device
    self.vm.attach_device(self._dev)
  File "/usr/share/virt-manager/virtManager/domain.py", line 758, in attach_device
    self._backend.attachDevice(devxml)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 400, in attachDevice
    if ret == -1: raise libvirtError ('virDomainAttachDevice() failed', dom=self)
libvirtError: internal error unable to execute QEMU command 'device_add': Property 'usb-redir.chardev' can't find value 'charredir0'

2012-08-10 18:56:57,191 (addhardware:167): Closing addhw
2012-08-10 18:56:58,816 (addhardware:161): Showing addhw
2012-08-10 18:57:09,938 (addhardware:1152): Adding device:
    <filesystem>
      <source dir='/share'/>
      <target dir='/share'/>
    </filesystem>
2012-08-10 18:57:09,940 (addhardware:1159): Device could not be hotplugged: unsupported configuration: device type 'filesystem' cannot be attached
2012-08-10 18:57:09,941 (error:80): dialog message: Are you sure you want to add this device? : unsupported configuration: device type 'filesystem' cannot be attached

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/addhardware.py", line 1157, in add_device
    self.vm.attach_device(self._dev)
  File "/usr/share/virt-manager/virtManager/domain.py", line 758, in attach_device
    self._backend.attachDevice(devxml)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 400, in attachDevice
    if ret == -1: raise libvirtError ('virDomainAttachDevice() failed', dom=self)
libvirtError: unsupported configuration: device type 'filesystem' cannot be attached


I am a newbie in this area and might be doing something wrong, but I would expect some helpful messages instead of traces.

virt-manager-0.9.4-1.fc17.noarch
qemu-kvm-1.0.1-1.fc17.x86_64
libvirt-0.9.11.4-3.fc17.x86_64

Comment 1 Cole Robinson 2012-10-14 00:51:11 UTC
I think these are both expected errors: they are just telling you that the device could not be attached while the VM is running. virt-manager doesn't really have a way to tell what devices are hotpluggable and what aren't, so we try it and then give the user some feedback. Your devices should be attached after rebooting the VM.

Closing as NOTABUG, please reopen if I've missed something.

Comment 2 Mads Kiilerich 2012-10-14 15:30:42 UTC
It is absolutely OK that it cannot do hotplugging and that I as user should be told that it cannot be hotplugged.

But I would still expect that it should respond with an "ok, everthing is fine, restart the VM to apply the changes" instead of telling me that the operation failed and with a stacktrace as the only explanation.

Comment 3 Cole Robinson 2012-10-14 17:19:53 UTC
That's basically what we do. The text is

Are you sure you want to add this device?

The device could not be attached to the running machine. Would you like to make the device available after the next guest shutdown?

> Details


And the backtrace is under the details expander. Given that there's no programmatic way to tell ahead of time if hotplug is even possible, I think that's a pretty reasonable message.

We used to just say 'your device will be available after the next reboot' but people complained because for certain things like a USB drive that wasn't what they wanted at all, and there was no indication that we tried something that failed.

Do you have a suggested improvement?

Comment 4 Cole Robinson 2012-10-14 17:20:23 UTC
Forgot to set needinfo, please see comment #3

Comment 5 Cole Robinson 2012-10-31 01:09:33 UTC
No response for a couple weeks, so closing as NOTABUG.