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@linux.ibm.com>
---
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..4bcfbc230b 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] [--persisted | --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.
+*--persisted* is used to list only persisted devices, and *--transient* is
+used to list only transient devices. Not providing *--persisted* or
+*--transient* will list all devices unless filtered otherwise. *--transient*
+is mutually exclusive with *--persisted* 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 54e192d619..4acb955efe 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 = "persisted",
+ .type = VSH_OT_BOOL,
+ .help = N_("list persisted 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 persisted = vshCommandOptBool(cmd, "persisted");
+ 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 && (persisted || inactive)) {
+ vshError(ctl, "%s", _("Option --transient is incompatible with --persisted and --inactive"));
+ return false;
+ }
+
+ if (tree && (cap_str || inactive || persisted || transient)) {
+ vshError(ctl, "%s", _("Option --tree is incompatible with --cap, --inactive, --persisted 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 (persisted)
+ flags |= VIR_CONNECT_LIST_NODE_DEVICES_PERSISTED;
+ if (transient)
+ flags |= VIR_CONNECT_LIST_NODE_DEVICES_TRANSIENT;
+
if (!(list = virshNodeDeviceListCollect(ctl, caps, ncaps, flags))) {
ret = false;
goto cleanup;
--
2.42.0
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
On 1/19/24 10:38 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@linux.ibm.com> > --- > 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..4bcfbc230b 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] [--persisted | --transient] s/persisted/persistent/ > > 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. > +*--persisted* is used to list only persisted devices, and *--transient* is here too > +used to list only transient devices. Not providing *--persisted* or > +*--transient* will list all devices unless filtered otherwise. *--transient* > +is mutually exclusive with *--persisted* and *--inactive*. again > 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 54e192d619..4acb955efe 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 = "persisted", again > + .type = VSH_OT_BOOL, > + .help = N_("list persisted devices") again > + }, > + {.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 persisted = vshCommandOptBool(cmd, "persisted"); again > + 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 && (persisted || inactive)) { > + vshError(ctl, "%s", _("Option --transient is incompatible with --persisted and --inactive")); again > + return false; > + } > + > + if (tree && (cap_str || inactive || persisted || transient)) { > + vshError(ctl, "%s", _("Option --tree is incompatible with --cap, --inactive, --persisted and --transient")); again > 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 (persisted) > + flags |= VIR_CONNECT_LIST_NODE_DEVICES_PERSISTED; > + if (transient) > + flags |= VIR_CONNECT_LIST_NODE_DEVICES_TRANSIENT; > + > if (!(list = virshNodeDeviceListCollect(ctl, caps, ncaps, flags))) { > ret = false; > goto cleanup; Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com> _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org
On 1/31/24 22:38, Jonathon Jongsma wrote: > On 1/19/24 10:38 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@linux.ibm.com> >> --- >> 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..4bcfbc230b 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] >> [--persisted | --transient] > > s/persisted/persistent/ > >> 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. >> +*--persisted* is used to list only persisted devices, and >> *--transient* is > > here too > >> +used to list only transient devices. Not providing *--persisted* or >> +*--transient* will list all devices unless filtered otherwise. >> *--transient* >> +is mutually exclusive with *--persisted* and *--inactive*. > > again > >> 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 54e192d619..4acb955efe 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 = "persisted", > > again > >> + .type = VSH_OT_BOOL, >> + .help = N_("list persisted devices") > > again > > >> + }, >> + {.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 persisted = vshCommandOptBool(cmd, "persisted"); > > again > >> + 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 && (persisted || inactive)) { >> + vshError(ctl, "%s", _("Option --transient is incompatible >> with --persisted and --inactive")); > > again > >> + return false; >> + } >> + >> + if (tree && (cap_str || inactive || persisted || transient)) { >> + vshError(ctl, "%s", _("Option --tree is incompatible with >> --cap, --inactive, --persisted and --transient")); > > again All changed > >> 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 (persisted) >> + flags |= VIR_CONNECT_LIST_NODE_DEVICES_PERSISTED; >> + if (transient) >> + flags |= VIR_CONNECT_LIST_NODE_DEVICES_TRANSIENT; >> + >> if (!(list = virshNodeDeviceListCollect(ctl, caps, ncaps, >> flags))) { >> ret = false; >> goto cleanup; > > > Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com> Thanks > _______________________________________________ > Devel mailing list -- devel@lists.libvirt.org > To unsubscribe send an email to devel-leave@lists.libvirt.org -- Mit freundlichen Grüßen/Kind regards Boris Fiuczynski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Wolfgang Wendt Geschäftsführung: David Faller Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org
© 2016 - 2024 Red Hat, Inc.