Bug 1028629 - virsh nodedev-detach fails if device has no driver
virsh nodedev-detach fails if device has no driver
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: libvirt (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Cole Robinson
Fedora Extras Quality Assurance
:
Depends On: 1018897
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-08 17:07 EST by Alex Williamson
Modified: 2013-11-12 10:15 EST (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-11-12 10:15:05 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Alex Williamson 2013-11-08 17:07:29 EST
Description of problem:
If I have an Nvidia graphics card with nouveau blacklisted in the host then the device will have no "driver" entry in sysfs.  If I then try to make use of it with libvirt, I get:

# virsh nodedev-detach pci_0000_01_00_0 --driver=vfio
error: Failed to detach device pci_0000_01_00_0
error: internal error: Invalid device 0000:01:00.0 driver file /sys/bus/pci/devices/0000:01:00.0/driver is not a symlink

If the device is already attached to a driver like pci-stub, then the above will succeed and move the device to vfio-pci.  This does not seem to be specific to vfio support, --driver=kvm behaves the same.

Version-Release number of selected component (if applicable):
1.1.4-1.fc20.x86_64

How reproducible:
always

Steps to Reproduce:
1. Find or create a device with no drivers
2. Attempt to use virsh to detach it from the host
3.

Actual results:
Does not work

Expected results:
Device moved to requested driver regardless of having an initial driver.

Additional info:
Comment 1 Jiri Denemark 2013-11-11 03:43:34 EST
This should be fixed upstream by the following commit:

commit df4283a55bf3516b333352e2052dbe3317936953
Author:     Michal Privoznik <mprivozn@redhat.com>
AuthorDate: Thu Oct 31 10:32:58 2013 +0000
Commit:     Michal Privoznik <mprivozn@redhat.com>
CommitDate: Mon Nov 4 17:28:51 2013 +0100

    virpci: Don't error on unbinded devices
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1018897
    
    If a PCI deivce is not binded to any driver (e.g. there's yet no PCI
    driver in the linux kernel) but still users want to passthru the device
    we fail the whole operation as we fail to resolve the 'driver' link
    under the PCI device sysfs tree. Obviously, this is not a fatal error
    and it shouldn't be error at all.
    
    Signed-off-by: Michal Privoznik <mprivozn@redhat.com>

v1.1.4-15-gdf4283a
Comment 2 Cole Robinson 2013-11-12 09:36:47 EST
I've pushed that patch to the libvirt 1.1.3 maint branch (the f20 version). The initial report is against the virt-preview/rawhide version though, and that's where the GPU passthrough testing is currently happening, so I'll do a rawhide build with the fix for now. The next maint release will pick it up for F20.
Comment 3 Cole Robinson 2013-11-12 10:15:05 EST
Fixed in libvirt-1.1.4-2.fc21

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