Bug 1018897 - Nodedev-detach fails for devices without driver
Summary: Nodedev-detach fails for devices without driver
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: All
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 1028629
TreeView+ depends on / blocked
 
Reported: 2013-10-14 16:10 UTC by Vlastimil Holer
Modified: 2013-11-11 08:43 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1019387 (view as bug list)
Environment:
Last Closed: 2013-11-04 16:33:24 UTC
Embargoed:


Attachments (Terms of Use)

Description Vlastimil Holer 2013-10-14 16:10:56 UTC
Description of problem:
When device is not managed by any driver (real or stub), sysfs device entries doesn't contain "driver" symlink. Domain with PCI device in managed mode fails to start due to missing "driver" symlink on sysfs. Libvirt nodedev-detach fails as well.

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

How reproducible:

Steps to Reproduce:
1. find device without driver
2. virsh nodedev-detach pci_...

Actual results:
Device must be manually assigned to stub driver.

Expected results:
Device is assigned to stub driver automatically.

Additional info:
# ls -a /sys/bus/pci/devices/0000:03:00.0/
.			  enable	 msi_bus    resource2
..			  firmware_node  numa_node  resource2_wc
broken_parity_status	  index		 power	    subsystem
class			  irq		 remove     subsystem_device
config			  label		 rescan     subsystem_vendor
consistent_dma_mask_bits  local_cpulist  reset	    uevent
device			  local_cpus	 resource   vendor
dma_mask_bits		  modalias	 resource0  vpd

# virsh create deployment.0
setlocale: No such file or directory
error: Failed to create domain from deployment.0
error: internal error: Invalid device 0000:03:00.0 driver file /sys/bus/pci/devices/0000:03:00.0/driver is not a symlink

# virsh nodedev-detach pci_0000_03_00_0
setlocale: No such file or directory
error: Failed to detach device pci_0000_03_00_0
error: internal error: Invalid device 0000:03:00.0 driver file /sys/bus/pci/devices/0000:03:00.0/driver is not a symlink

# modprobe pci_stub ids=15b3:1003
# virsh nodedev-detach pci_0000_03_00_0
Device pci_0000_03_00_0 detached

Comment 1 Michal Privoznik 2013-11-04 16:33:24 UTC
I've just pushed patch to upstream to fix this issue:

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


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