Similar to commit @
f44ec9c1, commit @
500cbc06 introduced a new nested
'mdev_types' capability, however the mentioned commit didn't adjust
virNodeDeviceNumOfCaps and virNodeDeviceListCaps functions accordingly
to provide proper support for this capability.
After applying this patch the following python snippet returns the
expected results:
import libvirt
conn = libvirt.openReadOnly('qemu:///system')
devs = conn.listAllDevices()
for dev in devs:
if 'mdev_types' in dev.listCaps():
print dev.name(),dev.numOfCaps(),dev.listCaps()
Signed-off-by: Dan Zheng <dzheng@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
VIR_NODE_DEV_CAP_FLAG_HBA_VPORT_OPS)
ncaps++;
}
+ if (caps->data.type == VIR_NODE_DEV_CAP_PCI_DEV) {
+ if (caps->data.pci_dev.flags &
+ VIR_NODE_DEV_CAP_FLAG_PCI_MDEV)
+ ncaps++;
+ }
+
}
ret = ncaps;
goto cleanup;
}
}
+ if (caps->data.type == VIR_NODE_DEV_CAP_PCI_DEV) {
+ if (ncaps < maxnames &&
+ caps->data.pci_dev.flags &
+ VIR_NODE_DEV_CAP_FLAG_PCI_MDEV) {
+ if (VIR_STRDUP(names[ncaps++],
+ virNodeDevCapTypeToString(VIR_NODE_DEV_CAP_MDEV_TYPES)) < 0)
+ goto cleanup;
+ }
+ }
}
ret = ncaps;