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(a)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