goto failed_stats;
if (cpu >= max_id) {
- vshError(ctl, "Start CPU %d is out of range (min: 0, max: %d)",
+ vshError(ctl, _("Start CPU %1$d is out of range (min: 0, max: %2$d)"),
cpu, max_id - 1);
goto cleanup;
}
resultjson = virJSONValueFromString(result);
if (returnval && !resultjson) {
- vshError(ctl, "failed to parse JSON returned by qemu");
+ vshError(ctl, "%s", _("failed to parse JSON returned by qemu"));
return false;
}
}
if (returnval) {
if (!(formatjson = virJSONValueObjectGet(resultjson, "return"))) {
- vshError(ctl, "'return' member missing");
+ vshError(ctl, "%s", _("'return' member missing"));
return false;
}
} else {
if (flags & VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES &&
!(flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_INC))) {
- vshError(ctl, "'--copy-storage-synchronous-writes' requires one of '--copy-storage-all', '--copy-storage-inc'");
+ vshError(ctl, "%s", _("'--copy-storage-synchronous-writes' requires one of '--copy-storage-all', '--copy-storage-inc'"));
goto out;
}
g_autofree char **val = NULL;
if (!(flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_INC))) {
- vshError(ctl, "'--migrate-disks' requires one of '--copy-storage-all', '--copy-storage-inc'");
+ vshError(ctl, "%s", _("'--migrate-disks' requires one of '--copy-storage-all', '--copy-storage-inc'"));
goto out;
}
g_autofree char **val = NULL;
if (!(flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_INC))) {
- vshError(ctl, "'--migrate-disks-detect-zeroes' requires one of '--copy-storage-all', '--copy-storage-inc'");
+ vshError(ctl, "%s", _("'--migrate-disks-detect-zeroes' requires one of '--copy-storage-all', '--copy-storage-inc'"));
goto out;
}
const vshCmdDef *alias;
if (!(alias = vshCmddefSearch(cmd->alias))) {
- vshError(ctl, "command alias '%s' is pointing to a non-existent command '%s'",
+ vshError(ctl, _("command alias '%1$s' is pointing to a non-existent command '%2$s'"),
cmd->name, cmd->alias);
return -1;
}
if (alias->alias) {
- vshError(ctl, "command alias '%s' is pointing to another command alias '%s'",
+ vshError(ctl, _("command alias '%1$s' is pointing to another command alias '%2$s'"),
cmd->name, cmd->alias);
return -1;
}
if (cmd->handler) {
- vshError(ctl, "command '%s' has handler set", cmd->name);
+ vshError(ctl, _("command '%1$s' has handler set"), cmd->name);
return -1;
}
if (cmd->opts) {
- vshError(ctl, "command '%s' has options set", cmd->name);
+ vshError(ctl, _("command '%1$s' has options set"), cmd->name);
return -1;
}
if (cmd->info) {
- vshError(ctl, "command '%s' has info set", cmd->name);
+ vshError(ctl, _("command '%1$s' has info set"), cmd->name);
return -1;
}
if (cmd->flags != 0) {
- vshError(ctl, "command '%s' has multiple flags set", cmd->name);
+ vshError(ctl, _("command '%1$s' has multiple flags set"), cmd->name);
return -1;
}
/* Each command has to provide a non-empty help string. */
if (!cmd->info || !cmd->info->help || !*cmd->info->help) {
- vshError(ctl, "command '%s' lacks help", cmd->name);
+ vshError(ctl, _("command '%1$s' lacks help"), cmd->name);
return -1;
}
/* allow at most one optional positional option */
if (opt->positional && !opt->required) {
if (seenOptionalPositionalOption) {
- vshError(ctl, "multiple optional positional arguments (%s, %s) of command '%s' are not allowed",
+ vshError(ctl, _("multiple optional positional arguments (%1$s, %2$s) of command '%3$s' are not allowed"),
seenOptionalPositionalOption, opt->name, cmd->name);
return -1;
}
/* all optional positional arguments must be defined after the required ones */
if (seenOptionalPositionalOption && opt->positional && opt->required) {
- vshError(ctl, "required positional argument '%s' declared after an optional positional argument '%s' of command '%s'",
+ vshError(ctl, _("required positional argument '%1$s' declared after an optional positional argument '%2$s' of command '%3$s'"),
opt->name, seenOptionalPositionalOption, cmd->name);
return -1;
}
/* Mandate no completer flags if no completer is specified */
if (opt->completer_flags != 0 && !opt->completer) {
- vshError(ctl, "completer_flags of argument '%s' of command '%s' must be 0 if no completer is used",
+ vshError(ctl, _("completer_flags of argument '%1$s' of command '%2$s' must be 0 if no completer is used"),
opt->name, cmd->name);
return -1;
}
if (opt->unwanted_positional && opt->positional) {
- vshError(ctl, "unwanted_positional flag of argument '%s' of command '%s' must not be used together with positional",
+ vshError(ctl, _("unwanted_positional flag of argument '%1$s' of command '%2$s' must not be used together with positional"),
opt->name, cmd->name);
return -1;
}
switch (opt->type) {
case VSH_OT_NONE:
- vshError(ctl, "invalid type 'NONE' of option '%s' of command '%s'",
+ vshError(ctl, _("invalid type 'NONE' of option '%1$s' of command '%2$s'"),
opt->name, cmd->name);
return -1;
case VSH_OT_BOOL:
if (opt->completer) {
- vshError(ctl, "bool parameter '%s' of command '%s' has completer set",
+ vshError(ctl, _("bool parameter '%1$s' of command '%2$s' has completer set"),
opt->name, cmd->name);
return -1;
}
if (opt->positional || opt->unwanted_positional) {
- vshError(ctl, "boolean parameter '%s' of command '%s' must not be positional",
+ vshError(ctl, _("boolean parameter '%1$s' of command '%2$s' must not be positional"),
opt->name, cmd->name);
return -1;
}
if (opt->required) {
- vshError(ctl, "parameter '%s' of command '%s' misused 'required' flag",
+ vshError(ctl, _("parameter '%1$s' of command '%2$s' misused 'required' flag"),
opt->name, cmd->name);
return -1; /* bool can't be mandatory */
}
opt->unwanted_positional ||
opt->completer ||
!opt->help) {
- vshError(ctl, "parameter '%s' of command '%s' has incorrect alias option",
+ vshError(ctl, _("parameter '%1$s' of command '%2$s' has incorrect alias option"),
opt->name, cmd->name);
return -1;
}
if (p) {
/* If alias comes with value, replacement must not be bool */
if (cmd->opts[j].type == VSH_OT_BOOL) {
- vshError(ctl, "alias '%s' of command '%s' has mismatched alias type",
+ vshError(ctl, _("alias '%1$s' of command '%2$s' has mismatched alias type"),
opt->name, cmd->name);
return -1;
}
}
if (!cmd->opts[j].name) {
- vshError(ctl, "alias '%s' of command '%s' has missing alias option",
+ vshError(ctl, _("alias '%1$s' of command '%2$s' has missing alias option"),
opt->name, cmd->name);
return -1;
}
case VSH_OT_ARGV:
if (cmd->opts[i + 1].name) {
- vshError(ctl, "parameter '%s' of command '%s' must be listed last",
+ vshError(ctl, _("parameter '%1$s' of command '%2$s' must be listed last"),
opt->name, cmd->name);
return -1;
}
case VSH_OT_INT:
case VSH_OT_STRING:
if (opt->positional && seenOptionalOption) {
- vshError(ctl, "parameter '%s' of command '%s' must be listed before optional parameters",
+ vshError(ctl, _("parameter '%1$s' of command '%2$s' must be listed before optional parameters"),
opt->name, cmd->name);
return -1;
}
{
/* log file close */
if (VIR_CLOSE(ctl->log_fd) < 0) {
- vshError(ctl, _("%1$s: failed to write log file: %2$s"),
- ctl->logfile ? ctl->logfile : "?",
- g_strerror(errno));
+ if (ctl->logfile) {
+ vshError(ctl, _("%1$s: failed to write log file: %2$s"),
+ ctl->logfile, g_strerror(errno));
+ } else {
+ vshError(ctl, _("failed to write log file: %1$s"),
+ g_strerror(errno));
+ }
}
g_clear_pointer(&ctl->logfile, g_free);