render / rpms / libvirt

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