From Fedora Project Wiki
Description
This test case checks that the libvirt node device dettach, reattach and reset operations work correctly. These operations were added to support device assignment.
How to test
- Verify that you have the correct nodedev name for the device
$> virsh nodedev-dumpxml pci_8086_10bd <device> <name>pci_8086_10bd</name> <parent>computer</parent> <capability type='pci'> <domain>0</domain> <bus>0</bus> <slot>25</slot> <function>0</function> <product id='0x10bd'>82566DM-2 Gigabit Network Connection</product> <vendor id='0x8086'>Intel Corporation</vendor> </capability> </device>
- Convert the address above to a hexidecimal PCI device address and check which driver is currently loaded
$> readlink /sys/bus/pci/devices/0000\:00\:19.0/driver ../../../bus/pci/drivers/e1000e
- Detach the device
$> virsh nodedev-dettach pci_8086_10bd Device pci_8086_10bd dettached
- Check that the device is now bound to the pci-stub driver
$> readlink /sys/bus/pci/devices/0000\:00\:19.0/driver ../../../bus/pci/drivers/pci-stub
- Reset the device
$> virsh nodedev-reset pci_8086_10bd Device pci_8086_10bd reset
- Re-attach the device:
$> virsh nodedev-reattach pci_8086_10bd Device pci_8086_10bd re-attached
- Check the device is bound to the original driver again
$> readlink /sys/bus/pci/devices/0000\:00\:19.0/driver ../../../bus/pci/drivers/e1000e
- Check that the device can still be used in the host - e.g. if it is a NIC, bring it up and try pinging a remote host
Expected Results
- All operations should complete successfully
- The device should be bound to pci-stub and then bound back to the original driver
- The device should operate correctly after it is re-attached