Bug 1028629 - virsh nodedev-detach fails if device has no driver
Summary: virsh nodedev-detach fails if device has no driver
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: libvirt
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Cole Robinson
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1018897
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-11-08 22:07 UTC by Alex Williamson
Modified: 2013-11-12 15:15 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-11-12 15:15:05 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Alex Williamson 2013-11-08 22:07:29 UTC
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 08:43:34 UTC
This should be fixed upstream by the following commit:

commit df4283a55bf3516b333352e2052dbe3317936953
Author:     Michal Privoznik <mprivozn>
AuthorDate: Thu Oct 31 10:32:58 2013 +0000
Commit:     Michal Privoznik <mprivozn>
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>

v1.1.4-15-gdf4283a

Comment 2 Cole Robinson 2013-11-12 14:36:47 UTC
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 15:15:05 UTC
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.