79b470
From 09ce043fb64e92147992898ccdfc9a6c31c6051e Mon Sep 17 00:00:00 2001
79b470
Message-Id: <09ce043fb64e92147992898ccdfc9a6c31c6051e@dist-git>
79b470
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
79b470
Date: Thu, 8 Oct 2020 11:06:58 -0400
79b470
Subject: [PATCH] virsh: nodedev: ability to filter CSS capabilities
79b470
79b470
Allow to filter for CSS devices.
79b470
79b470
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
79b470
Reviewed-by: Erik Skultety <eskultet@redhat.com>
79b470
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
79b470
(cherry picked from commit ab655afa186a81ddfd247d2c187c160dd05740e5)
79b470
https://bugzilla.redhat.com/show_bug.cgi?id=1853289
79b470
https://bugzilla.redhat.com/show_bug.cgi?id=1865932
79b470
Message-Id: <20201008150700.52157-4-bfiuczyn@redhat.com>
79b470
Reviewed-by: Erik Skultety <eskultet@redhat.com>
79b470
---
79b470
 docs/formatnode.html.in           | 12 ++++++++++++
79b470
 docs/manpages/virsh.rst           |  2 +-
79b470
 include/libvirt/libvirt-nodedev.h |  1 +
79b470
 src/conf/node_device_conf.h       |  3 ++-
79b470
 src/conf/virnodedeviceobj.c       |  3 ++-
79b470
 src/libvirt-nodedev.c             |  1 +
79b470
 tools/virsh-nodedev.c             |  2 ++
79b470
 7 files changed, 21 insertions(+), 3 deletions(-)
79b470
79b470
diff --git a/docs/formatnode.html.in b/docs/formatnode.html.in
79b470
index c2a8f8fb7a..0e9658fd29 100644
79b470
--- a/docs/formatnode.html.in
79b470
+++ b/docs/formatnode.html.in
79b470
@@ -341,6 +341,18 @@
79b470
               
The device number.
79b470
             
79b470
           
79b470
+          
css
79b470
+          
Describes a Channel SubSystem (CSS) device commonly found on
79b470
+          the S390 architecture. Sub-elements include:
79b470
+            
79b470
+              
cssid
79b470
+              
The channel subsystem identifier.
79b470
+              
ssid
79b470
+              
The subchannel-set identifier.
79b470
+              
devno
79b470
+              
The device number.
79b470
+            
79b470
+          
79b470
         
79b470
       
79b470
     
79b470
diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
79b470
index c637caa583..0804465d44 100644
79b470
--- a/docs/manpages/virsh.rst
79b470
+++ b/docs/manpages/virsh.rst
79b470
@@ -4886,7 +4886,7 @@ List all of the devices available on the node that are known by libvirt.
79b470
 separated by comma, e.g. --cap pci,scsi. Valid capability types include
79b470
 'system', 'pci', 'usb_device', 'usb', 'net', 'scsi_host', 'scsi_target',
79b470
 'scsi', 'storage', 'fc_host', 'vports', 'scsi_generic', 'drm', 'mdev',
79b470
-'mdev_types', 'ccw'.
79b470
+'mdev_types', 'ccw', 'css'.
79b470
 If *--tree* is used, the output is formatted in a tree representing parents of each
79b470
 node.  *cap* and *--tree* are mutually exclusive.
79b470
 
79b470
diff --git a/include/libvirt/libvirt-nodedev.h b/include/libvirt/libvirt-nodedev.h
79b470
index a2ad61ac6d..dd2ffd5782 100644
79b470
--- a/include/libvirt/libvirt-nodedev.h
79b470
+++ b/include/libvirt/libvirt-nodedev.h
79b470
@@ -81,6 +81,7 @@ typedef enum {
79b470
     VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES    = 1 << 13, /* Capable of mediated devices */
79b470
     VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV          = 1 << 14, /* Mediated device */
79b470
     VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV       = 1 << 15, /* CCW device */
79b470
+    VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV       = 1 << 16, /* CSS device */
79b470
 } virConnectListAllNodeDeviceFlags;
79b470
 
79b470
 int                     virConnectListAllNodeDevices (virConnectPtr conn,
79b470
diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
79b470
index 19ea3fc7c2..6fe51ed04c 100644
79b470
--- a/src/conf/node_device_conf.h
79b470
+++ b/src/conf/node_device_conf.h
79b470
@@ -364,7 +364,8 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps);
79b470
                  VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM           | \
79b470
                  VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES    | \
79b470
                  VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV          | \
79b470
-                 VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV)
79b470
+                 VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV       | \
79b470
+                 VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV)
79b470
 
79b470
 int
79b470
 virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host);
79b470
diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c
79b470
index 8c8ffd6d24..a27a84355a 100644
79b470
--- a/src/conf/virnodedeviceobj.c
79b470
+++ b/src/conf/virnodedeviceobj.c
79b470
@@ -827,7 +827,8 @@ virNodeDeviceObjMatch(virNodeDeviceObjPtr obj,
79b470
               MATCH(DRM)           ||
79b470
               MATCH(MDEV_TYPES)    ||
79b470
               MATCH(MDEV)          ||
79b470
-              MATCH(CCW_DEV)))
79b470
+              MATCH(CCW_DEV)       ||
79b470
+              MATCH(CSS_DEV)))
79b470
             return false;
79b470
     }
79b470
 
79b470
diff --git a/src/libvirt-nodedev.c b/src/libvirt-nodedev.c
79b470
index dce46b7181..71d81f6278 100644
79b470
--- a/src/libvirt-nodedev.c
79b470
+++ b/src/libvirt-nodedev.c
79b470
@@ -101,6 +101,7 @@ virNodeNumOfDevices(virConnectPtr conn, const char *cap, unsigned int flags)
79b470
  *   VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES
79b470
  *   VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV
79b470
  *   VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV
79b470
+ *   VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV
79b470
  *
79b470
  * Returns the number of node devices found or -1 and sets @devices to NULL in
79b470
  * case of error.  On success, the array stored into @devices is guaranteed to
79b470
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
79b470
index 26b3acc608..f4e402c35d 100644
79b470
--- a/tools/virsh-nodedev.c
79b470
+++ b/tools/virsh-nodedev.c
79b470
@@ -462,6 +462,8 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
79b470
             flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV;
79b470
             break;
79b470
         case VIR_NODE_DEV_CAP_CSS_DEV:
79b470
+            flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV;
79b470
+            break;
79b470
         case VIR_NODE_DEV_CAP_LAST:
79b470
             break;
79b470
         }
79b470
-- 
79b470
2.28.0
79b470