mirror of
https://github.com/libvirt/libvirt.git
synced 2026-07-31 00:28:11 -05:00
virsh: Add completer for '--type' option of 'attach-interface' command
The '--type' option of 'attach-interface' command is translated from string into int using virDomainNetTypeFromString(), IOW the expected value is from virDomainNetType enum. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include "virkeynametable_linux.h"
|
||||
#include "virkeynametable_osx.h"
|
||||
#include "virkeynametable_win32.h"
|
||||
#include "conf/domain_conf.h"
|
||||
#include "conf/storage_conf.h"
|
||||
#include "conf/numa_conf.h"
|
||||
|
||||
@@ -1119,3 +1120,15 @@ virshDomainDirtyRateCalcModeCompleter(vshControl *ctl G_GNUC_UNUSED,
|
||||
return vshEnumComplete(VIRSH_DOMAIN_DIRTYRATE_CALC_MODE_LAST,
|
||||
virshDomainDirtyRateCalcModeTypeToString);
|
||||
}
|
||||
|
||||
|
||||
char **
|
||||
virshDomainNetTypeCompleter(vshControl *ctl G_GNUC_UNUSED,
|
||||
const vshCmd *cmd G_GNUC_UNUSED,
|
||||
unsigned int flags)
|
||||
{
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
return vshEnumComplete(VIR_DOMAIN_NET_TYPE_LAST,
|
||||
virDomainNetTypeToString);
|
||||
}
|
||||
|
||||
@@ -199,3 +199,8 @@ char **
|
||||
virshDomainDirtyRateCalcModeCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags);
|
||||
|
||||
char **
|
||||
virshDomainNetTypeCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags);
|
||||
|
||||
@@ -837,6 +837,7 @@ static const vshCmdOptDef opts_attach_interface[] = {
|
||||
.type = VSH_OT_STRING,
|
||||
.positional = true,
|
||||
.required = true,
|
||||
.completer = virshDomainNetTypeCompleter,
|
||||
.help = N_("network interface type")
|
||||
},
|
||||
{.name = "source",
|
||||
|
||||
Reference in New Issue
Block a user