On Tue, Jan 16, 2018 at 12:04:53AM -0500, Dan Zheng wrote:
>From be62ea5394d52fa168079edc3aa7e558363a3026 Mon Sep 17 00:00:00
2001
From: Dan Zheng <dzheng(a)redhat.com>
Date: Tue, 16 Jan 2018 12:21:21 +0800
Subject: [PATCH] nodedev: check/add for mdev_types capability
This is similar to commit f44ec9c1.
Commit id '500cbc06' introduced a new nested capability element of type
'mdev_types' and the ability to use the flag as a way to search for a
specific subset of a 'pci' device - namely a 'mdev_types'.
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.
This patch adds the check for the 'mdev_types' bits within a 'pci'
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 'mdev_types' in dev.listCaps():
print dev.name(),dev.numOfCaps(),dev.listCaps()
Signed-off-by: Dan Zheng <dzheng(a)redhat.com>
---
Reviewed-by: Erik Skultety <eskultet(a)redhat.com> (and safe for freeze) - I
shortened the commit message a bit before pushing.