Bug 510679 - host pci device hot-unplug is not implemented
Summary: host pci device hot-unplug is not implemented
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: libvirt
Version: 5.4
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Jiri Denemark
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 5.4, TechnicalNotes
TreeView+ depends on / blocked
 
Reported: 2009-07-10 08:58 UTC by Shaohui
Modified: 2011-01-13 22:51 UTC (History)
14 users (show)

Fixed In Version: libvirt-0.8.2-1.el5
Doc Type: Bug Fix
Doc Text:
Hotunplug of PCI devices is not supported in this release. This feature will be introduced in a future update.
Clone Of:
Environment:
Last Closed: 2011-01-13 22:51:46 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
log file from virt-manager (53.53 KB, text/plain)
2009-07-13 02:47 UTC, Shaohui
no flags Details
dumpxml from virsh (1.20 KB, text/plain)
2009-07-14 09:20 UTC, Shaohui
no flags Details
xend.log (1.46 KB, text/plain)
2009-07-14 15:35 UTC, Jiri Denemark
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2011:0060 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2011-01-12 17:22:30 UTC

Description Shaohui 2009-07-10 08:58:45 UTC
Description of problem:

We can assign NIC devices to guest statically, and we can see it in the
virt-manager control-panel. it lists all the assigned device in the guest.

virt-manager has a button to remove the assigned device, but after I click the
button, the device is still here. it does not remove the device in fact.

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


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Cole Robinson 2009-07-13 00:06:20 UTC
Thanks for the report. Can you please attach ~/.virt-manager/virt-manager.log?

Comment 2 Shaohui 2009-07-13 02:47:01 UTC
Created attachment 351418 [details]
log file from virt-manager

Comment 4 Cole Robinson 2009-07-13 13:32:11 UTC
Relevant portion:

[Mon, 13 Jul 2009 10:43:26 virt-manager 6706] DEBUG (domain:1111) Hostdev xpath string: /domain/devices/hostdev[@type='pci' and source/address/@bus='0x00' and source/address/@slot='0x19' and source/address/@function='0x0' and source/address/@domain='0x0000']
[Mon, 13 Jul 2009 10:43:26 virt-manager 6706] DEBUG (details:1767) Device could not be hotUNplugged: POST operation failed: xend_post: error from xen daemon: (xend.err "(22, 'Invalid argument')")

So this is likely a libvirt or xen bug. Reassigning to libvirt for now.

Shaohui, can you attach the XML of guest (virsh dumpxml <vmname>) with the host device attached? Thanks.

Comment 6 Shaohui 2009-07-14 09:20:14 UTC
Created attachment 351566 [details]
dumpxml from virsh

    <hostdev mode='subsystem' type='pci' managed='no'>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x19' function='0x0'/>
      </source>
    </hostdev>
  </devices>

I see a suspected field managed='no'. it might be the root cause.

Comment 7 Daniel Berrangé 2009-07-14 09:26:34 UTC
For the Libvirt Xen driver, PCI devices are always setup with managed='no', only QEMU allows for managed='yes'.

I'm thinking it looks like a XenD bug - could you provide the /var/log/xen/xend.log file from just after the failure to unplug. It should give us more info about the errro.

Comment 8 Jiri Denemark 2009-07-14 15:35:59 UTC
Created attachment 351605 [details]
xend.log

I was able to reproduce it and attached is what shows in xend.log when hitting the remove button in virt-manager.

Comment 9 Jiri Denemark 2009-07-14 15:58:16 UTC
I investigated a bit further and xend gets a request with the following arguments:
{'type': ['`\xfc\x8d\t\xff\x7f'],
 'force': ['0'],
 'dev': ['\xd8B\xfe '],
 'rm_cfg': ['1'],
 'op': ['device_destroy']}

I guess the type should have been 'pci'.

Comment 10 Bill Burns 2009-07-15 17:54:51 UTC
Dan, any reply to Jirka's comment #9.

Comment 11 Daniel Berrangé 2009-07-15 18:41:20 UTC
Hang on a minute. We never actually implemented PCI device hotplug/unplug for the libvirt Xen driver, so I'm surprised its even getting as far as XenD.

Comment 12 Daniel Berrangé 2009-07-15 18:45:31 UTC
Oh I tell a lie, we partially implemented it. Hotplug should work, but hotunplug will not.


Unfortunately  we left some bogus code in virDomainXMLDevID() method, 


    } else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
               dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
               dev->data.hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
    } else {
        virXendError(NULL, VIR_ERR_NO_SUPPORT,
                     "%s", _("hotplug of device type not supported"));
        return -1;
    }

    return 0;


so it'll return success, even though its not implemented. We should remove that test for PCI hostdevs here, so you'll get a proper error from libvirt, and then target a real implementation for RHEL-5.5

Comment 17 Daniel Berrangé 2009-08-20 12:00:31 UTC
Release note added. If any revisions are required, please set the 
"requires_release_notes" flag to "?" and edit the "Release Notes" field accordingly.
All revisions will be proofread by the Engineering Content Services team.

New Contents:
Hotunplug of PCI devices is not supported in this release. This feature will be introduced in a future update.

Comment 20 Daniel Veillard 2010-01-15 08:07:47 UTC
Okay, at this point it's clear it's too late for 5.5, so retargetted for 5.6,

Daniel

Comment 23 Xu Jiajun 2010-02-11 14:23:31 UTC
Test with RHEL5.5 Beta, pci device hot-unplug can not work in Virt-Manager for both Xen and KVM.

Comment 24 Xu Jiajun 2010-02-11 17:09:05 UTC
(In reply to comment #23)
> Test with RHEL5.5 Beta, pci device hot-unplug can not work in Virt-Manager for
> both Xen and KVM.    


Seems what I met is another issue while the assigned device is MFD behind a bridge. If the device is single device, the hot-unplug can work in RHEL5.5 Beta. So pls. skip my comments in comment 23. 

I will open another bug for the MFD hotplug issue.

Comment 25 Dave Allan 2010-07-06 19:18:57 UTC
Re: comment 24, are you saying that the problem is fixed?

Comment 27 Jiri Denemark 2010-09-02 11:57:01 UTC
Fixed in libvirt-0.8.2-1.el5

Comment 30 Jiri Denemark 2010-10-14 11:40:42 UTC
The comment #29 is irrelevant, this bug is for xen hypervisor, not kvm.

Comment 31 koka xiong 2010-10-21 04:49:53 UTC
Verified on Server-x86_64-Xen and Client-i386-Xen
ia64-Xen doesn't support modprobe acpiphp

1. # virsh nodedev-list --tree
2. # virsh nodedev-dumpxml pci_8086_10bd
3. Dettach this network device from host
 virsh nodedev-dettach pci_8086_10bd
4. Add the following code to <guest> xml file
...
<hostdev mode='subsystem' type='pci'>
<source>
<address bus='0' slot='25' function='0'/>
</source>
</hostdev>
...
5.virsh start <guest>
6.run #modprobe acpiphp on guest # 
7.On virt-manager remove the device,device can be removed

Comment 33 errata-xmlrpc 2011-01-13 22:51:46 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/RHEA-2011-0060.html


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