]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
nodedev: check/add for scsi_host caps for NumOfCaps and ListCaps
authorJohn Ferlan <jferlan@redhat.com>
Wed, 4 Feb 2015 13:10:52 +0000 (08:10 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 5 Feb 2015 12:50:32 +0000 (07:50 -0500)
commitf44ec9c1ab44415f826dfedb321fc20930e6a8a7
tree4c7655776aa32cd7f05ac9cfad22ee570e6d78f2
parente8fcac8ecb3fcd5078300b42a4940fb53b42603d
nodedev: check/add for scsi_host caps for NumOfCaps and ListCaps

Commit id '652a2ec6' introduced two new node device capability flags
and the ability to use those flags as a way to search for a specific
subset of a 'scsi_host' device - namely a 'fc_host' and/or 'vports'.
The code modified the virNodeDeviceCapMatch whichs allows for searching
using the 'virsh nodedev-list [cap]' via virConnectListAllNodeDevices.

However, the original patches did not account for other searches for
the same capability key from virNodeDeviceNumOfCaps and virNodeDeviceListCaps
using nodeDeviceNumOfCaps and nodeDeviceListCaps. Since 'fc_host' and
'vports' are self defined bits of a 'scsi_host' device mere string
comparison against the basic/root type is not sufficient.

This patch adds the check for the 'fc_host' and 'vports' bits within
a 'scsi_host' device and allows the following python code to find the
capabilities for the device:

import libvirt
conn = libvirt.openReadOnly('qemu:///system')
devs = conn.listAllDevices()
for dev in devs:
    if 'fc_host' in dev.listCaps() or 'vports' in dev.listCaps():
        print dev.name(),dev.numOfCaps(),dev.listCaps()
src/node_device/node_device_driver.c