libvirt/SOURCES/libvirt-virsh-nodedev-abili...

131 lines
5.5 KiB
Diff

From 09ce043fb64e92147992898ccdfc9a6c31c6051e Mon Sep 17 00:00:00 2001
Message-Id: <09ce043fb64e92147992898ccdfc9a6c31c6051e@dist-git>
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
Date: Thu, 8 Oct 2020 11:06:58 -0400
Subject: [PATCH] virsh: nodedev: ability to filter CSS capabilities
Allow to filter for CSS devices.
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
(cherry picked from commit ab655afa186a81ddfd247d2c187c160dd05740e5)
https://bugzilla.redhat.com/show_bug.cgi?id=1853289
https://bugzilla.redhat.com/show_bug.cgi?id=1865932
Message-Id: <20201008150700.52157-4-bfiuczyn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
---
docs/formatnode.html.in | 12 ++++++++++++
docs/manpages/virsh.rst | 2 +-
include/libvirt/libvirt-nodedev.h | 1 +
src/conf/node_device_conf.h | 3 ++-
src/conf/virnodedeviceobj.c | 3 ++-
src/libvirt-nodedev.c | 1 +
tools/virsh-nodedev.c | 2 ++
7 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/docs/formatnode.html.in b/docs/formatnode.html.in
index c2a8f8fb7a..0e9658fd29 100644
--- a/docs/formatnode.html.in
+++ b/docs/formatnode.html.in
@@ -341,6 +341,18 @@
<dd>The device number.</dd>
</dl>
</dd>
+ <dt><code>css</code></dt>
+ <dd>Describes a Channel SubSystem (CSS) device commonly found on
+ the S390 architecture. Sub-elements include:
+ <dl>
+ <dt><code>cssid</code></dt>
+ <dd>The channel subsystem identifier.</dd>
+ <dt><code>ssid</code></dt>
+ <dd>The subchannel-set identifier.</dd>
+ <dt><code>devno</code></dt>
+ <dd>The device number.</dd>
+ </dl>
+ </dd>
</dl>
</dd>
</dl>
diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index c637caa583..0804465d44 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -4886,7 +4886,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'.
+'mdev_types', 'ccw', 'css'.
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 a2ad61ac6d..dd2ffd5782 100644
--- a/include/libvirt/libvirt-nodedev.h
+++ b/include/libvirt/libvirt-nodedev.h
@@ -81,6 +81,7 @@ typedef enum {
VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES = 1 << 13, /* Capable of mediated devices */
VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV = 1 << 14, /* Mediated device */
VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV = 1 << 15, /* CCW device */
+ VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV = 1 << 16, /* CSS device */
} virConnectListAllNodeDeviceFlags;
int virConnectListAllNodeDevices (virConnectPtr conn,
diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
index 19ea3fc7c2..6fe51ed04c 100644
--- a/src/conf/node_device_conf.h
+++ b/src/conf/node_device_conf.h
@@ -364,7 +364,8 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps);
VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM | \
VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES | \
VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV | \
- VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV)
+ VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV | \
+ VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV)
int
virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host);
diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c
index 8c8ffd6d24..a27a84355a 100644
--- a/src/conf/virnodedeviceobj.c
+++ b/src/conf/virnodedeviceobj.c
@@ -827,7 +827,8 @@ virNodeDeviceObjMatch(virNodeDeviceObjPtr obj,
MATCH(DRM) ||
MATCH(MDEV_TYPES) ||
MATCH(MDEV) ||
- MATCH(CCW_DEV)))
+ MATCH(CCW_DEV) ||
+ MATCH(CSS_DEV)))
return false;
}
diff --git a/src/libvirt-nodedev.c b/src/libvirt-nodedev.c
index dce46b7181..71d81f6278 100644
--- a/src/libvirt-nodedev.c
+++ b/src/libvirt-nodedev.c
@@ -101,6 +101,7 @@ virNodeNumOfDevices(virConnectPtr conn, const char *cap, unsigned int flags)
* VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES
* VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV
* VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV
+ * VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV
*
* 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 26b3acc608..f4e402c35d 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -462,6 +462,8 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV;
break;
case VIR_NODE_DEV_CAP_CSS_DEV:
+ flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV;
+ break;
case VIR_NODE_DEV_CAP_LAST:
break;
}
--
2.28.0