},
{.name = "targetbus",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("target bus of disk device")
},
{.name = "driver",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("driver of disk device")
},
{.name = "subdriver",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("subdriver of disk device")
},
{.name = "iothread",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.completer = virshDomainIOThreadIdCompleter,
.help = N_("IOThread to be used by supported device")
},
{.name = "cache",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("cache mode of disk device")
},
{.name = "io",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("io policy of disk device")
},
{.name = "type",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("target device type")
},
{.name = "shareable",
},
{.name = "mode",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("mode of device reading and writing")
},
{.name = "sourcetype",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("type of source (block|file|network)")
},
{.name = "serial",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("serial of disk device")
},
{.name = "wwn",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("wwn of disk device")
},
{.name = "alias",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("custom alias name of disk device")
},
},
{.name = "address",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("address of disk device")
},
},
{.name = "source-protocol",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("protocol used by disk device source")
},
{.name = "source-host-name",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("host name for source of disk device")
},
{.name = "source-host-transport",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("host transport for source of disk device")
},
{.name = "source-host-socket",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("host socket for source of disk device")
},
VIRSH_COMMON_OPT_DOMAIN_PERSISTENT,
},
{.name = "total-bytes-sec",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("total throughput limit, as scaled integer (default bytes)")
},
{.name = "read_bytes_sec",
},
{.name = "read-bytes-sec",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("read throughput limit, as scaled integer (default bytes)")
},
{.name = "write_bytes_sec",
},
{.name = "write-bytes-sec",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("write throughput limit, as scaled integer (default bytes)")
},
{.name = "total_iops_sec",
},
{.name = "total-iops-sec",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("total I/O operations limit per second")
},
{.name = "read_iops_sec",
},
{.name = "read-iops-sec",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("read I/O operations limit per second")
},
{.name = "write_iops_sec",
},
{.name = "write-iops-sec",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("write I/O operations limit per second")
},
{.name = "total_bytes_sec_max",
},
{.name = "total-bytes-sec-max",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("total max, as scaled integer (default bytes)")
},
{.name = "read_bytes_sec_max",
},
{.name = "read-bytes-sec-max",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("read max, as scaled integer (default bytes)")
},
{.name = "write_bytes_sec_max",
},
{.name = "write-bytes-sec-max",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("write max, as scaled integer (default bytes)")
},
{.name = "total_iops_sec_max",
},
{.name = "total-iops-sec-max",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("total I/O operations max")
},
{.name = "read_iops_sec_max",
},
{.name = "read-iops-sec-max",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("read I/O operations max")
},
{.name = "write_iops_sec_max",
},
{.name = "write-iops-sec-max",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("write I/O operations max")
},
{.name = "size_iops_sec",
},
{.name = "size-iops-sec",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("I/O size in bytes")
},
{.name = "group_name",
},
{.name = "group-name",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("group name to share I/O quota between multiple drives")
},
},
{.name = "total-bytes-sec-max-length",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("duration in seconds to allow total max bytes")
},
{.name = "read_bytes_sec_max_length",
},
{.name = "read-bytes-sec-max-length",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("duration in seconds to allow read max bytes")
},
{.name = "write_bytes_sec_max_length",
},
{.name = "write-bytes-sec-max-length",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("duration in seconds to allow write max bytes")
},
{.name = "total_iops_sec_max_length",
},
{.name = "total-iops-sec-max-length",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("duration in seconds to allow total I/O operations max")
},
{.name = "read_iops_sec_max_length",
},
{.name = "read-iops-sec-max-length",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("duration in seconds to allow read I/O operations max")
},
{.name = "write_iops_sec_max_length",
},
{.name = "write-iops-sec-max-length",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("duration in seconds to allow write I/O operations max")
},
VIRSH_COMMON_OPT_DOMAIN_CONFIG,
},
{.name = "duration",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("duration in seconds")
},
{.name = NULL}
},
{.name = "xpath",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
},
{.name = "xpath",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "weight",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("weight for XEN_CREDIT")
},
{.name = "cap",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("cap for XEN_CREDIT")
},
VIRSH_COMMON_OPT_CURRENT(N_("get/set current scheduler info")),
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "codeset",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCodesetNameCompleter,
.help = N_("the codeset of keycodes, default:linux")
},
{.name = "holdtime",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("the time (in milliseconds) how long the keys will be held")
},
{.name = "keycode",
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "secrethdr",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("path to file containing the secret header"),
},
{.name = "secret",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("path to file containing the secret"),
},
{.name = "set-address",
},
{.name = "pass-fds",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("pass file descriptors N,M,... along with the command")
},
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "timeout",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("timeout seconds. must be positive.")
},
{.name = "async",
},
{.name = "xpath",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
},
{.name = "domain",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("domain name, id or uuid"),
.completer = virshDomainNameCompleter,
},
},
{.name = "disks-uri",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("URI to use for disks migration (overrides --disks-port)")
},
{.name = "comp-methods",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.completer = virshDomainMigrateCompMethodsCompleter,
.help = N_("comma separated list of compression methods to be used")
},
{.name = "comp-mt-level",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("compress level for multithread compression")
},
{.name = "comp-mt-threads",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("number of compression threads for multithread compression")
},
{.name = "comp-mt-dthreads",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("number of decompression threads for multithread compression")
},
{.name = "comp-xbzrle-cache",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("page cache size for xbzrle compression")
},
{.name = "auto-converge-initial",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("initial CPU throttling rate for auto-convergence")
},
{.name = "auto-converge-increment",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("CPU throttling rate increment for auto-convergence")
},
{.name = "persistent-xml",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompletePathLocalExisting,
.help = N_("filename containing updated persistent XML for the target")
},
},
{.name = "postcopy-bandwidth",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("post-copy migration bandwidth limit in MiB/s")
},
{.name = "parallel",
.type = VSH_OT_BOOL,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("enable parallel migration")
},
{.name = "parallel-connections",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("number of connections for parallel migration")
},
{.name = "bandwidth",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("migration bandwidth limit in MiB/s")
},
{.name = "tls-destination",
.type = VSH_OT_STRING,
- .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("override the destination host name used for TLS verification")
},
{.name = "comp-zlib-level",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("compress level for zlib compression")
},
{.name = "comp-zstd-level",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("compress level for zstd compression")
},
{.name = NULL}
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "size",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("requested size of the cache (in bytes) used for compression")
},
{.name = NULL}
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "timeout",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("timeout seconds.")
},
{.name = NULL}
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "type",
.type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
.help = N_("graphics display type")
},
{.name = NULL}
static int
vshCmddefCheckInternals(vshControl *ctl,
const vshCmdDef *cmd,
- bool missingCompleters,
- int brokenPositionals)
+ bool missingCompleters)
{
size_t i;
bool seenOptionalOption = false;
const char *seenOptionalPositionalOption = NULL;
g_auto(virBuffer) complbuf = VIR_BUFFER_INITIALIZER;
- g_auto(virBuffer) posbuf = VIR_BUFFER_INITIALIZER;
/* in order to perform the validation resolve the alias first */
if (cmd->alias) {
}
}
- if (brokenPositionals >= 0) {
- switch (opt->type) {
- case VSH_OT_INT:
- case VSH_OT_STRING:
- case VSH_OT_ARGV:
- if (brokenPositionals == 0 ||
- brokenPositionals == opt->type) {
- if (!(opt->flags & VSH_OFLAG_REQ_OPT) &&
- !(opt->positional || opt->unwanted_positional))
- virBufferStrcat(&posbuf, opt->name, ", ", NULL);
- }
- break;
-
- case VSH_OT_BOOL:
- /* only name is completed */
- /* no point in completing numbers */
- case VSH_OT_ALIAS:
- /* alias is handled in the referenced command */
- case VSH_OT_NONE:
- break;
- }
- }
-
/* allow at most one optional positional option */
if (opt->positional && !opt->required) {
if (seenOptionalPositionalOption) {
}
virBufferTrim(&complbuf, ", ");
- virBufferTrim(&posbuf, ", ");
if (missingCompleters && virBufferUse(&complbuf) > 0)
vshPrintExtra(ctl, "%s: %s\n", cmd->name, virBufferCurrentContent(&complbuf));
- if (virBufferUse(&posbuf)) {
- vshPrintExtra(ctl, "%s: %s\n", cmd->name, virBufferCurrentContent(&posbuf));
- }
-
return 0;
}
if (opt->type == VSH_OT_ALIAS)
continue; /* skip the alias option */
- if (!(opt->flags & VSH_OFLAG_REQ_OPT))
+ if (opt->positional || opt->unwanted_positional)
*opts_need_arg |= 1ULL << i;
if (opt->required)
.type = VSH_OT_BOOL,
.help = N_("output help for each command")
},
- {.name = "broken-positionals",
- .type = VSH_OT_INT,
- .flags = VSH_OFLAG_REQ_OPT,
- .help = N_("debug positional args")
- },
{.name = NULL}
};
const vshCmdInfo info_selftest = {
const vshCmdDef *def;
bool completers = vshCommandOptBool(cmd, "completers-missing");
bool dumphelp = vshCommandOptBool(cmd, "dump-help");
- int brokenPositionals = -1;
-
- ignore_value(vshCommandOptInt(ctl, cmd, "broken-positionals", &brokenPositionals));
for (grp = cmdGroups; grp->name; grp++) {
for (def = grp->commands; def->name; def++) {
if (dumphelp && !def->alias)
vshCmddefHelp(def);
- if (vshCmddefCheckInternals(ctl, def, completers, brokenPositionals) < 0)
+ if (vshCmddefCheckInternals(ctl, def, completers) < 0)
return false;
}
}