[PATCH 3/3] virsh: Provide completer for PCI backend drivers
Michal Prívozník
mprivozn at redhat.com
Mon Apr 4 14:32:36 UTC 2022
On 4/2/22 12:31, Amneesh Singh wrote:
> Related: https://gitlab.com/libvirt/libvirt/-/issues/9
> Signed-off-by: Amneesh Singh <natto at weirdnatto.in>
> ---
> tools/virsh-completer-nodedev.c | 11 +++++++++++
> tools/virsh-completer-nodedev.h | 4 ++++
> tools/virsh-nodedev.c | 2 ++
> 3 files changed, 17 insertions(+)
>
> diff --git a/tools/virsh-completer-nodedev.c b/tools/virsh-completer-nodedev.c
> index bf6e809..58f0a9d 100644
> --- a/tools/virsh-completer-nodedev.c
> +++ b/tools/virsh-completer-nodedev.c
> @@ -23,6 +23,7 @@
> #include "virsh-completer-nodedev.h"
> #include "virsh-util.h"
> #include "conf/node_device_conf.h"
> +#include "conf/domain_conf.h"
> #include "viralloc.h"
> #include "virsh-nodedev.h"
> #include "virsh.h"
> @@ -102,3 +103,13 @@ virshNodeDeviceCapabilityNameCompleter(vshControl *ctl,
>
> return virshCommaStringListComplete(cap_str, (const char **)tmp);
> }
> +
> +char **virshNodeDevicePCIBackendCompleter(vshControl *ctl G_GNUC_UNUSED,
> + const vshCmd *cmd G_GNUC_UNUSED,
> + unsigned int flags)
Formatting.
> +{
> + virCheckFlags(0, NULL);
> +
> + return virshEnumComplete(VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST,
> + virDomainHostdevSubsysPCIBackendTypeToString);
Initially I wanted to suggest using virPCIStubDriver and
virPCIStubDriverTypeToString, but that's not really how
virDomainDriverNodeDeviceDetachFlags() translates the string either. So
your code is okay.
Michal
More information about the libvir-list
mailing list