virsh: Provide completer for virtualization types
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
5c03346184
commit
11ad758910
@ -27,6 +27,7 @@
|
|||||||
#include "virxml.h"
|
#include "virxml.h"
|
||||||
#include "virutil.h"
|
#include "virutil.h"
|
||||||
#include "virsh-host.h"
|
#include "virsh-host.h"
|
||||||
|
#include "conf/domain_conf.h"
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
virshPagesizeNodeToString(xmlNodePtr node)
|
virshPagesizeNodeToString(xmlNodePtr node)
|
||||||
@ -180,3 +181,15 @@ virshNodeSuspendTargetCompleter(vshControl *ctl G_GNUC_UNUSED,
|
|||||||
return virshEnumComplete(VIR_NODE_SUSPEND_TARGET_LAST,
|
return virshEnumComplete(VIR_NODE_SUSPEND_TARGET_LAST,
|
||||||
virshNodeSuspendTargetTypeToString);
|
virshNodeSuspendTargetTypeToString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char **
|
||||||
|
virshDomainVirtTypeCompleter(vshControl *ctl G_GNUC_UNUSED,
|
||||||
|
const vshCmd *cmd G_GNUC_UNUSED,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
virCheckFlags(0, NULL);
|
||||||
|
|
||||||
|
return virshEnumComplete(VIR_DOMAIN_VIRT_LAST,
|
||||||
|
virDomainVirtTypeToString);
|
||||||
|
}
|
||||||
|
@ -41,3 +41,8 @@ char **
|
|||||||
virshNodeSuspendTargetCompleter(vshControl *ctl,
|
virshNodeSuspendTargetCompleter(vshControl *ctl,
|
||||||
const vshCmd *cmd,
|
const vshCmd *cmd,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
||||||
|
char **
|
||||||
|
virshDomainVirtTypeCompleter(vshControl *ctl,
|
||||||
|
const vshCmd *cmd,
|
||||||
|
unsigned int flags);
|
||||||
|
@ -77,6 +77,7 @@ static const vshCmdInfo info_domcapabilities[] = {
|
|||||||
static const vshCmdOptDef opts_domcapabilities[] = {
|
static const vshCmdOptDef opts_domcapabilities[] = {
|
||||||
{.name = "virttype",
|
{.name = "virttype",
|
||||||
.type = VSH_OT_STRING,
|
.type = VSH_OT_STRING,
|
||||||
|
.completer = virshDomainVirtTypeCompleter,
|
||||||
.help = N_("virtualization type (/domain/@type)"),
|
.help = N_("virtualization type (/domain/@type)"),
|
||||||
},
|
},
|
||||||
{.name = "emulatorbin",
|
{.name = "emulatorbin",
|
||||||
@ -559,6 +560,7 @@ static const vshCmdInfo info_maxvcpus[] = {
|
|||||||
static const vshCmdOptDef opts_maxvcpus[] = {
|
static const vshCmdOptDef opts_maxvcpus[] = {
|
||||||
{.name = "type",
|
{.name = "type",
|
||||||
.type = VSH_OT_STRING,
|
.type = VSH_OT_STRING,
|
||||||
|
.completer = virshDomainVirtTypeCompleter,
|
||||||
.help = N_("domain type")
|
.help = N_("domain type")
|
||||||
},
|
},
|
||||||
{.name = NULL}
|
{.name = NULL}
|
||||||
@ -1577,6 +1579,7 @@ static const vshCmdOptDef opts_hypervisor_cpu_compare[] = {
|
|||||||
VIRSH_COMMON_OPT_FILE(N_("file containing an XML CPU description")),
|
VIRSH_COMMON_OPT_FILE(N_("file containing an XML CPU description")),
|
||||||
{.name = "virttype",
|
{.name = "virttype",
|
||||||
.type = VSH_OT_STRING,
|
.type = VSH_OT_STRING,
|
||||||
|
.completer = virshDomainVirtTypeCompleter,
|
||||||
.help = N_("virtualization type (/domain/@type)"),
|
.help = N_("virtualization type (/domain/@type)"),
|
||||||
},
|
},
|
||||||
{.name = "emulator",
|
{.name = "emulator",
|
||||||
@ -1686,6 +1689,7 @@ static const vshCmdOptDef opts_hypervisor_cpu_baseline[] = {
|
|||||||
VIRSH_COMMON_OPT_FILE(N_("file containing XML CPU descriptions")),
|
VIRSH_COMMON_OPT_FILE(N_("file containing XML CPU descriptions")),
|
||||||
{.name = "virttype",
|
{.name = "virttype",
|
||||||
.type = VSH_OT_STRING,
|
.type = VSH_OT_STRING,
|
||||||
|
.completer = virshDomainVirtTypeCompleter,
|
||||||
.help = N_("virtualization type (/domain/@type)"),
|
.help = N_("virtualization type (/domain/@type)"),
|
||||||
},
|
},
|
||||||
{.name = "emulator",
|
{.name = "emulator",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user