[PATCH libvirt v2 05/11] virsh: nodedev: Filter by AP card and AP queue capabilities

Shalini Chellathurai Saroja shalini at linux.ibm.com
Thu Nov 12 12:15:13 UTC 2020


From: Farhan Ali <alifm at linux.ibm.com>

Add support to filter by 'ap_card' and 'ap_queue' capabilities.

Signed-off-by: Farhan Ali <alifm at linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy at linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk at linux.ibm.com>
Signed-off-by: Shalini Chellathurai Saroja <shalini at linux.ibm.com>
---
 docs/manpages/virsh.rst           | 2 +-
 include/libvirt/libvirt-nodedev.h | 2 ++
 src/conf/node_device_conf.h       | 4 +++-
 src/conf/virnodedeviceobj.c       | 4 +++-
 src/libvirt-nodedev.c             | 2 ++
 tools/virsh-nodedev.c             | 4 ++++
 6 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index bfd26e31..1e71818a 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -4972,7 +4972,7 @@ List all of the devices available on the node that are known by libvirt.
 separated by comma, e.g. --cap pci,scsi. Valid capability types include
 'system', 'pci', 'usb_device', 'usb', 'net', 'scsi_host', 'scsi_target',
 'scsi', 'storage', 'fc_host', 'vports', 'scsi_generic', 'drm', 'mdev',
-'mdev_types', 'ccw', 'css'.
+'mdev_types', 'ccw', 'css', 'ap_card', 'ap_queue'.
 If *--tree* is used, the output is formatted in a tree representing parents of each
 node.  *cap* and *--tree* are mutually exclusive.
 
diff --git a/include/libvirt/libvirt-nodedev.h b/include/libvirt/libvirt-nodedev.h
index b73b076f..d5091aa2 100644
--- a/include/libvirt/libvirt-nodedev.h
+++ b/include/libvirt/libvirt-nodedev.h
@@ -83,6 +83,8 @@ typedef enum {
     VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV       = 1 << 15, /* CCW device */
     VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV       = 1 << 16, /* CSS device */
     VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA          = 1 << 17, /* vDPA device */
+    VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD       = 1 << 18, /* s390 AP Card device */
+    VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE      = 1 << 19, /* s390 AP Queue */
 } virConnectListAllNodeDeviceFlags;
 
 int                     virConnectListAllNodeDevices (virConnectPtr conn,
diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
index 27cb0004..b580d6cf 100644
--- a/src/conf/node_device_conf.h
+++ b/src/conf/node_device_conf.h
@@ -402,7 +402,9 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps);
                  VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV          | \
                  VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV       | \
                  VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV       | \
-                 VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA)
+                 VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA          | \
+                 VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD       | \
+                 VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE)
 
 int
 virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host);
diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c
index 8b4302d7..691632c6 100644
--- a/src/conf/virnodedeviceobj.c
+++ b/src/conf/virnodedeviceobj.c
@@ -871,7 +871,9 @@ virNodeDeviceObjMatch(virNodeDeviceObjPtr obj,
               MATCH(MDEV)          ||
               MATCH(CCW_DEV)       ||
               MATCH(CSS_DEV)       ||
-              MATCH(VDPA)))
+              MATCH(VDPA)          ||
+              MATCH(AP_CARD)       ||
+              MATCH(AP_QUEUE)))
             return false;
     }
 
diff --git a/src/libvirt-nodedev.c b/src/libvirt-nodedev.c
index 28765b9c..762413eb 100644
--- a/src/libvirt-nodedev.c
+++ b/src/libvirt-nodedev.c
@@ -102,6 +102,8 @@ virNodeNumOfDevices(virConnectPtr conn, const char *cap, unsigned int flags)
  *   VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV
  *   VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV
  *   VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV
+ *   VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD
+ *   VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE
  *
  * Returns the number of node devices found or -1 and sets @devices to NULL in
  * case of error.  On success, the array stored into @devices is guaranteed to
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index 81752e85..f5ffe525 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -468,7 +468,11 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
             flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA;
             break;
         case VIR_NODE_DEV_CAP_AP_CARD:
+            flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD;
+            break;
         case VIR_NODE_DEV_CAP_AP_QUEUE:
+            flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE;
+            break;
         case VIR_NODE_DEV_CAP_LAST:
             break;
         }
-- 
2.26.2




More information about the libvir-list mailing list