[libvirt PATCH v2 15/16] api: add virNodeDeviceCreate()

Erik Skultety eskultet at redhat.com
Tue Aug 25 12:12:28 UTC 2020


On Tue, Aug 18, 2020 at 09:48:05AM -0500, Jonathon Jongsma wrote:
> This new API function provides a way to start a persistently-defined
> mediate device that was defined by virNodeDeviceDefineXML() (or one that
> was defined externally via mdevctl)
>
> Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
> ---
>  include/libvirt/libvirt-nodedev.h            |  2 +
>  src/driver-nodedev.h                         |  4 ++
>  src/libvirt-nodedev.c                        | 35 +++++++++++
>  src/libvirt_public.syms                      |  1 +
>  src/node_device/node_device_driver.c         | 64 ++++++++++++++++++++
>  src/node_device/node_device_driver.h         |  6 ++
>  src/node_device/node_device_udev.c           |  1 +
>  src/remote/remote_driver.c                   |  1 +
>  src/remote/remote_protocol.x                 | 14 ++++-
>  src/remote_protocol-structs                  |  4 ++
>  tests/nodedevmdevctldata/mdevctl-create.argv |  1 +
>  tests/nodedevmdevctltest.c                   | 11 +++-
>  12 files changed, 141 insertions(+), 3 deletions(-)
>  create mode 100644 tests/nodedevmdevctldata/mdevctl-create.argv
>

...

> +static int
> +virMdevctlCreate(virNodeDeviceDefPtr def)
I'd like to keep the virMdevctlX command mappings aligned with the actual
mdevctl commands, so ^this should IMO be part of virMdevctlStart and separate
the code with a 'persistent' flag.

> +{
> +    int status;
> +    g_autoptr(virCommand) cmd = NULL;
> +
> +    cmd = nodeDeviceGetMdevctlCreateCommand(def->caps->data.mdev.uuid);
> +
> +    if (virCommandRun(cmd, &status) < 0 || status != 0)
> +        return -1;
> +
> +    return 0;
> +}
> +
> +

Regards,
Erik




More information about the libvir-list mailing list