Re: [libvirt PATCH v6 08/30] nodedev: add ability to list defined mdevs

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

 



On Fri, Mar 26, 2021 at 11:48:04AM -0500, Jonathon Jongsma wrote:
> This adds an internal API to query for persistent mediated devices
> that are defined by mdevctl. Upcoming commits will make use of this
> information.
> 
> Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>
> ---
>  src/node_device/node_device_driver.c          | 18 +++++++++
>  src/node_device/node_device_driver.h          |  3 ++
>  .../mdevctl-list-defined.argv                 |  1 +
>  tests/nodedevmdevctltest.c                    | 39 +++++++++++++++++++
>  4 files changed, 61 insertions(+)
>  create mode 100644 tests/nodedevmdevctldata/mdevctl-list-defined.argv
> 
> diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
> index a646692870..6911fa36da 100644
> --- a/src/node_device/node_device_driver.c
> +++ b/src/node_device/node_device_driver.c
> @@ -860,6 +860,24 @@ virMdevctlStop(virNodeDeviceDefPtr def, char **errmsg)
>  }
>  
>  
> +virCommand*
> +nodeDeviceGetMdevctlListCommand(bool defined,
> +                                char **output)
> +{
> +    virCommand *cmd = virCommandNewArgList(MDEVCTL,
> +                                           "list",
> +                                           "--dumpjson",
> +                                           NULL);
> +
> +    if (defined)
> +        virCommandAddArg(cmd, "--defined");
> +
> +    virCommandSetOutputBuffer(cmd, output);

Since we'll capture error output from all the other mdevctl commands, I think
we should do it here as well, even though 99.9% of cases won't use it.

The rest looks fine.
Reviewed-by: Erik Skultety <eskultet@xxxxxxxxxx>




[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