[libvirt] [Query] In search of 'lost' fc_host adapters ?

Prerna Saxena prerna at linux.vnet.ibm.com
Fri Aug 1 10:21:38 UTC 2014


Hi,

I recently found that libvirt failed to display Fiber Channel adapters on systems with FC cards.This occured both on x86 as well as powerpc, as follows:

virsh # nodedev-list --cap fc_host
virsh #
  


The system had legitimate fc_hosts :
[root at localhost ~]# ls /sys/class/fc_host/
host1  host2  host3  host4
[root at localhost ~]#

Debugging further, I found that libvirt has correctly identified the fiber channel host adapters. This could be independently verified by checking capabilities for individual
host adapters. As an example,

[root at localhost ~]# virsh nodedev-dumpxml scsi_host1
<device>
   <name>scsi_host1</name>
   <path>/sys/devices/pci0000:00/0000:00:00.0/0000:01:00.0/host1</path>
   <parent>pci_0000_01_00_0</parent>
   <capability type='scsi_host'>
     <host>1</host>
     <capability type='fc_host'>     ===> Fiber channel host.
       <wwnn>20000120fa2cf086</wwnn>
       <wwpn>10000090fa2cf086</wwpn>
       <fabric_wwn>1000000533bedc10</fabric_wwn>
     </capability>
     <capability type='vport_ops'>
       <max_vports>255</max_vports>
       <vports>0</vports>
     </capability>
   </capability>
</device>

However, a virsh query for available fc_host adapters seemed to fail.

I found this was happening because the callbacks pertaining to NodeDevice for the virsh connection pointer were those of "Remote" driver, in place of the "Udev" Node device driver.
The remote driver callback :
static int remoteConnectListAllNodeDevices(virConnectPtr conn,
                                 virNodeDevicePtr **devices,
                                 unsigned int flags)

This didnt seem  to process fiber channel host flag, and so my query returned a blank list.
For the problem at hand , it is easy to fix the remote driver to process fc_hosts. But this would unnecessarily duplicate code between udev & remote drivers.

I need some pointers on how callbacks get chosen by libvirt.

The logs show that:
2014-07-31 10:45:43.226+0000: 22913: debug : virRegisterNodeDeviceDriver:619 : registering Test as device driver 0
...
2014-07-31 10:45:43.226+0000: 22913: debug : virRegisterNodeDeviceDriver:619 : registering ESX as device driver 1
...
2014-07-31 10:45:43.226+0000: 22913: debug : virRegisterNodeDeviceDriver:619 : registering remote as device driver 2
...
2014-07-31 10:45:43.228+0000: 22913: debug : virRegisterNodeDeviceDriver:619 : registering udevNodeDeviceDriver as device driver 3

How does libvirt connection register all callbacks for the remote driver, given choice of 4 drivers --test, ESX, remote or Udev ?
Is there a way we can set a preference for the udev driver to be used first -- such that the remote can just be a sane "default" if nothing else is available??

Looking forward to suggestions on how I can fix this ?
BTW, I tried disabling the remote using configure script, but that meant scsi driver (and a few others) got disabled too.


Regards,
-- 
Prerna Saxena

Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India




More information about the libvir-list mailing list