mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
tools: add switches persistent and transient to nodedev-list
Now that we can filter persistent 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> Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
e2c5c47439
commit
4476751e53
@ -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.
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user