mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-21 13:34:06 +03:00
virsh: Provide completer for PCI backend drivers
Related: https://gitlab.com/libvirt/libvirt/-/issues/9 Signed-off-by: Amneesh Singh <natto@weirdnatto.in> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
4f0480a11c
commit
5d0eeb8cd7
@ -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);
|
||||
}
|
||||
|
@ -36,3 +36,7 @@ char **
|
||||
virshNodeDeviceCapabilityNameCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags);
|
||||
|
||||
char **virshNodeDevicePCIBackendCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags);
|
||||
|
@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#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}
|
||||
|
Loading…
Reference in New Issue
Block a user