mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
virsh: Provide completer for CPU architectures
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
11ad758910
commit
4f0480a11c
@ -28,6 +28,7 @@
|
||||
#include "virutil.h"
|
||||
#include "virsh-host.h"
|
||||
#include "conf/domain_conf.h"
|
||||
#include "virarch.h"
|
||||
|
||||
static char *
|
||||
virshPagesizeNodeToString(xmlNodePtr node)
|
||||
@ -193,3 +194,15 @@ virshDomainVirtTypeCompleter(vshControl *ctl G_GNUC_UNUSED,
|
||||
return virshEnumComplete(VIR_DOMAIN_VIRT_LAST,
|
||||
virDomainVirtTypeToString);
|
||||
}
|
||||
|
||||
|
||||
char **
|
||||
virshArchCompleter(vshControl *ctl G_GNUC_UNUSED,
|
||||
const vshCmd *cmd G_GNUC_UNUSED,
|
||||
unsigned int flags)
|
||||
{
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
return virshEnumComplete(VIR_ARCH_LAST,
|
||||
(const char *(*)(int))virArchToString);
|
||||
}
|
||||
|
@ -46,3 +46,8 @@ char **
|
||||
virshDomainVirtTypeCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags);
|
||||
|
||||
char **
|
||||
virshArchCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags);
|
||||
|
@ -86,6 +86,7 @@ static const vshCmdOptDef opts_domcapabilities[] = {
|
||||
},
|
||||
{.name = "arch",
|
||||
.type = VSH_OT_STRING,
|
||||
.completer = virshArchCompleter,
|
||||
.help = N_("domain architecture (/domain/os/type/@arch)"),
|
||||
},
|
||||
{.name = "machine",
|
||||
@ -1312,6 +1313,7 @@ static const vshCmdInfo info_cpu_models[] = {
|
||||
static const vshCmdOptDef opts_cpu_models[] = {
|
||||
{.name = "arch",
|
||||
.type = VSH_OT_DATA,
|
||||
.completer = virshArchCompleter,
|
||||
.flags = VSH_OFLAG_REQ,
|
||||
.help = N_("architecture")
|
||||
},
|
||||
@ -1588,6 +1590,7 @@ static const vshCmdOptDef opts_hypervisor_cpu_compare[] = {
|
||||
},
|
||||
{.name = "arch",
|
||||
.type = VSH_OT_STRING,
|
||||
.completer = virshArchCompleter,
|
||||
.help = N_("CPU architecture (/domain/os/type/@arch)"),
|
||||
},
|
||||
{.name = "machine",
|
||||
@ -1698,6 +1701,7 @@ static const vshCmdOptDef opts_hypervisor_cpu_baseline[] = {
|
||||
},
|
||||
{.name = "arch",
|
||||
.type = VSH_OT_STRING,
|
||||
.completer = virshArchCompleter,
|
||||
.help = N_("CPU architecture (/domain/os/type/@arch)"),
|
||||
},
|
||||
{.name = "machine",
|
||||
|
Loading…
Reference in New Issue
Block a user