[libvirt PATCH v4 15/25] virsh: Add --inactive, --all to nodedev-list
Erik Skultety
eskultet at redhat.com
Mon Feb 22 07:13:01 UTC 2021
On Wed, Feb 03, 2021 at 11:38:59AM -0600, Jonathon Jongsma wrote:
> Now that we can filter active and inactive node devices in
> virConnectListAllNodeDevices(), add these switches to the virsh command.
>
> Eventual output (once everything is hooked up):
>
> virsh # nodedev-list --cap mdev
> mdev_bd2ea955_3402_4252_8c17_7468083a0f26
>
> virsh # nodedev-list --inactive --cap mdev
> mdev_07d8b8b0_7e04_4c0f_97ed_9214ce12723c
> mdev_927c040f_ae7d_4a35_966e_286ba6ebbe1c
>
> virsh # nodedev-list --all --cap mdev
> mdev_07d8b8b0_7e04_4c0f_97ed_9214ce12723c
> mdev_927c040f_ae7d_4a35_966e_286ba6ebbe1c
> mdev_bd2ea955_3402_4252_8c17_7468083a0f26
>
> Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
> ---
> tools/virsh-nodedev.c | 30 ++++++++++++++++++++++++++----
> 1 file changed, 26 insertions(+), 4 deletions(-)
>
> diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
> index 428ead7384..a2e83fb676 100644
> --- a/tools/virsh-nodedev.c
> +++ b/tools/virsh-nodedev.c
> @@ -378,6 +378,14 @@ static const vshCmdOptDef opts_node_list_devices[] = {
> .completer = virshNodeDeviceCapabilityNameCompleter,
> .help = N_("capability names, separated by comma")
> },
> + {.name = "inactive",
> + .type = VSH_OT_BOOL,
> + .help = N_("list inactive devices")
> + },
> + {.name = "all",
> + .type = VSH_OT_BOOL,
> + .help = N_("list inactive & active devices")
> + },
> {.name = NULL}
> };
>
> @@ -393,18 +401,27 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
> int ncaps = 0;
> virshNodeDeviceListPtr list = NULL;
> int cap_type = -1;
> + bool inactive, all;
1 declaration per line...
>
> + inactive = vshCommandOptBool(cmd, "inactive");
> + all = vshCommandOptBool(cmd, "all");
...also ^these 2 can be used to initialize the variables at their definition.
Reviewed-by: Erik Skultety <eskultet at redhat.com>
More information about the libvir-list
mailing list