Re: [libvirt PATCH v2 08/10] nodedev: add mdev support to virNodeDeviceDestroy()

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

 



On Tue, Jun 09, 2020 at 04:43:48PM -0500, Jonathon Jongsma wrote:
> Add the ability to destroy mdev node devices via the mdevctl utility.
>
> Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>
> ---
>  src/node_device/node_device_driver.c | 46 ++++++++++++++++++++++++++++
>  src/node_device/node_device_driver.h |  3 ++
>  2 files changed, 49 insertions(+)
>
> diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
> index dbc7eb4d1e..c956bb55fc 100644
> --- a/src/node_device/node_device_driver.c
> +++ b/src/node_device/node_device_driver.c
> @@ -790,6 +790,45 @@ nodeDeviceCreateXML(virConnectPtr conn,
>  }
>
>
> +virCommandPtr
> +nodeDeviceGetMdevctlStopCommand(const char *uuid,
> +                                bool persist)
> +{
> +    g_autofree char *mdevctl = virFindFileInPath(MDEVCTL);
> +    const char *subcommand;
> +
> +    if (!mdevctl)
> +        return NULL;
> +
> +    if (persist)
> +        subcommand = "undefine";

"undefine" is a NOP on active mdevs IIRC, so again the helper name is
confusing.

> +    else
> +        subcommand = "stop";
> +
> +    virCommandPtr cmd = virCommandNewArgList(mdevctl,
> +                                             subcommand,
> +                                             "-u",
> +                                             uuid,
> +                                             NULL);
> +
> +    return cmd;
> +}

Like I mentioned already, we could have a generic translator to the mdevctl
subcommands.

Regards,
Erik




[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