Bug 613546

Summary: virt-manager: option to see error message if hotplug fails
Product: Red Hat Enterprise Linux 6 Reporter: weizhang <weizhan>
Component: virt-managerAssignee: Cole Robinson <crobinso>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: dallan, dyuan, llim, mliu, mzhan, xen-maint
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 13:46:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description weizhang 2010-07-12 08:23:36 UTC
Description of problem:
When adding hardware(type storage) for a running guest by using virt-manager manually, it will pop-up a dialog box said "This device could not be attached to the running machine. Would you like to make the device available after the next VM shutdown?" which means that it does not support hotplug. It includes on adding IDE disk, IDE cdrom, Floppy disk, usb, virto disk, SCSI.

Now libvirt supports hotplug.

Version-Release number of selected component (if applicable):
libvirt-0.8.1-13.el6.x86_64
virt-manager-0.8.4-6.el6.noarch
kernel 2.6.32-37.el6.x86_64

How reproducible:
always

Steps to Reproduce:
This is on IDE cdrom adding. The others are similar
1.Launch virt-manager: #virt-manager
2.Double-click a vm and click the Run button in the Virtual Machine Details window.
3.Click the Hardware tab.
4.Click Add Hardware button
5.Select Storage in Hardware type droplist and click Forward.
6.Select managed or other existing storage and then click Browse to find a iso.
7.Select IDE cdrom in Device type then click Forward.
8.Click Finish button.

  
Actual results:
1. After step8, a dialog box pup-up to tell you that the device could not be attached to the running machine until next reboot. 

Expected results:
1. After step8, new virtual disk is added and can be used well in the guest.

Additional info:

Comment 2 Cole Robinson 2010-07-12 14:53:46 UTC
Can you provide ~/.virt-manager/virt-manager.log or reproduce running with the --debug flag?

Certain disk types can't hotplug AIUI (like IDE, Floppy device, ...). At least virtio and USB should work. virt-manager doesn't really care though, it will always attempt a hotplug and only show that 'attach after reboot' dialog if the hotplug failed. The log should show us the relevant hotplug failure errors.

We should probably show a little 'details' expander if the hotplug fails so the user can see an error message though.

Comment 3 weizhang 2010-07-13 01:50:09 UTC
The ~/.virt-manager/virt-manager.log is as follow on usb adding:

[Tue, 13 Jul 2010 09:44:46 virt-manager 4733] DEBUG (addhardware:1060) Starting background file allocate process
[Tue, 13 Jul 2010 09:44:46 virt-manager 4733] DEBUG (addhardware:1062) Allocation completed
[Tue, 13 Jul 2010 09:44:46 virt-manager 4733] DEBUG (addhardware:1022) Adding device:
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/rhel55-i386.img'/>
      <target dev='sda' bus='usb'/>
    </disk>
[Tue, 13 Jul 2010 09:44:46 virt-manager 4733] DEBUG (addhardware:1029) Device could not be hotplugged: internal error unable to execute QEMU command 'drive_add': The command drive_add has not been found

It is similar with virto disk adding.

Comment 4 weizhang 2010-07-13 02:20:37 UTC
I find the similar bug 573946 about virtio hotplug on libvirt, I think the usb hotplug also has the same problem. As Cole said that there should be an error show to us when hotplug failed, but it doesn't have now.

Comment 5 Cole Robinson 2010-07-13 12:34:31 UTC
Okay, not a critical RFE then. Moving to 6.1

Comment 6 dyuan 2010-07-14 01:56:39 UTC
Does the 'dev' in summary involve the cpu ? I found the same issue on cpu hotplug with a libvirt Bug 573597.

Comment 7 Cole Robinson 2010-07-14 13:43:03 UTC
It can. Changing the desc.

Comment 8 weizhang 2010-07-15 09:36:09 UTC
what about the scsi hotplug? Should it be supported?

Comment 9 Cole Robinson 2010-07-15 15:13:24 UTC
SCSI isn't supported for RHEL6 AFAIU.

Comment 10 Cole Robinson 2010-12-02 17:50:59 UTC
Fixed upstream:

http://hg.fedorahosted.org/hg/virt-manager/rev/60f80fc312d3

Comment 11 Cole Robinson 2011-01-14 22:15:26 UTC
Fixed in virt-manager-0.8.6-1.el6

Comment 13 Min Zhan 2011-01-18 07:45:03 UTC
Verified with passed in virt-manager-0.8.6-1.el6

# uname -a
Linux dhcp-65-85.nay.redhat.com 2.6.32-99.el6.x86_64 #1 SMP Fri Jan 14 10:46:00
EST 2011 x86_64 x86_64 x86_64 GNU/Linux

kernel-2.6.32-99.el6.x86_64
qemu-kvm-0.12.1.2-2.129.el6.x86_64
libvirt-0.8.7-1.el6.x86_64

===========================
Now virtio disk can support hotplug/unplug in virt-manager.Others like IDE,IDE-CDROM, Floppy will display error message when hotplug/unplug as following:

** Error message for hotplug with disk type as IDE-CDROM **

This device could not be attached to the running machine. Would you like to make the device available after the next VM shutdown?
Details:
internal error No device with bus 'ide' and target 'hdc'

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/addhardware.py", line 911, in add_device
    self.vm.attach_device(self._dev)
  File "/usr/share/virt-manager/virtManager/domain.py", line 1159, in attach_device
    self._backend.attachDevice(devxml)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 263, in attachDevice
    if ret == -1: raise libvirtError ('virDomainAttachDevice() failed', dom=self)
libvirtError: internal error No device with bus 'ide' and target 'hdc'


** Error message for hotunplug disk type as IDE-CDROM **

Device could not be removed from the running machine
This change will take effect after the next VM reboot.
Details:
unsupported configuration: This type of device cannot be hot unplugged

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/details.py", line 1776, in remove_device
    self.vm.detach_device(dev_id_info)
  File "/usr/share/virt-manager/virtManager/domain.py", line 1169, in detach_device
    self._backend.detachDevice(xml)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 353, in detachDevice
    if ret == -1: raise libvirtError ('virDomainDetachDevice() failed', dom=self)
libvirtError: unsupported configuration: This type of device cannot be hot unplugged

Comment 15 mliu 2011-04-18 05:34:25 UTC
Verified this bug passed with virt-manager-0.8.6-3.el6

Comment 16 errata-xmlrpc 2011-05-19 13:46:10 UTC
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 therefore 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.

http://rhn.redhat.com/errata/RHBA-2011-0637.html