
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@redhat.com> --- 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@redhat.com>