VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "interface",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainInterfaceCompleter,
.help = N_("interface device (MAC Address)")
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "interface",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainInterfaceCompleter,
.help = N_("interface device specified by name or MAC Address")
},
{.name = "domain",
.type = VSH_OT_ARGV,
+ .positional = true,
.help = N_("list of domains to get stats for"),
.completer = virshDomainNameCompleter,
},
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "source",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ | VSH_OFLAG_EMPTY_OK,
.help = N_("source of disk device or name of network disk")
},
{.name = "target",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshCompleteEmpty,
.help = N_("target of disk device")
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "type",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("network interface type")
},
{.name = "source",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("source of network interface")
},
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "device",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainDiskTargetCompleter,
.help = N_("block device")
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "path",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainDiskTargetCompleter,
.help = N_("fully-qualified path of disk")
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "path",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainDiskTargetCompleter,
.help = N_("fully-qualified path of source disk")
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "path",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainDiskTargetCompleter,
.help = N_("fully-qualified path of disk")
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "path",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainDiskTargetCompleter,
.help = N_("fully-qualified path of disk")
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "path",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainDiskTargetCompleter,
.help = N_("Fully-qualified path of block device")
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "interface",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainInterfaceCompleter,
.help = N_("interface device (MAC Address)")
},
{.name = "state",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainInterfaceStateCompleter,
.help = N_("new state of the device")
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "interface",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainInterfaceCompleter,
.help = N_("interface device (MAC Address)")
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_RUNNING),
{.name = "target",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshNodeSuspendTargetCompleter,
.help = N_("mem(Suspend-to-RAM), "
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "file",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("where to save the data")
},
static const vshCmdOptDef opts_save_image_dumpxml[] = {
{.name = "file",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("saved state file to read")
},
static const vshCmdOptDef opts_save_image_define[] = {
{.name = "file",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("saved state file to modify")
},
{.name = "xml",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshCompletePathLocalExisting,
.help = N_("filename containing updated XML for the target")
static const vshCmdOptDef opts_save_image_edit[] = {
{.name = "file",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("saved state file to edit")
},
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE),
{.name = "xml",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshCompletePathLocalExisting,
.help = N_("filename containing updated XML for the target")
static const vshCmdOptDef opts_restore[] = {
{.name = "file",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("the state to restore")
},
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "file",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("where to dump the core")
},
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "type",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainLifecycleCompleter,
.help = N_("lifecycle type to modify")
},
{.name = "action",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainLifecycleActionCompleter,
.help = N_("lifecycle action to set")
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "user",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("the username")
},
{.name = "password",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshCompleteEmpty,
.help = N_("the new password")
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "count",
.type = VSH_OT_INT,
+ .required = true,
+ .positional = true,
.flags = VSH_OFLAG_REQ,
.help = N_("number of virtual CPUs")
},
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "vcpulist",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainVcpulistCompleter,
.help = N_("ids of vcpus to manipulate")
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "dev",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainDiskTargetCompleter,
.help = N_("device to set threshold for")
},
{.name = "threshold",
.type = VSH_OT_INT,
+ .required = true,
+ .positional = true,
.flags = VSH_OFLAG_REQ,
.help = N_("threshold as a scaled number (by default bytes)")
},
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "iothread",
.type = VSH_OT_INT,
+ .required = true,
+ .positional = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainIOThreadIdCompleter,
.help = N_("IOThread ID number")
},
{.name = "cpulist",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainCpulistCompleter,
.help = N_("host cpu number(s) to set")
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "id",
.type = VSH_OT_INT,
+ .required = true,
+ .positional = true,
.flags = VSH_OFLAG_REQ,
.help = N_("iothread for the new IOThread")
},
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "id",
.type = VSH_OT_INT,
+ .required = true,
+ .positional = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainIOThreadIdCompleter,
.help = N_("iothread id of existing IOThread")
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "id",
.type = VSH_OT_INT,
+ .required = true,
+ .positional = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainIOThreadIdCompleter,
.help = N_("iothread_id for the IOThread to delete")
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "uri",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("URI of the namespace")
},
},
{.name = "keycode",
.type = VSH_OT_ARGV,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshKeycodeNameCompleter,
.help = N_("the key code")
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "pid",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshCompleteEmpty,
.help = N_("the process ID")
},
{.name = "signame",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainSignalCompleter,
.help = N_("the signal number or name")
},
{.name = "size",
.type = VSH_OT_INT,
+ .required = true,
+ .positional = true,
.flags = VSH_OFLAG_REQ,
.help = N_("new memory size, as scaled integer (default KiB)")
},
},
{.name = "size",
.type = VSH_OT_INT,
+ .required = true,
+ .positional = true,
.flags = VSH_OFLAG_REQ,
.help = N_("new maximum memory size, as scaled integer (default KiB)")
},
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "name",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshCompleteEmpty,
.help = N_("name of the FD group")
},
{.name = "pass-fds",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshCompleteEmpty,
.help = N_("file descriptors N,M,... to associate")
},
{.name = "cmd",
.type = VSH_OT_ARGV,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("command")
},
static const vshCmdOptDef opts_qemu_attach[] = {
{.name = "pid",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshCompleteEmpty,
.help = N_("pid")
},
{.name = "cmd",
.type = VSH_OT_ARGV,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("command")
},
},
{.name = "cmd",
.type = VSH_OT_ARGV,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("command to run")
},
static const vshCmdOptDef opts_domxmlfromnative[] = {
{.name = "format",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("source config data format")
},
{.name = "config",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshCompletePathLocalExisting,
.help = N_("config data file to import from")
static const vshCmdOptDef opts_domxmltonative[] = {
{.name = "format",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("target config data type format")
},
static const vshCmdOptDef opts_domname[] = {
{.name = "domain",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainUUIDCompleter,
.help = N_("domain id or uuid")
VIR_CONNECT_LIST_DOMAINS_INACTIVE),
{.name = "new-name",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshCompleteEmpty,
.help = N_("new domain name")
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "desturi",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshCompleteEmpty,
.help = N_("connection URI of the destination host as seen from the client(normal migration) or source(p2p migration)")
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "downtime",
.type = VSH_OT_INT,
+ .required = true,
+ .positional = true,
.flags = VSH_OFLAG_REQ,
.help = N_("maximum tolerable downtime (in milliseconds) for migration")
},
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "bandwidth",
.type = VSH_OT_INT,
+ .required = true,
+ .positional = true,
.flags = VSH_OFLAG_REQ,
.help = N_("migration bandwidth limit in MiB/s")
},
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "alias",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainDeviceAliasCompleter,
.help = N_("device alias")
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "type",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("network interface type")
},
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "target",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainDiskTargetCompleter,
.help = N_("target of disk device")
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "path",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshDomainDiskTargetCompleter,
.help = N_("Fully-qualified path or target of disk device")
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "user",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("user to list authorized keys for"),
},
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "user",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("user to set authorized keys for"),
},
static const vshCmdOptDef opts_allocpages[] = {
{.name = "pagesize",
.type = VSH_OT_INT,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshAllocpagesPagesizeCompleter,
.help = N_("page size (in kibibytes)")
},
{.name = "pagecount",
.type = VSH_OT_INT,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("page count")
},
static const vshCmdOptDef opts_node_suspend[] = {
{.name = "target",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshNodeSuspendTargetCompleter,
.help = N_("mem(Suspend-to-RAM), disk(Suspend-to-Disk), "
},
{.name = "duration",
.type = VSH_OT_INT,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("Suspend duration in seconds, at least 60")
},
static const vshCmdOptDef opts_cpu_models[] = {
{.name = "arch",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.completer = virshArchCompleter,
.flags = VSH_OFLAG_REQ,
.help = N_("architecture")
#define VIRSH_COMMON_OPT_INTERFACE(cflags) \
{.name = "interface", \
.type = VSH_OT_DATA, \
+ .positional = true, \
+ .required = true, \
.flags = VSH_OFLAG_REQ, \
.help = N_("interface name or MAC address"), \
.completer = virshInterfaceNameCompleter, \
static const vshCmdOptDef opts_interface_name[] = {
{.name = "interface",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshInterfaceMacCompleter,
.help = N_("interface mac")
static const vshCmdOptDef opts_interface_mac[] = {
{.name = "interface",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshInterfaceNameCompleter,
.help = N_("interface name")
static const vshCmdOptDef opts_interface_bridge[] = {
{.name = "interface",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshInterfaceNameCompleter,
.help = N_("existing interface name")
},
{.name = "bridge",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("new bridge device name")
},
static const vshCmdOptDef opts_interface_unbridge[] = {
{.name = "bridge",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("current bridge device name")
},
#define VIRSH_COMMON_OPT_NETWORK(_helpstr, cflags) \
{.name = "network", \
.type = VSH_OT_DATA, \
+ .positional = true, \
+ .required = true, \
.flags = VSH_OFLAG_REQ, \
.help = _helpstr, \
.completer = virshNetworkNameCompleter, \
#define VIRSH_COMMON_OPT_NETWORK_PORT(cflags) \
{.name = "port", \
.type = VSH_OT_DATA, \
+ .positional = true, \
+ .required = true, \
.flags = VSH_OFLAG_REQ, \
.help = N_("port UUID"), \
.completer = virshNetworkPortUUIDCompleter, \
VIRSH_COMMON_OPT_NETWORK_FULL(0),
{.name = "uri",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("URI of the namespace")
},
static const vshCmdOptDef opts_network_name[] = {
{.name = "network",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshNetworkUUIDCompleter,
.help = N_("network uuid")
VIRSH_COMMON_OPT_NETWORK_FULL(0),
{.name = "command",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshNetworkUpdateCommandCompleter,
.help = N_("type of update (add-first, add-last (add), delete, or modify)")
},
{.name = "section",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshNetworkUpdateSectionCompleter,
.help = N_("which section of network configuration to update")
},
{.name = "xml",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshCompletePathLocalExisting,
.help = N_("name of file containing xml (or, if it starts with '<', the complete "
},
{.name = "device",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("device name or wwn pair in 'wwnn,wwpn' format"),
.completer = virshNodeDeviceNameCompleter,
static const vshCmdOptDef opts_node_device_dumpxml[] = {
{.name = "device",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("device name or wwn pair in 'wwnn,wwpn' format"),
.completer = virshNodeDeviceNameCompleter,
static const vshCmdOptDef opts_node_device_detach[] = {
{.name = "device",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("device key"),
.completer = virshNodeDeviceNameCompleter,
static const vshCmdOptDef opts_node_device_reattach[] = {
{.name = "device",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("device key"),
.completer = virshNodeDeviceNameCompleter,
static const vshCmdOptDef opts_node_device_reset[] = {
{.name = "device",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("device key"),
.completer = virshNodeDeviceNameCompleter,
static const vshCmdOptDef opts_node_device_undefine[] = {
{.name = "device",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("device name or wwn pair in 'wwnn,wwpn' format"),
.completer = virshNodeDeviceNameCompleter,
static const vshCmdOptDef opts_node_device_start[] = {
{.name = "device",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("device name"),
.completer = virshNodeDeviceNameCompleter,
static const vshCmdOptDef opts_node_device_autostart[] = {
{.name = "device",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("device name or wwn pair in 'wwnn,wwpn' format"),
.completer = virshNodeDeviceNameCompleter,
static const vshCmdOptDef opts_node_device_info[] = {
{.name = "device",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("device name or wwn pair in 'wwnn,wwpn' format"),
.completer = virshNodeDeviceNameCompleter,
static const vshCmdOptDef opts_node_device_update[] = {
{.name = "device",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("device name or wwn pair in 'wwnn,wwpn' format"),
.completer = virshNodeDeviceNameCompleter,
static const vshCmdOptDef opts_nwfilter_undefine[] = {
{.name = "nwfilter",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("network filter name or uuid"),
.completer = virshNWFilterNameCompleter,
static const vshCmdOptDef opts_nwfilter_dumpxml[] = {
{.name = "nwfilter",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("network filter name or uuid"),
.completer = virshNWFilterNameCompleter,
static const vshCmdOptDef opts_nwfilter_edit[] = {
{.name = "nwfilter",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("network filter name or uuid"),
.completer = virshNWFilterNameCompleter,
static const vshCmdOptDef opts_nwfilter_binding_delete[] = {
{.name = "binding",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("network filter binding port dev"),
.completer = virshNWFilterBindingNameCompleter,
static const vshCmdOptDef opts_nwfilter_binding_dumpxml[] = {
{.name = "binding",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("network filter binding portdev"),
.completer = virshNWFilterBindingNameCompleter,
#define VIRSH_COMMON_OPT_POOL_X_AS \
{.name = "name", \
.type = VSH_OT_DATA, \
+ .positional = true, \
+ .required = true, \
.flags = VSH_OFLAG_REQ, \
.completer = virshCompleteEmpty, \
.help = N_("name of the pool") \
}, \
{.name = "type", \
.type = VSH_OT_DATA, \
+ .positional = true, \
+ .required = true, \
.flags = VSH_OFLAG_REQ, \
.completer = virshPoolTypeCompleter, \
.help = N_("type of the pool") \
static const vshCmdOptDef opts_find_storage_pool_sources_as[] = {
{.name = "type",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshPoolTypeCompleter,
.help = N_("type of storage pool sources to find")
static const vshCmdOptDef opts_find_storage_pool_sources[] = {
{.name = "type",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshPoolTypeCompleter,
.help = N_("type of storage pool sources to discover")
static const vshCmdOptDef opts_secret_dumpxml[] = {
{.name = "secret",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("secret UUID"),
.completer = virshSecretUUIDCompleter,
static const vshCmdOptDef opts_secret_set_value[] = {
{.name = "secret",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("secret UUID"),
.completer = virshSecretUUIDCompleter,
static const vshCmdOptDef opts_secret_get_value[] = {
{.name = "secret",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("secret UUID"),
.completer = virshSecretUUIDCompleter,
static const vshCmdOptDef opts_secret_undefine[] = {
{.name = "secret",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("secret UUID"),
.completer = virshSecretUUIDCompleter,
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT),
{.name = "snapshotname",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("snapshot name"),
.completer = virshSnapshotNameCompleter,
#define VIRSH_COMMON_OPT_VOL_NAME(_helpstr) \
{.name = "vol", \
.type = VSH_OT_DATA, \
+ .positional = true, \
+ .required = true, \
.flags = VSH_OFLAG_REQ, \
.help = _helpstr, \
.completer = virshStorageVolNameCompleter, \
#define VIRSH_COMMON_OPT_VOL_KEY(_helpstr) \
{.name = "vol", \
.type = VSH_OT_DATA, \
+ .positional = true, \
+ .required = true, \
.flags = VSH_OFLAG_REQ, \
.help = _helpstr, \
.completer = virshStorageVolKeyCompleter, \
VIRSH_COMMON_OPT_POOL_NAME,
{.name = "name",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshCompleteEmpty,
.help = N_("name of the volume")
},
{.name = "capacity",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshCompleteEmpty,
.help = N_("size of the vol, as scaled integer (default bytes)")
VIRSH_COMMON_OPT_VOL_FULL,
{.name = "newname",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshCompleteEmpty,
.help = N_("clone name")
VIRSH_COMMON_OPT_VOL_FULL,
{.name = "capacity",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = virshCompleteEmpty,
.help = N_("new capacity for the vol, as scaled integer (default bytes)")
#define VIRSH_COMMON_OPT_POOL(_helpstr, cflags) \
{.name = "pool", \
.type = VSH_OT_DATA, \
+ .positional = true, \
+ .required = true, \
.flags = VSH_OFLAG_REQ, \
.help = _helpstr, \
.completer = virshStoragePoolNameCompleter, \
#define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \
{.name = "domain", \
.type = VSH_OT_DATA, \
+ .positional = true, \
+ .required = true, \
.flags = VSH_OFLAG_REQ, \
.help = _helpstr, \
.completer = virshDomainNameCompleter, \
#define VIRSH_COMMON_OPT_FILE(_helpstr) \
VIRSH_COMMON_OPT_FILE_FULL(_helpstr, true)
-#define VIRSH_COMMON_OPT_FILE_FULL(_helpstr, required) \
+#define VIRSH_COMMON_OPT_FILE_FULL(_helpstr, required_) \
{.name = "file", \
- .type = required ? VSH_OT_DATA : VSH_OT_STRING, \
- .flags = required ? VSH_OFLAG_REQ : VSH_OFLAG_NONE, \
+ .type = required_ ? VSH_OT_DATA : VSH_OT_STRING, \
+ .required = required_, \
+ .positional = required_, \
+ .flags = required_ ? VSH_OFLAG_REQ : VSH_OFLAG_NONE, \
.completer = virshCompletePathLocalExisting, \
.help = _helpstr \
}
static const vshCmdOptDef opts_srv_threadpool_info[] = {
{.name = "server",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = vshAdmServerCompleter,
.help = N_("Server to retrieve threadpool attributes from."),
static const vshCmdOptDef opts_srv_threadpool_set[] = {
{.name = "server",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = vshAdmServerCompleter,
.help = N_("Server to alter threadpool attributes on."),
static const vshCmdOptDef opts_srv_clients_list[] = {
{.name = "server",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = vshAdmServerCompleter,
.help = N_("server which to list connected clients from"),
static const vshCmdOptDef opts_client_info[] = {
{.name = "server",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = vshAdmServerCompleter,
.help = N_("server to which <client> is connected to"),
},
{.name = "client",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("client which to retrieve identity information for"),
},
static const vshCmdOptDef opts_client_disconnect[] = {
{.name = "server",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = vshAdmServerCompleter,
.help = N_("server which the client is currently connected to"),
},
{.name = "client",
.type = VSH_OT_INT,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("client which to disconnect, specified by ID"),
},
static const vshCmdOptDef opts_srv_clients_info[] = {
{.name = "server",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = vshAdmServerCompleter,
.help = N_("Server to retrieve the client limits from."),
static const vshCmdOptDef opts_srv_clients_set[] = {
{.name = "server",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.completer = vshAdmServerCompleter,
.help = N_("Server to alter the client-related configuration limits on."),
static const vshCmdOptDef opts_srv_update_tls_file[] = {
{.name = "server",
.type = VSH_OT_DATA,
+ .positional = true,
+ .required = true,
.flags = VSH_OFLAG_REQ,
.help = N_("Available servers on a daemon. "
"Currently only supports 'libvirtd' or 'virtproxyd'.")
static const vshCmdOptDef opts_daemon_timeout[] = {
{.name = "timeout",
.type = VSH_OT_INT,
+ .positional = true,
+ .required = true,
.help = N_("number of seconds the daemon will run without any active connection"),
.flags = VSH_OFLAG_REQ | VSH_OFLAG_REQ_OPT
},
{
size_t i;
bool seenOptionalOption = false;
+ bool seenPositionalOption = false;
g_auto(virBuffer) complbuf = VIR_BUFFER_INITIALIZER;
/* in order to perform the validation resolve the alias first */
for (i = 0; cmd->opts[i].name; i++) {
const vshCmdOptDef *opt = &cmd->opts[i];
+ bool isPositional = false;
+ bool isRequired = false;
if (i > 63) {
vshError(ctl, "command '%s' has too many options", cmd->name);
}
}
break;
+
case VSH_OT_ARGV:
if (cmd->opts[i + 1].name) {
vshError(ctl, "parameter '%s' of command '%s' must be listed last",
opt->name, cmd->name);
return -1;
}
+
+ isRequired = opt->flags & VSH_OFLAG_REQ;
+ /* ARGV argument is positional if there are no positional options */
+ isPositional = !seenPositionalOption;
break;
case VSH_OT_DATA:
return -1;
}
+ isRequired = true;
+ isPositional = true;
+ seenPositionalOption = true;
+
if (seenOptionalOption) {
vshError(ctl, "parameter '%s' of command '%s' must be listed before optional parameters",
opt->name, cmd->name);
opt->name, cmd->name);
return -1;
}
+ seenPositionalOption = true;
+ isPositional = true;
+ isRequired = true;
} else {
- seenOptionalOption = true;
+ isPositional = false;
+ isRequired = false;
}
break;
}
+
+ if (opt->required != isRequired) {
+ vshError(ctl, "parameter '%s' of command '%s' 'required' state mismatch",
+ opt->name, cmd->name);
+ return -1;
+ }
+
+ if (opt->positional != isPositional) {
+ vshError(ctl, "parameter '%s' of command '%s' 'positional' state mismatch",
+ opt->name, cmd->name);
+ return -1;
+ }
}
virBufferTrim(&complbuf, ", ");
},
{.name = "string",
.type = VSH_OT_ARGV,
+ .positional = true,
.help = N_("arguments to echo")
},
{.name = NULL}
const vshCmdOptDef opts_complete[] = {
{.name = "string",
.type = VSH_OT_ARGV,
+ .positional = true,
.flags = VSH_OFLAG_EMPTY_OK,
.help = N_("partial string to autocomplete")
},
struct _vshCmdOptDef {
const char *name; /* the name of option, or NULL for list end */
vshCmdOptType type; /* option type */
+ bool required; /* option is required */
+ bool positional; /* option is a positional option (not requiring '--optionname') */
unsigned int flags; /* flags */
const char *help; /* non-NULL help string; or for VSH_OT_ALIAS
* the name of a later public option */