[libvirt PATCH v2 08/10] nodedev: add mdev support to virNodeDeviceDestroy()
Erik Skultety
eskultet at redhat.com
Thu Jun 11 14:00:46 UTC 2020
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 at redhat.com>
> ---
> 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
More information about the libvir-list
mailing list