diff --git a/tools/virsh-completer-nodedev.c b/tools/virsh-completer-nodedev.c index bf6e809b5a..57544da15d 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,15 @@ 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) +{ + virCheckFlags(0, NULL); + + return virshEnumComplete(VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST, + virDomainHostdevSubsysPCIBackendTypeToString); +} diff --git a/tools/virsh-completer-nodedev.h b/tools/virsh-completer-nodedev.h index 743f7b2465..231b4c2c24 100644 --- a/tools/virsh-completer-nodedev.h +++ b/tools/virsh-completer-nodedev.h @@ -36,3 +36,7 @@ char ** virshNodeDeviceCapabilityNameCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); + +char **virshNodeDevicePCIBackendCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index d01bdf699c..d21b2baab6 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -19,6 +19,7 @@ */ #include +#include "virsh-completer-nodedev.h" #include "virsh-nodedev.h" #include "virsh-util.h" @@ -613,6 +614,7 @@ static const vshCmdOptDef opts_node_device_detach[] = { }, {.name = "driver", .type = VSH_OT_STRING, + .completer = virshNodeDevicePCIBackendCompleter, .help = N_("pci device assignment backend driver (e.g. 'vfio' or 'kvm')") }, {.name = NULL}