Historically the command parser in virsh parses/fills even optional
arguments with values as if they were positional unless opted out using
VSH_OFLAG_REQ_OPT. This creates unexpected situations when commands can
break in this unwanted semantics:
$ virsh snapshot-create-as --print-xml 1 2 3
<domainsnapshot>
<name>2</name>
<description>3</description>
</domainsnapshot>
To prevent any further addition annotate the rest of the arguments with
the 'unwanted_positional' flag, so that the parser can keep parsing them
as such but any further optional argument will not have this behaviour.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
tools/virsh-checkpoint.c | 3 ++
tools/virsh-domain-event.c | 3 ++
tools/virsh-domain-monitor.c | 2 +
tools/virsh-domain.c | 75 ++++++++++++++++++++++++++++++++++++
tools/virsh-host.c | 24 ++++++++++++
tools/virsh-interface.c | 1 +
tools/virsh-network.c | 7 ++++
tools/virsh-nodedev.c | 5 +++
tools/virsh-pool.c | 8 ++++
tools/virsh-secret.c | 4 ++
tools/virsh-snapshot.c | 3 ++
tools/virsh-volume.c | 10 +++++
12 files changed, 145 insertions(+)
diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c
index 7151e2b182..48e3a586e4 100644
--- a/tools/virsh-checkpoint.c
+++ b/tools/virsh-checkpoint.c
@@ -189,11 +189,13 @@ static const vshCmdOptDef opts_checkpoint_create_as[] = {
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "name",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("name of checkpoint")
},
{.name = "description",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("description of checkpoint")
},
@@ -630,6 +632,7 @@ static const vshCmdOptDef opts_checkpoint_list[] = {
},
{.name = "from",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("limit list to children of given checkpoint"),
.completer = virshCheckpointNameCompleter,
},
diff --git a/tools/virsh-domain-event.c b/tools/virsh-domain-event.c
index 73b00f3bb2..8bf57ade7a 100644
--- a/tools/virsh-domain-event.c
+++ b/tools/virsh-domain-event.c
@@ -867,11 +867,13 @@ static const vshCmdInfo info_event = {
static const vshCmdOptDef opts_event[] = {
{.name = "domain",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("filter by domain name, id or uuid"),
.completer = virshDomainNameCompleter,
},
{.name = "event",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshDomainEventNameCompleter,
.help = N_("which event type to wait for")
},
@@ -885,6 +887,7 @@ static const vshCmdOptDef opts_event[] = {
},
{.name = "timeout",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("timeout seconds")
},
{.name = "list",
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 71a5086c00..d88cf64235 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -1349,6 +1349,7 @@ static const vshCmdOptDef opts_domtime[] = {
},
{.name = "time",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("time to set")
},
{.name = NULL}
@@ -2231,6 +2232,7 @@ static const vshCmdOptDef opts_domifaddr[] = {
.help = N_("always display names and MACs of interfaces")},
{.name = "source",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.flags = VSH_OFLAG_NONE,
.completer = virshDomainInterfaceAddrSourceCompleter,
.help = N_("address source: 'lease', 'agent', or
'arp'")},
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 9a41e32e3d..600388dceb 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -844,34 +844,41 @@ static const vshCmdOptDef opts_attach_interface[] = {
},
{.name = "target",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("target network name")
},
{.name = "mac",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("MAC address")
},
{.name = "script",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("script used to bridge network interface")
},
{.name = "model",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("model type")
},
{.name = "alias",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("custom alias name of interface device")
},
{.name = "inbound",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("control domain's incoming traffics")
},
{.name = "outbound",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("control domain's outgoing traffics")
},
@@ -889,6 +896,7 @@ static const vshCmdOptDef opts_attach_interface[] = {
},
{.name = "source-mode",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshDomainInterfaceSourceModeCompleter,
.help = N_("mode attribute of <source/> element")
},
@@ -1550,30 +1558,36 @@ static const vshCmdOptDef opts_blkiotune[] = {
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "weight",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("IO Weight")
},
{.name = "device-weights",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("per-device IO Weights, in the form of
/path/to/device,weight,...")
},
{.name = "device-read-iops-sec",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("per-device read I/O limit per second, in the form of
/path/to/device,read_iops_sec,...")
},
{.name = "device-write-iops-sec",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("per-device write I/O limit per second, in the form of
/path/to/device,write_iops_sec,...")
},
{.name = "device-read-bytes-sec",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("per-device bytes read per second, in the form of
/path/to/device,read_bytes_sec,...")
},
{.name = "device-write-bytes-sec",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("per-device bytes wrote per second, in the form of
/path/to/device,write_bytes_sec,...")
},
@@ -2031,10 +2045,12 @@ static const vshCmdOptDef opts_blockcommit[] = {
},
{.name = "bandwidth",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("bandwidth limit in MiB/s")
},
{.name = "base",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshDomainBlockjobBaseTopCompleter,
.help = N_("path of base file to commit into (default bottom of chain)")
},
@@ -2044,6 +2060,7 @@ static const vshCmdOptDef opts_blockcommit[] = {
},
{.name = "top",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshDomainBlockjobBaseTopCompleter,
.help = N_("path of top file to commit from (default top of chain)")
},
@@ -2066,6 +2083,7 @@ static const vshCmdOptDef opts_blockcommit[] = {
},
{.name = "timeout",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("implies --wait, abort if copy exceeds timeout (in seconds)")
},
{.name = "pivot",
@@ -2251,10 +2269,12 @@ static const vshCmdOptDef opts_blockcopy[] = {
},
{.name = "dest",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("path of the copy to create")
},
{.name = "bandwidth",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("bandwidth limit in MiB/s")
},
{.name = "shallow",
@@ -2283,6 +2303,7 @@ static const vshCmdOptDef opts_blockcopy[] = {
},
{.name = "timeout",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("implies --wait, abort if copy exceeds timeout (in seconds)")
},
{.name = "pivot",
@@ -2299,21 +2320,25 @@ static const vshCmdOptDef opts_blockcopy[] = {
},
{.name = "xml",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompletePathLocalExisting,
.help = N_("filename containing XML description of the copy destination")
},
{.name = "format",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.flags = VSH_OFLAG_NONE,
.completer = virshDomainStorageFileFormatCompleter,
.help = N_("format of the destination file")
},
{.name = "granularity",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("power-of-two granularity to use during the copy")
},
{.name = "buf-size",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("maximum amount of in-flight data during the copy")
},
{.name = "bytes",
@@ -2608,6 +2633,7 @@ static const vshCmdOptDef opts_blockjob[] = {
},
{.name = "bandwidth",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("set the bandwidth limit in MiB/s")
},
{.name = NULL}
@@ -2796,10 +2822,12 @@ static const vshCmdOptDef opts_blockpull[] = {
},
{.name = "bandwidth",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("bandwidth limit in MiB/s")
},
{.name = "base",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshDomainBlockjobBaseTopCompleter,
.help = N_("path of backing file in chain for a partial pull")
},
@@ -2813,6 +2841,7 @@ static const vshCmdOptDef opts_blockpull[] = {
},
{.name = "timeout",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("with --wait, abort if pull exceeds timeout (in seconds)")
},
{.name = "async",
@@ -3000,6 +3029,7 @@ static const vshCmdOptDef opts_console[] = {
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "devname", /* sc_prohibit_devname */
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshDomainConsoleCompleter,
.help = N_("character device name")
},
@@ -3246,11 +3276,13 @@ static const vshCmdOptDef opts_domiftune[] = {
},
{.name = "inbound",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("control domain's incoming traffics")
},
{.name = "outbound",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("control domain's outgoing traffics")
},
@@ -3568,6 +3600,7 @@ static const vshCmdOptDef opts_undefine[] = {
},
{.name = "storage",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshDomainUndefineStorageDisksCompleter,
.help = N_("remove associated storage volumes (comma separated list of "
"targets or source paths) (see domblklist)")
@@ -4013,6 +4046,7 @@ static const vshCmdOptDef opts_start[] = {
},
{.name = "pass-fds",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("pass file descriptors N,M,... to the guest")
},
@@ -4159,6 +4193,7 @@ static const vshCmdOptDef opts_save[] = {
},
{.name = "xml",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompletePathLocalExisting,
.help = N_("filename containing updated XML for the target")
},
@@ -5250,6 +5285,7 @@ static const vshCmdOptDef opts_restore[] = {
},
{.name = "xml",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompletePathLocalExisting,
.help = N_("filename containing updated XML for the target")
},
@@ -5352,6 +5388,7 @@ static const vshCmdOptDef opts_dump[] = {
{.name = "format",
.type = VSH_OT_STRING,
.flags = VSH_OFLAG_NONE,
+ .unwanted_positional = true,
.completer = virshDomainCoreDumpFormatCompleter,
.help = N_("specify the format of memory-only dump")
},
@@ -5495,11 +5532,13 @@ static const vshCmdOptDef opts_screenshot[] = {
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "file",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompletePathLocalExisting,
.help = N_("where to store the screenshot")
},
{.name = "screen",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("ID of a screen to take screenshot of")
},
{.name = NULL}
@@ -6834,11 +6873,13 @@ static const vshCmdOptDef opts_vcpupin[] = {
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "vcpu",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.completer = virshDomainVcpuCompleter,
.help = N_("vcpu number")
},
{.name = "cpulist",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.flags = VSH_OFLAG_EMPTY_OK,
.completer = virshDomainCpulistCompleter,
.help = N_("host cpu number(s) to set, or omit option to query")
@@ -7047,6 +7088,7 @@ static const vshCmdOptDef opts_emulatorpin[] = {
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "cpulist",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.flags = VSH_OFLAG_EMPTY_OK,
.completer = virshDomainCpulistCompleter,
.help = N_("host cpu number(s) to set, or omit option to query")
@@ -7231,6 +7273,7 @@ static const vshCmdOptDef opts_guestvcpus[] = {
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "cpulist",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshDomainVcpulistViaAgentCompleter,
.help = N_("list of cpus to enable or disable")
},
@@ -7653,22 +7696,27 @@ static const vshCmdOptDef opts_iothreadset[] = {
},
{.name = "poll-max-ns",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("set the maximum IOThread polling time in ns")
},
{.name = "poll-grow",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("set the value to increase the IOThread polling time")
},
{.name = "poll-shrink",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("set the value for reduction of the IOThread polling time")
},
{.name = "thread-pool-min",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("lower boundary for worker thread pool")
},
{.name = "thread-pool-max",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("upper boundary for worker thread pool")
},
VIRSH_COMMON_OPT_DOMAIN_CONFIG,
@@ -7824,10 +7872,12 @@ static const vshCmdOptDef opts_cpu_stats[] = {
},
{.name = "start",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("Show statistics from this CPU")
},
{.name = "count",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("Number of shown CPUs at most")
},
{.name = NULL}
@@ -8010,6 +8060,7 @@ static const vshCmdOptDef opts_create[] = {
},
{.name = "pass-fds",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("pass file descriptors N,M,... to the guest")
},
@@ -8368,10 +8419,12 @@ static const vshCmdOptDef opts_metadata[] = {
},
{.name = "key",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("key to be used as a namespace identifier"),
},
{.name = "set",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("new metadata to set"),
},
@@ -8856,15 +8909,18 @@ static const vshCmdOptDef opts_update_memory_device[] = {
},
{.name = "alias",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshDomainDeviceAliasCompleter,
.help = N_("memory device alias")
},
{.name = "node",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("memory device target node")
},
{.name = "requested-size",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("new value of <requested/> size, as scaled integer (default
KiB)")
},
{.name = NULL}
@@ -8998,18 +9054,22 @@ static const vshCmdOptDef opts_memtune[] = {
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "hard-limit",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("Max memory, as scaled integer (default KiB)")
},
{.name = "soft-limit",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("Memory during contention, as scaled integer (default KiB)")
},
{.name = "swap-hard-limit",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("Max memory plus swap, as scaled integer (default KiB)")
},
{.name = "min-guarantee",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("Min guaranteed memory, as scaled integer (default KiB)")
},
VIRSH_COMMON_OPT_DOMAIN_CONFIG,
@@ -9165,11 +9225,13 @@ static const vshCmdOptDef opts_perf[] = {
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "enable",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshDomainPerfEnableCompleter,
.help = N_("perf events which will be enabled")
},
{.name = "disable",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshDomainPerfDisableCompleter,
.help = N_("perf events which will be disabled")
},
@@ -9289,12 +9351,14 @@ static const vshCmdOptDef opts_numatune[] = {
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "mode",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshDomainNumatuneModeCompleter,
.help = N_("NUMA mode, one of strict, preferred and interleave "
"or a number from the virDomainNumatuneMemMode enum")
},
{.name = "nodeset",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("NUMA node selections to set")
},
VIRSH_COMMON_OPT_DOMAIN_CONFIG,
@@ -9470,6 +9534,7 @@ static const vshCmdOptDef opts_domsetlaunchsecstate[] = {
},
{.name = "set-address",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("physical address within the guest domain's memory to set the
secret"),
},
{.name = NULL}
@@ -9872,11 +9937,13 @@ static const vshCmdInfo info_qemu_monitor_event = {
static const vshCmdOptDef opts_qemu_monitor_event[] = {
{.name = "domain",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("filter by domain name, id or uuid"),
.completer = virshDomainNameCompleter,
},
{.name = "event",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("filter by event name")
},
{.name = "pretty",
@@ -9889,6 +9956,7 @@ static const vshCmdOptDef opts_qemu_monitor_event[] = {
},
{.name = "timeout",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("timeout seconds")
},
{.name = "regex",
@@ -10379,6 +10447,7 @@ static const vshCmdOptDef opts_domxmltonative[] = {
},
{.name = "xml",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompletePathLocalExisting,
.help = N_("xml data file to export from")
},
@@ -11871,6 +11940,7 @@ static const vshCmdOptDef opts_domhostname[] = {
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "source",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.flags = VSH_OFLAG_NONE,
.completer = virshDomainHostnameSourceCompleter,
.help = N_("address source: 'lease' or 'agent'")},
@@ -12144,6 +12214,7 @@ static const vshCmdOptDef opts_detach_interface[] = {
},
{.name = "mac",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshDomainInterfaceCompleter,
.completer_flags = VIRSH_DOMAIN_INTERFACE_COMPLETER_MAC,
.help = N_("MAC address")
@@ -12823,11 +12894,13 @@ static const vshCmdOptDef opts_domfstrim[] = {
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "minimum",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("Just a hint to ignore contiguous "
"free ranges smaller than this (Bytes)")
},
{.name = "mountpoint",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshDomainFSMountpointsCompleter,
.help = N_("which mount point to trim")
},
@@ -13295,11 +13368,13 @@ static const vshCmdOptDef opts_domdirtyrate_calc[] = {
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "seconds",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("calculate memory dirty rate within specified seconds, "
"the supported value range from 1 to 60, default to 1.")
},
{.name = "mode",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshDomainDirtyRateCalcModeCompleter,
.help = N_("dirty page rate calculation mode, either of these 3 options "
"'page-sampling, dirty-bitmap, dirty-ring' can be
specified.")
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 712db39d35..52e0dc55de 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -86,20 +86,24 @@ static const vshCmdInfo info_domcapabilities = {
static const vshCmdOptDef opts_domcapabilities[] = {
{.name = "virttype",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshDomainVirtTypeCompleter,
.help = N_("virtualization type (/domain/@type)"),
},
{.name = "emulatorbin",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("path to emulator binary (/domain/devices/emulator)"),
},
{.name = "arch",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshArchCompleter,
.help = N_("domain architecture (/domain/os/type/@arch)"),
},
{.name = "machine",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("machine type (/domain/os/type/@machine)"),
},
{.name = "xpath",
@@ -156,6 +160,7 @@ static const vshCmdInfo info_freecell = {
static const vshCmdOptDef opts_freecell[] = {
{.name = "cellno",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.completer = virshCellnoCompleter,
.help = N_("NUMA cell number")
},
@@ -264,11 +269,13 @@ static const vshCmdInfo info_freepages = {
static const vshCmdOptDef opts_freepages[] = {
{.name = "cellno",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.completer = virshCellnoCompleter,
.help = N_("NUMA cell number")
},
{.name = "pagesize",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.completer = virshAllocpagesPagesizeCompleter,
.help = N_("page size (in kibibytes)")
},
@@ -481,6 +488,7 @@ static const vshCmdOptDef opts_allocpages[] = {
},
{.name = "cellno",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.completer = virshCellnoCompleter,
.help = N_("NUMA cell number")
},
@@ -582,6 +590,7 @@ static const vshCmdInfo info_maxvcpus = {
static const vshCmdOptDef opts_maxvcpus[] = {
{.name = "type",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshDomainVirtTypeCompleter,
.help = N_("domain type")
},
@@ -712,6 +721,7 @@ static const vshCmdInfo info_nodecpustats = {
static const vshCmdOptDef opts_node_cpustats[] = {
{.name = "cpu",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.completer = virshNodeCpuCompleter,
.help = N_("prints specified cpu statistics only.")
},
@@ -850,6 +860,7 @@ static const vshCmdInfo info_nodememstats = {
static const vshCmdOptDef opts_node_memstats[] = {
{.name = "cell",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("prints specified cell statistics only.")
},
{.name = NULL}
@@ -1421,16 +1432,19 @@ static const vshCmdInfo info_node_memory_tune = {
static const vshCmdOptDef opts_node_memory_tune[] = {
{.name = "shm-pages-to-scan",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("number of pages to scan before the shared memory service "
"goes to sleep")
},
{.name = "shm-sleep-millisecs",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("number of millisecs the shared memory service should "
"sleep before next scan")
},
{.name = "shm-merge-across-nodes",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("Specifies if pages from different numa nodes can be merged")
},
{.name = NULL}
@@ -1535,20 +1549,24 @@ static const vshCmdOptDef opts_hypervisor_cpu_compare[] = {
VIRSH_COMMON_OPT_FILE(N_("file containing an XML CPU description")),
{.name = "virttype",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshDomainVirtTypeCompleter,
.help = N_("virtualization type (/domain/@type)"),
},
{.name = "emulator",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("path to emulator binary (/domain/devices/emulator)"),
},
{.name = "arch",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshArchCompleter,
.help = N_("CPU architecture (/domain/os/type/@arch)"),
},
{.name = "machine",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("machine type (/domain/os/type/@machine)"),
},
{.name = "error",
@@ -1637,25 +1655,30 @@ static const vshCmdInfo info_hypervisor_cpu_baseline = {
static const vshCmdOptDef opts_hypervisor_cpu_baseline[] = {
{.name = "file",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompletePathLocalExisting,
.help = N_("file containing XML CPU descriptions"),
},
{.name = "virttype",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshDomainVirtTypeCompleter,
.help = N_("virtualization type (/domain/@type)"),
},
{.name = "emulator",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("path to emulator binary (/domain/devices/emulator)"),
},
{.name = "arch",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshArchCompleter,
.help = N_("CPU architecture (/domain/os/type/@arch)"),
},
{.name = "machine",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("machine type (/domain/os/type/@machine)"),
},
{.name = "features",
@@ -1668,6 +1691,7 @@ static const vshCmdOptDef opts_hypervisor_cpu_baseline[] = {
},
{.name = "model",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCPUModelCompleter,
.help = N_("Shortcut for calling the command with a single CPU model "
"and no additional features")
diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c
index 1b1344c17c..a08bb822ed 100644
--- a/tools/virsh-interface.c
+++ b/tools/virsh-interface.c
@@ -736,6 +736,7 @@ static const vshCmdOptDef opts_interface_bridge[] = {
},
{.name = "delay",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("number of seconds to squelch traffic on newly connected
ports")
},
{.name = "no-start",
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index 59ca842181..5bc91a361f 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -506,11 +506,13 @@ static const vshCmdOptDef opts_network_metadata[] = {
.help = N_("use an editor to change the metadata")
},
{.name = "key",
+ .unwanted_positional = true,
.type = VSH_OT_STRING,
.help = N_("key to be used as a namespace identifier"),
},
{.name = "set",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("new metadata to set"),
},
@@ -1240,6 +1242,7 @@ static const vshCmdOptDef opts_network_update[] = {
},
{.name = "parent-index",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("which parent object to search through")
},
VIRSH_COMMON_OPT_CONFIG(N_("affect next network startup")),
@@ -1579,11 +1582,13 @@ static const vshCmdInfo info_network_event = {
static const vshCmdOptDef opts_network_event[] = {
{.name = "network",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("filter by network name or uuid"),
.completer = virshNetworkNameCompleter,
},
{.name = "event",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshNetworkEventNameCompleter,
.help = N_("which event type to wait for")
},
@@ -1593,6 +1598,7 @@ static const vshCmdOptDef opts_network_event[] = {
},
{.name = "timeout",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("timeout seconds")
},
{.name = "list",
@@ -1694,6 +1700,7 @@ static const vshCmdOptDef opts_network_dhcp_leases[] = {
VIRSH_COMMON_OPT_NETWORK_FULL(VIR_CONNECT_LIST_NETWORKS_ACTIVE),
{.name = "mac",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.flags = VSH_OFLAG_NONE,
.help = N_("MAC address"),
.completer = virshNetworkDhcpMacCompleter,
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index 90cfc187e5..fafebf9972 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -365,6 +365,7 @@ static const vshCmdOptDef opts_node_list_devices[] = {
},
{.name = "cap",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshNodeDeviceCapabilityNameCompleter,
.help = N_("capability names, separated by comma")
},
@@ -643,6 +644,7 @@ static const vshCmdOptDef opts_node_device_detach[] = {
},
{.name = "driver",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshNodeDevicePCIBackendCompleter,
.help = N_("pci device assignment backend driver (e.g. 'vfio' or
'xen')")
},
@@ -884,11 +886,13 @@ static const vshCmdInfo info_node_device_event = {
static const vshCmdOptDef opts_node_device_event[] = {
{.name = "device",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("filter by node device name"),
.completer = virshNodeDeviceNameCompleter,
},
{.name = "event",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshNodeDeviceEventNameCompleter,
.help = N_("which event type to wait for")
},
@@ -898,6 +902,7 @@ static const vshCmdOptDef opts_node_device_event[] = {
},
{.name = "timeout",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("timeout seconds")
},
{.name = "list",
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index 66f8516017..c93204dd30 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -1055,6 +1055,7 @@ static const vshCmdOptDef opts_pool_list[] = {
{.name = "type",
.type = VSH_OT_STRING,
.completer = virshPoolTypeCompleter,
+ .unwanted_positional = true,
.completer_flags = VIRSH_POOL_TYPE_COMPLETER_COMMA,
.help = N_("only list pool of specified type(s) (if supported)")
},
@@ -1382,16 +1383,19 @@ static const vshCmdOptDef opts_find_storage_pool_sources_as[] = {
},
{.name = "host",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("optional host to query")
},
{.name = "port",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("optional port to query")
},
{.name = "initiator",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("optional initiator IQN to use for query")
},
@@ -1466,6 +1470,7 @@ static const vshCmdOptDef opts_find_storage_pool_sources[] = {
},
{.name = "srcSpec",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompletePathLocalExisting,
.help = N_("optional file of source xml to query for pools")
},
@@ -1901,11 +1906,13 @@ static const vshCmdInfo info_pool_event = {
static const vshCmdOptDef opts_pool_event[] = {
{.name = "pool",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshStoragePoolNameCompleter,
.help = N_("filter by storage pool name or uuid")
},
{.name = "event",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshPoolEventNameCompleter,
.help = N_("which event type to wait for")
},
@@ -1915,6 +1922,7 @@ static const vshCmdOptDef opts_pool_event[] = {
},
{.name = "timeout",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("timeout seconds")
},
{.name = "list",
diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
index 7e10afa765..edf3c47362 100644
--- a/tools/virsh-secret.c
+++ b/tools/virsh-secret.c
@@ -201,6 +201,7 @@ static const vshCmdOptDef opts_secret_set_value[] = {
},
{.name = "base64",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("base64-encoded secret value")
},
@@ -714,11 +715,13 @@ static const vshCmdInfo info_secret_event = {
static const vshCmdOptDef opts_secret_event[] = {
{.name = "secret",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("filter by secret name or uuid"),
.completer = virshSecretUUIDCompleter,
},
{.name = "event",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshSecretEventNameCompleter,
.help = N_("which event type to wait for")
},
@@ -728,6 +731,7 @@ static const vshCmdOptDef opts_secret_event[] = {
},
{.name = "timeout",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("timeout seconds")
},
{.name = "list",
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index b47733d05b..2fcf6e3d5e 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -314,11 +314,13 @@ static const vshCmdOptDef opts_snapshot_create_as[] = {
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "name",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("name of snapshot")
},
{.name = "description",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("description of snapshot")
},
@@ -1379,6 +1381,7 @@ static const vshCmdOptDef opts_snapshot_list[] = {
},
{.name = "from",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshSnapshotNameCompleter,
.help = N_("limit list to children of given snapshot")
},
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index 7e6c6d5ef5..4e5673e0ee 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -190,19 +190,23 @@ static const vshCmdOptDef opts_vol_create_as[] = {
},
{.name = "allocation",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshCompleteEmpty,
.help = N_("initial allocation size, as scaled integer (default bytes)")
},
{.name = "format",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("file format type raw,bochs,qcow,qcow2,qed,vmdk")
},
{.name = "backing-vol",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("the backing volume if taking a snapshot")
},
{.name = "backing-vol-format",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.help = N_("format of backing volume if taking a snapshot")
},
{.name = "prealloc-metadata",
@@ -432,6 +436,7 @@ static const vshCmdOptDef opts_vol_create_from[] = {
VIRSH_COMMON_OPT_VOL_FULL,
{.name = "inputpool",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshStoragePoolNameCompleter,
.help = N_("pool name or uuid of the input volume's pool")
},
@@ -613,10 +618,12 @@ static const vshCmdOptDef opts_vol_upload[] = {
VIRSH_COMMON_OPT_POOL_OPTIONAL,
{.name = "offset",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("volume offset to upload to")
},
{.name = "length",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("amount of data to upload")
},
{.name = "sparse",
@@ -721,10 +728,12 @@ static const vshCmdOptDef opts_vol_download[] = {
VIRSH_COMMON_OPT_POOL_OPTIONAL,
{.name = "offset",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("volume offset to download from")
},
{.name = "length",
.type = VSH_OT_INT,
+ .unwanted_positional = true,
.help = N_("amount of data to download")
},
{.name = "sparse",
@@ -875,6 +884,7 @@ static const vshCmdOptDef opts_vol_wipe[] = {
VIRSH_COMMON_OPT_POOL_OPTIONAL,
{.name = "algorithm",
.type = VSH_OT_STRING,
+ .unwanted_positional = true,
.completer = virshStorageVolWipeAlgorithmCompleter,
.help = N_("perform selected wiping algorithm")
},
--
2.44.0