From c7cfcc57d5819877d9db614eae2ffdac8a3593f7 Mon Sep 17 00:00:00 2001 From: Bjoern Walk Date: Mon, 22 May 2017 08:38:23 +0200 Subject: [PATCH] virsh: nodedev: ability to filter CCW capabilities Now that the node_device driver is aware of CCW devices, let's hook up virsh so that we can filter them properly. Reviewed-by: Boris Fiuczynski Reviewed-by: Marc Hartmayer Signed-off-by: Bjoern Walk --- docs/formatnode.html.in | 12 ++++++++++++ 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 | 3 ++- tools/virsh.pod | 2 +- 7 files changed, 21 insertions(+), 4 deletions(-) diff --git a/docs/formatnode.html.in b/docs/formatnode.html.in index a368ffc07d..32451d5575 100644 --- a/docs/formatnode.html.in +++ b/docs/formatnode.html.in @@ -324,6 +324,18 @@ render. +
ccw
+
Describes a Command Channel Word (CCW) device commonly found on + the S390 architecture. Sub-elements include: +
+
cssid
+
The channel subsystem identifier.
+
ssid
+
The subchannel-set identifier.
+
devno
+
The device number.
+
+
diff --git a/include/libvirt/libvirt-nodedev.h b/include/libvirt/libvirt-nodedev.h index 1e30437877..cd3f2372b0 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_DRM = 1 << 12, /* DRM device */ 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 */ } virConnectListAllNodeDeviceFlags; int virConnectListAllNodeDevices (virConnectPtr conn, diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index bf9d5fce56..285841edc0 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -388,7 +388,8 @@ virNodeDevCapMdevTypeFree(virNodeDevCapMdevTypePtr type); VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC | \ 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_MDEV | \ + VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV) char * virNodeDeviceGetParentName(virConnectPtr conn, diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index 02ac544376..d460f26ec4 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -568,7 +568,8 @@ virNodeDeviceMatch(virNodeDeviceObjPtr devobj, MATCH(SCSI_GENERIC) || MATCH(DRM) || MATCH(MDEV_TYPES) || - MATCH(MDEV))) + MATCH(MDEV) || + MATCH(CCW_DEV))) return false; } diff --git a/src/libvirt-nodedev.c b/src/libvirt-nodedev.c index 44e2b4efda..f85c16bbc2 100644 --- a/src/libvirt-nodedev.c +++ b/src/libvirt-nodedev.c @@ -100,6 +100,7 @@ virNodeNumOfDevices(virConnectPtr conn, const char *cap, unsigned int flags) * 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 * * 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 1822d3dce3..c7ef6bfde5 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -461,7 +461,8 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV; break; case VIR_NODE_DEV_CAP_CCW_DEV: - /* enable next patch */ + flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV; + break; case VIR_NODE_DEV_CAP_LAST: break; } diff --git a/tools/virsh.pod b/tools/virsh.pod index e7c513b98a..aee9646895 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -3181,7 +3181,7 @@ I is used to filter the list by capability types, the types must be 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'. +'mdev_types', 'ccw'. If I<--tree> is used, the output is formatted in a tree representing parents of each node. I and I<--tree> are mutually exclusive. -- GitLab