Re: [PATCH v3 07/12] tools: add switches persisted and transient to nodedev-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



same as previous patch: commit subject says "persisted" instead of "persistent"

On 2/16/24 8:52 AM, Boris Fiuczynski wrote:
Now that we can filter persisted and transient node devices in
virConnectListAllNodeDevices(), add these switches also to the
virsh nodedev-list command.

Signed-off-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx>
Reviewed-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>
---
  docs/manpages/virsh.rst |  8 ++++++--
  tools/virsh-nodedev.c   | 24 ++++++++++++++++++++++--
  2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 3a814dccd2..248807d0e9 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -5461,7 +5461,7 @@ nodedev-list
:: - nodedev-list [--cap capability] [--tree] [--inactive | --all]
+   nodedev-list [--cap capability] [--tree] [--inactive | --all] [--persistent | --transient]
List all of the devices available on the node that are known by libvirt.
  *cap* is used to filter the list by capability types, the types must be
@@ -5470,7 +5470,11 @@ separated by comma, e.g. --cap pci,scsi. Valid capability types include
  'scsi', 'storage', 'fc_host', 'vports', 'scsi_generic', 'drm', 'mdev',
  'mdev_types', 'ccw', 'css', 'ap_card', 'ap_queue', 'ap_matrix'. By default,
  only active devices are listed. *--inactive* is used to list only inactive
-devices, and *-all* is used to list both active and inactive devices.
+devices, and *--all* is used to list both active and inactive devices.
+*--persistent* is used to list only persistent devices, and *--transient* is
+used to list only transient devices. Not providing *--persistent* or
+*--transient* will list all devices unless filtered otherwise. *--transient*
+is mutually exclusive with *--persistent* and *--inactive*.
  If *--tree* is used, the output is formatted in a tree representing parents of
  each node.  *--tree* is mutually exclusive with all other options.
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index aeb3685aca..5942c43689 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -390,6 +390,14 @@ static const vshCmdOptDef opts_node_list_devices[] = {
       .type = VSH_OT_BOOL,
       .help = N_("list inactive & active devices")
      },
+    {.name = "persistent",
+     .type = VSH_OT_BOOL,
+     .help = N_("list persistent devices")
+    },
+    {.name = "transient",
+     .type = VSH_OT_BOOL,
+     .help = N_("list transient devices")
+    },
      {.name = NULL}
  };
@@ -407,6 +415,8 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
      int cap_type = -1;
      bool inactive = vshCommandOptBool(cmd, "inactive");
      bool all = vshCommandOptBool(cmd, "all");
+    bool persistent = vshCommandOptBool(cmd, "persistent");
+    bool transient = vshCommandOptBool(cmd, "transient");
ignore_value(vshCommandOptStringQuiet(ctl, cmd, "cap", &cap_str)); @@ -420,8 +430,13 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
          return false;
      }
- if (tree && (cap_str || inactive)) {
-        vshError(ctl, "%s", _("Option --tree is incompatible with --cap and --inactive"));
+    if (transient && (persistent || inactive)) {
+        vshError(ctl, "%s", _("Option --transient is incompatible with --persistent and --inactive"));
+        return false;
+    }
+
+    if (tree && (cap_str || inactive || persistent || transient)) {
+        vshError(ctl, "%s", _("Option --tree is incompatible with --cap, --inactive, --persistent and --transient"));
          return false;
      }
@@ -509,6 +524,11 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
      if (!inactive)
          flags |= VIR_CONNECT_LIST_NODE_DEVICES_ACTIVE;
+ if (persistent)
+        flags |= VIR_CONNECT_LIST_NODE_DEVICES_PERSISTENT;
+    if (transient)
+        flags |= VIR_CONNECT_LIST_NODE_DEVICES_TRANSIENT;
+
      if (!(list = virshNodeDeviceListCollect(ctl, caps, ncaps, flags))) {
          ret = false;
          goto cleanup;
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux