tools: Update format strings in translated messages (part 1)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Jiri Denemark 2023-03-09 15:54:42 +01:00
parent 90d8652438
commit 9ec91376cd
8 changed files with 310 additions and 322 deletions

View File

@ -59,10 +59,10 @@ virshCheckpointCreate(vshControl *ctl,
} }
if (from) if (from)
vshPrintExtra(ctl, _("Domain checkpoint %s created from '%s'"), vshPrintExtra(ctl, _("Domain checkpoint %1$s created from '%2$s'"),
name, from); name, from);
else else
vshPrintExtra(ctl, _("Domain checkpoint %s created"), name); vshPrintExtra(ctl, _("Domain checkpoint %1$s created"), name);
return true; return true;
} }
@ -179,7 +179,7 @@ virshParseCheckpointDiskspec(vshControl *ctl,
ret = 0; ret = 0;
cleanup: cleanup:
if (ret < 0) if (ret < 0)
vshError(ctl, _("unable to parse diskspec: %s"), str); vshError(ctl, _("unable to parse diskspec: %1$s"), str);
return ret; return ret;
} }
@ -293,7 +293,7 @@ virshLookupCheckpoint(vshControl *ctl,
if (chkname) { if (chkname) {
*chk = virDomainCheckpointLookupByName(dom, chkname, 0); *chk = virDomainCheckpointLookupByName(dom, chkname, 0);
} else { } else {
vshError(ctl, _("--%s is required"), arg); vshError(ctl, _("--%1$s is required"), arg);
return -1; return -1;
} }
if (!*chk) { if (!*chk) {
@ -354,7 +354,7 @@ cmdCheckpointEdit(vshControl *ctl,
#define EDIT_NOT_CHANGED \ #define EDIT_NOT_CHANGED \
do { \ do { \
vshPrintExtra(ctl, \ vshPrintExtra(ctl, \
_("Checkpoint %s XML configuration not changed.\n"), \ _("Checkpoint %1$s XML configuration not changed.\n"), \
name); \ name); \
ret = true; \ ret = true; \
goto edit_cleanup; \ goto edit_cleanup; \
@ -365,16 +365,16 @@ cmdCheckpointEdit(vshControl *ctl,
edited_name = virDomainCheckpointGetName(edited); edited_name = virDomainCheckpointGetName(edited);
if (STREQ(name, edited_name)) { if (STREQ(name, edited_name)) {
vshPrintExtra(ctl, _("Checkpoint %s edited.\n"), name); vshPrintExtra(ctl, _("Checkpoint %1$s edited.\n"), name);
} else { } else {
unsigned int delete_flags = VIR_DOMAIN_CHECKPOINT_DELETE_METADATA_ONLY; unsigned int delete_flags = VIR_DOMAIN_CHECKPOINT_DELETE_METADATA_ONLY;
if (virDomainCheckpointDelete(edited, delete_flags) < 0) { if (virDomainCheckpointDelete(edited, delete_flags) < 0) {
vshReportError(ctl); vshReportError(ctl);
vshError(ctl, _("Failed to clean up %s"), edited_name); vshError(ctl, _("Failed to clean up %1$s"), edited_name);
goto cleanup; goto cleanup;
} }
vshError(ctl, _("Cannot rename checkpoint %s to %s"), vshError(ctl, _("Cannot rename checkpoint %1$s to %2$s"),
name, edited_name); name, edited_name);
goto cleanup; goto cleanup;
} }
@ -383,7 +383,7 @@ cmdCheckpointEdit(vshControl *ctl,
cleanup: cleanup:
if (!ret && name) if (!ret && name)
vshError(ctl, _("Failed to update %s"), name); vshError(ctl, _("Failed to update %1$s"), name);
return ret; return ret;
} }
@ -705,7 +705,7 @@ cmdCheckpointList(vshControl *ctl,
if (vshCommandOptBool(cmd, option)) { \ if (vshCommandOptBool(cmd, option)) { \
if (tree) { \ if (tree) { \
vshError(ctl, \ vshError(ctl, \
_("--%s and --tree are mutually exclusive"), \ _("--%1$s and --tree are mutually exclusive"), \
option); \ option); \
return false; \ return false; \
} \ } \
@ -944,7 +944,7 @@ cmdCheckpointParent(vshControl *ctl,
if (virshGetCheckpointParent(ctl, checkpoint, &parent) < 0) if (virshGetCheckpointParent(ctl, checkpoint, &parent) < 0)
return false; return false;
if (!parent) { if (!parent) {
vshError(ctl, _("checkpoint '%s' has no parent"), name); vshError(ctl, _("checkpoint '%1$s' has no parent"), name);
return false; return false;
} }
@ -1016,11 +1016,11 @@ cmdCheckpointDelete(vshControl *ctl,
if (virDomainCheckpointDelete(checkpoint, flags) == 0) { if (virDomainCheckpointDelete(checkpoint, flags) == 0) {
if (flags & VIR_DOMAIN_CHECKPOINT_DELETE_CHILDREN_ONLY) if (flags & VIR_DOMAIN_CHECKPOINT_DELETE_CHILDREN_ONLY)
vshPrintExtra(ctl, _("Domain checkpoint %s children deleted\n"), name); vshPrintExtra(ctl, _("Domain checkpoint %1$s children deleted\n"), name);
else else
vshPrintExtra(ctl, _("Domain checkpoint %s deleted\n"), name); vshPrintExtra(ctl, _("Domain checkpoint %1$s deleted\n"), name);
} else { } else {
vshError(ctl, _("Failed to delete checkpoint %s"), name); vshError(ctl, _("Failed to delete checkpoint %1$s"), name);
return false; return false;
} }

View File

@ -327,7 +327,7 @@ virshEventGenericPrint(virConnectPtr conn G_GNUC_UNUSED,
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, _("event '%s' for domain '%s'\n"), virBufferAsprintf(&buf, _("event '%1$s' for domain '%2$s'\n"),
((virshDomEventData *) opaque)->cb->name, ((virshDomEventData *) opaque)->cb->name,
virDomainGetName(dom)); virDomainGetName(dom));
virshEventPrint(opaque, &buf); virshEventPrint(opaque, &buf);
@ -342,7 +342,7 @@ virshEventLifecyclePrint(virConnectPtr conn G_GNUC_UNUSED,
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, _("event 'lifecycle' for domain '%s': %s %s\n"), virBufferAsprintf(&buf, _("event 'lifecycle' for domain '%1$s': %2$s %3$s\n"),
virDomainGetName(dom), virDomainGetName(dom),
virshDomainEventToString(event), virshDomainEventToString(event),
virshDomainEventDetailToString(event, detail)); virshDomainEventDetailToString(event, detail));
@ -357,7 +357,7 @@ virshEventRTCChangePrint(virConnectPtr conn G_GNUC_UNUSED,
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, _("event 'rtc-change' for domain '%s': %lld\n"), virBufferAsprintf(&buf, _("event 'rtc-change' for domain '%1$s': %2$lld\n"),
virDomainGetName(dom), virDomainGetName(dom),
utcoffset); utcoffset);
virshEventPrint(opaque, &buf); virshEventPrint(opaque, &buf);
@ -371,7 +371,7 @@ virshEventWatchdogPrint(virConnectPtr conn G_GNUC_UNUSED,
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, _("event 'watchdog' for domain '%s': %s\n"), virBufferAsprintf(&buf, _("event 'watchdog' for domain '%1$s': %2$s\n"),
virDomainGetName(dom), virDomainGetName(dom),
virshDomainEventWatchdogToString(action)); virshDomainEventWatchdogToString(action));
virshEventPrint(opaque, &buf); virshEventPrint(opaque, &buf);
@ -387,7 +387,7 @@ virshEventIOErrorPrint(virConnectPtr conn G_GNUC_UNUSED,
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, _("event 'io-error' for domain '%s': %s (%s) %s\n"), virBufferAsprintf(&buf, _("event 'io-error' for domain '%1$s': %2$s (%3$s) %4$s\n"),
virDomainGetName(dom), virDomainGetName(dom),
srcPath, srcPath,
devAlias, devAlias,
@ -408,8 +408,8 @@ virshEventGraphicsPrint(virConnectPtr conn G_GNUC_UNUSED,
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t i; size_t i;
virBufferAsprintf(&buf, _("event 'graphics' for domain '%s': " virBufferAsprintf(&buf, _("event 'graphics' for domain '%1$s': "
"%s local[%s %s %s] remote[%s %s %s] %s\n"), "%2$s local[%3$s %4$s %5$s] remote[%6$s %7$s %8$s] %9$s\n"),
virDomainGetName(dom), virDomainGetName(dom),
virshGraphicsPhaseToString(phase), virshGraphicsPhaseToString(phase),
virshGraphicsAddressToString(local->family), virshGraphicsAddressToString(local->family),
@ -438,8 +438,8 @@ virshEventIOErrorReasonPrint(virConnectPtr conn G_GNUC_UNUSED,
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, _("event 'io-error-reason' for domain '%s': " virBufferAsprintf(&buf, _("event 'io-error-reason' for domain '%1$s': "
"%s (%s) %s due to %s\n"), "%2$s (%3$s) %4$s due to %5$s\n"),
virDomainGetName(dom), virDomainGetName(dom),
srcPath, srcPath,
devAlias, devAlias,
@ -458,7 +458,7 @@ virshEventBlockJobPrint(virConnectPtr conn G_GNUC_UNUSED,
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, _("event '%s' for domain '%s': %s for %s %s\n"), virBufferAsprintf(&buf, _("event '%1$s' for domain '%2$s': %3$s for %4$s %5$s\n"),
((virshDomEventData *) opaque)->cb->name, ((virshDomEventData *) opaque)->cb->name,
virDomainGetName(dom), virDomainGetName(dom),
virshDomainBlockJobToString(type), virshDomainBlockJobToString(type),
@ -478,8 +478,8 @@ virshEventDiskChangePrint(virConnectPtr conn G_GNUC_UNUSED,
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, _("event 'disk-change' for domain '%s' disk %s: " virBufferAsprintf(&buf, _("event 'disk-change' for domain '%1$s' disk %2$s: "
"%s -> %s: %s\n"), "%3$s -> %4$s: %5$s\n"),
virDomainGetName(dom), virDomainGetName(dom),
alias, alias,
NULLSTR(oldSrc), NULLSTR(oldSrc),
@ -497,7 +497,7 @@ virshEventTrayChangePrint(virConnectPtr conn G_GNUC_UNUSED,
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, _("event 'tray-change' for domain '%s' disk %s: %s\n"), virBufferAsprintf(&buf, _("event 'tray-change' for domain '%1$s' disk %2$s: %3$s\n"),
virDomainGetName(dom), virDomainGetName(dom),
alias, alias,
virshDomainEventTrayChangeToString(reason)); virshDomainEventTrayChangeToString(reason));
@ -523,7 +523,7 @@ virshEventBalloonChangePrint(virConnectPtr conn G_GNUC_UNUSED,
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, _("event 'balloon-change' for domain '%s': %lluKiB\n"), virBufferAsprintf(&buf, _("event 'balloon-change' for domain '%1$s': %2$lluKiB\n"),
virDomainGetName(dom), virDomainGetName(dom),
actual); actual);
virshEventPrint(opaque, &buf); virshEventPrint(opaque, &buf);
@ -537,7 +537,7 @@ virshEventDeviceRemovedPrint(virConnectPtr conn G_GNUC_UNUSED,
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, _("event 'device-removed' for domain '%s': %s\n"), virBufferAsprintf(&buf, _("event 'device-removed' for domain '%1$s': %2$s\n"),
virDomainGetName(dom), virDomainGetName(dom),
alias); alias);
virshEventPrint(opaque, &buf); virshEventPrint(opaque, &buf);
@ -551,7 +551,7 @@ virshEventDeviceAddedPrint(virConnectPtr conn G_GNUC_UNUSED,
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, _("event 'device-added' for domain '%s': %s\n"), virBufferAsprintf(&buf, _("event 'device-added' for domain '%1$s': %2$s\n"),
virDomainGetName(dom), virDomainGetName(dom),
alias); alias);
virshEventPrint(opaque, &buf); virshEventPrint(opaque, &buf);
@ -568,7 +568,7 @@ virshEventTunablePrint(virConnectPtr conn G_GNUC_UNUSED,
size_t i; size_t i;
char *value; char *value;
virBufferAsprintf(&buf, _("event 'tunable' for domain '%s':\n"), virBufferAsprintf(&buf, _("event 'tunable' for domain '%1$s':\n"),
virDomainGetName(dom)); virDomainGetName(dom));
for (i = 0; i < nparams; i++) { for (i = 0; i < nparams; i++) {
value = virTypedParameterToString(&params[i]); value = virTypedParameterToString(&params[i]);
@ -604,8 +604,8 @@ virshEventAgentLifecyclePrint(virConnectPtr conn G_GNUC_UNUSED,
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, _("event 'agent-lifecycle' for domain '%s': state: " virBufferAsprintf(&buf, _("event 'agent-lifecycle' for domain '%1$s': state: "
"'%s' reason: '%s'\n"), "'%2$s' reason: '%3$s'\n"),
virDomainGetName(dom), virDomainGetName(dom),
UNKNOWNSTR(virshEventAgentLifecycleStateTypeToString(state)), UNKNOWNSTR(virshEventAgentLifecycleStateTypeToString(state)),
UNKNOWNSTR(virshEventAgentLifecycleReasonTypeToString(reason))); UNKNOWNSTR(virshEventAgentLifecycleReasonTypeToString(reason)));
@ -620,8 +620,8 @@ virshEventMigrationIterationPrint(virConnectPtr conn G_GNUC_UNUSED,
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, _("event 'migration-iteration' for domain '%s': " virBufferAsprintf(&buf, _("event 'migration-iteration' for domain '%1$s': "
"iteration: '%d'\n"), "iteration: '%2$d'\n"),
virDomainGetName(dom), virDomainGetName(dom),
iteration); iteration);
@ -638,7 +638,7 @@ virshEventJobCompletedPrint(virConnectPtr conn G_GNUC_UNUSED,
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t i; size_t i;
virBufferAsprintf(&buf, _("event 'job-completed' for domain '%s':\n"), virBufferAsprintf(&buf, _("event 'job-completed' for domain '%1$s':\n"),
virDomainGetName(dom)); virDomainGetName(dom));
for (i = 0; i < nparams; i++) { for (i = 0; i < nparams; i++) {
g_autofree char *value = virTypedParameterToString(&params[i]); g_autofree char *value = virTypedParameterToString(&params[i]);
@ -657,7 +657,7 @@ virshEventDeviceRemovalFailedPrint(virConnectPtr conn G_GNUC_UNUSED,
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, _("event 'device-removal-failed' for domain '%s': %s\n"), virBufferAsprintf(&buf, _("event 'device-removal-failed' for domain '%1$s': %2$s\n"),
virDomainGetName(dom), virDomainGetName(dom),
alias); alias);
virshEventPrint(opaque, &buf); virshEventPrint(opaque, &buf);
@ -679,7 +679,7 @@ virshEventMetadataChangePrint(virConnectPtr conn G_GNUC_UNUSED,
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, _("event 'metadata-change' for domain '%s': type %s, uri %s\n"), virBufferAsprintf(&buf, _("event 'metadata-change' for domain '%1$s': type %2$s, uri %3$s\n"),
virDomainGetName(dom), virDomainGetName(dom),
UNKNOWNSTR(virshEventMetadataChangeTypeTypeToString(type)), UNKNOWNSTR(virshEventMetadataChangeTypeTypeToString(type)),
NULLSTR(nsuri)); NULLSTR(nsuri));
@ -698,8 +698,8 @@ virshEventBlockThresholdPrint(virConnectPtr conn G_GNUC_UNUSED,
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, _("event 'block-threshold' for domain '%s': " virBufferAsprintf(&buf, _("event 'block-threshold' for domain '%1$s': "
"dev: %s(%s) %llu %llu\n"), "dev: %2$s(%3$s) %4$llu %5$llu\n"),
virDomainGetName(dom), virDomainGetName(dom),
dev, NULLSTR(path), threshold, excess); dev, NULLSTR(path), threshold, excess);
virshEventPrint(opaque, &buf); virshEventPrint(opaque, &buf);
@ -730,13 +730,11 @@ virshEventMemoryFailurePrint(virConnectPtr conn G_GNUC_UNUSED,
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, _("event 'memory-failure' for domain '%s':\n" virBufferAsprintf(&buf, _("event 'memory-failure' for domain '%1$s':\nrecipient: %2$s\naction: %3$s\n"),
"recipient: %s\naction: %s\n"),
virDomainGetName(dom), virDomainGetName(dom),
UNKNOWNSTR(virshEventMemoryFailureRecipientTypeTypeToString(recipient)), UNKNOWNSTR(virshEventMemoryFailureRecipientTypeTypeToString(recipient)),
UNKNOWNSTR(virshEventMemoryFailureActionTypeTypeToString(action))); UNKNOWNSTR(virshEventMemoryFailureActionTypeTypeToString(action)));
virBufferAsprintf(&buf, _("flags:\n" virBufferAsprintf(&buf, _("flags:\n\taction required: %1$d\n\trecursive: %2$d\n"),
"\taction required: %d\n\trecursive: %d\n"),
!!(flags & VIR_DOMAIN_MEMORY_FAILURE_ACTION_REQUIRED), !!(flags & VIR_DOMAIN_MEMORY_FAILURE_ACTION_REQUIRED),
!!(flags & VIR_DOMAIN_MEMORY_FAILURE_RECURSIVE)); !!(flags & VIR_DOMAIN_MEMORY_FAILURE_RECURSIVE));
@ -754,8 +752,7 @@ virshEventMemoryDeviceSizeChangePrint(virConnectPtr conn G_GNUC_UNUSED,
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, virBufferAsprintf(&buf,
_("event 'memory-device-size-change' for domain '%s':\n" _("event 'memory-device-size-change' for domain '%1$s':\nalias: %2$s\nsize: %3$llu\n"),
"alias: %s\nsize: %llu\n"),
virDomainGetName(dom), alias, size); virDomainGetName(dom), alias, size);
virshEventPrint(opaque, &buf); virshEventPrint(opaque, &buf);
@ -932,7 +929,7 @@ cmdEvent(vshControl *ctl, const vshCmd *cmd)
} }
if (ndata == 0) { if (ndata == 0) {
vshError(ctl, _("unknown event type %s"), eventName); vshError(ctl, _("unknown event type %1$s"), eventName);
return false; return false;
} }
@ -975,7 +972,7 @@ cmdEvent(vshControl *ctl, const vshCmd *cmd)
default: default:
goto cleanup; goto cleanup;
} }
vshPrint(ctl, _("events received: %d\n"), count); vshPrint(ctl, _("events received: %1$d\n"), count);
if (count) if (count)
ret = true; ret = true;

View File

@ -328,7 +328,7 @@ cmdDomMemStat(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (rv > 0) { if (rv > 0) {
if (period < 0) { if (period < 0) {
vshError(ctl, _("Invalid collection period value '%d'"), period); vshError(ctl, _("Invalid collection period value '%1$d'"), period);
return false; return false;
} }
@ -342,7 +342,7 @@ cmdDomMemStat(vshControl *ctl, const vshCmd *cmd)
nr_stats = virDomainMemoryStats(dom, stats, VIR_DOMAIN_MEMORY_STAT_NR, 0); nr_stats = virDomainMemoryStats(dom, stats, VIR_DOMAIN_MEMORY_STAT_NR, 0);
if (nr_stats == -1) { if (nr_stats == -1) {
vshError(ctl, _("Failed to get memory statistics for domain %s"), name); vshError(ctl, _("Failed to get memory statistics for domain %1$s"), name);
return false; return false;
} }
@ -812,9 +812,9 @@ cmdDomIfGetLink(vshControl *ctl, const vshCmd *cmd)
if (ninterfaces < 1) { if (ninterfaces < 1) {
if (macstr[0]) if (macstr[0])
vshError(ctl, _("Interface (mac: %s) not found."), macstr); vshError(ctl, _("Interface (mac: %1$s) not found."), macstr);
else else
vshError(ctl, _("Interface (dev: %s) not found."), iface); vshError(ctl, _("Interface (dev: %1$s) not found."), iface);
return false; return false;
} else if (ninterfaces > 1) { } else if (ninterfaces > 1) {
@ -987,14 +987,14 @@ cmdDomblkstat(vshControl *ctl, const vshCmd *cmd)
if (virDomainBlockStats(dom, device, &stats, if (virDomainBlockStats(dom, device, &stats,
sizeof(stats)) == -1) { sizeof(stats)) == -1) {
vshError(ctl, _("Failed to get block stats %s %s"), vshError(ctl, _("Failed to get block stats %1$s %2$s"),
name, device); name, device);
return false; return false;
} }
/* human friendly output */ /* human friendly output */
if (human) { if (human) {
vshPrint(ctl, N_("Device: %s\n"), device); vshPrint(ctl, N_("Device: %1$s\n"), device);
device = ""; device = "";
} }
@ -1006,13 +1006,13 @@ cmdDomblkstat(vshControl *ctl, const vshCmd *cmd)
} else { } else {
params = g_new0(virTypedParameter, nparams); params = g_new0(virTypedParameter, nparams);
if (virDomainBlockStatsFlags(dom, device, params, &nparams, 0) < 0) { if (virDomainBlockStatsFlags(dom, device, params, &nparams, 0) < 0) {
vshError(ctl, _("Failed to get block stats for domain '%s' device '%s'"), name, device); vshError(ctl, _("Failed to get block stats for domain '%1$s' device '%2$s'"), name, device);
return false; return false;
} }
/* set for prettier output */ /* set for prettier output */
if (human) { if (human) {
vshPrint(ctl, N_("Device: %s\n"), device); vshPrint(ctl, N_("Device: %1$s\n"), device);
device = ""; device = "";
} }
@ -1098,7 +1098,7 @@ cmdDomIfstat(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virDomainInterfaceStats(dom, device, &stats, sizeof(stats)) == -1) { if (virDomainInterfaceStats(dom, device, &stats, sizeof(stats)) == -1) {
vshError(ctl, _("Failed to get interface stats %s %s"), name, device); vshError(ctl, _("Failed to get interface stats %1$s %2$s"), name, device);
return false; return false;
} }
@ -1463,9 +1463,9 @@ cmdDomTime(vshControl *ctl, const vshCmd *cmd)
then = g_date_time_new_from_unix_utc(seconds); then = g_date_time_new_from_unix_utc(seconds);
thenstr = g_date_time_format(then, "%Y-%m-%d %H:%M:%S"); thenstr = g_date_time_format(then, "%Y-%m-%d %H:%M:%S");
vshPrint(ctl, _("Time: %s"), thenstr); vshPrint(ctl, _("Time: %1$s"), thenstr);
} else { } else {
vshPrint(ctl, _("Time: %lld"), seconds); vshPrint(ctl, _("Time: %1$lld"), seconds);
} }
} }
@ -2321,7 +2321,7 @@ cmdDomIfAddr(vshControl *ctl, const vshCmd *cmd)
if (sourcestr && if (sourcestr &&
(source = virshDomainInterfaceAddressesSourceTypeFromString(sourcestr)) < 0) { (source = virshDomainInterfaceAddressesSourceTypeFromString(sourcestr)) < 0) {
vshError(ctl, _("Unknown data source '%s'"), sourcestr); vshError(ctl, _("Unknown data source '%1$s'"), sourcestr);
return false; return false;
} }

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,7 @@
* EDIT_NOT_CHANGED - this action is taken if the XML wasn't changed. * EDIT_NOT_CHANGED - this action is taken if the XML wasn't changed.
* Note, that you don't want to jump to cleanup but edit_cleanup label * Note, that you don't want to jump to cleanup but edit_cleanup label
* where temporary variables are free()-d and temporary file is deleted: * where temporary variables are free()-d and temporary file is deleted:
* #define EDIT_NOT_CHANGED vshPrintExtra (ctl, _("Domain %s XML not changed"), \ * #define EDIT_NOT_CHANGED vshPrintExtra (ctl, _("Domain %1$s XML not changed"), \
* virDomainGetName(dom)); \ * virDomainGetName(dom)); \
* ret = true; goto edit_cleanup; * ret = true; goto edit_cleanup;
* Note that this is a statement. * Note that this is a statement.

View File

@ -219,8 +219,8 @@ cmdFreecell(vshControl *ctl, const vshCmd *cmd)
nodes_id[i] = id; nodes_id[i] = id;
if (virNodeGetCellsFreeMemory(priv->conn, &(nodes_free[i]), if (virNodeGetCellsFreeMemory(priv->conn, &(nodes_free[i]),
id, 1) != 1) { id, 1) != 1) {
vshError(ctl, _("failed to get free memory for NUMA node " vshError(ctl, _("failed to get free memory for NUMA node number: %1$lu"),
"number: %lu"), id); id);
return false; return false;
} }
} }
@ -337,7 +337,7 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd)
g_autofree char *val = virXMLPropString(nodes[i], "size"); g_autofree char *val = virXMLPropString(nodes[i], "size");
if (virStrToLong_uip(val, NULL, 10, &pagesize[i]) < 0) { if (virStrToLong_uip(val, NULL, 10, &pagesize[i]) < 0) {
vshError(ctl, _("unable to parse page size: %s"), val); vshError(ctl, _("unable to parse page size: %1$s"), val);
goto cleanup; goto cleanup;
} }
} }
@ -374,7 +374,7 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd)
g_autofree char *val = virXMLPropString(nodes[i], "id"); g_autofree char *val = virXMLPropString(nodes[i], "id");
if (virStrToLong_i(val, NULL, 10, &cell) < 0) { if (virStrToLong_i(val, NULL, 10, &cell) < 0) {
vshError(ctl, _("unable to parse numa node id: %s"), val); vshError(ctl, _("unable to parse numa node id: %1$s"), val);
goto cleanup; goto cleanup;
} }
@ -382,7 +382,7 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd)
cell, 1, counts, 0) < 0) cell, 1, counts, 0) < 0)
goto cleanup; goto cleanup;
vshPrint(ctl, _("Node %d:\n"), cell); vshPrint(ctl, _("Node %1$d:\n"), cell);
for (j = 0; j < npages; j++) for (j = 0; j < npages; j++)
vshPrint(ctl, "%uKiB: %lld\n", pagesize[j], counts[j]); vshPrint(ctl, "%uKiB: %lld\n", pagesize[j], counts[j]);
vshPrint(ctl, "%c", '\n'); vshPrint(ctl, "%c", '\n');
@ -1135,9 +1135,8 @@ vshExtractCPUDefXMLs(vshControl *ctl,
return NULL; return NULL;
if (n == 0) { if (n == 0) {
vshError(ctl, _("File '%s' does not contain any <cpu> element or " vshError(ctl, _("File '%1$s' does not contain any <cpu> element or valid domain XML, host capabilities XML, or domain capabilities XML"),
"valid domain XML, host capabilities XML, or " xmlFile);
"domain capabilities XML"), xmlFile);
return NULL; return NULL;
} }
@ -1219,24 +1218,24 @@ cmdCPUCompare(vshControl *ctl, const vshCmd *cmd)
switch (result) { switch (result) {
case VIR_CPU_COMPARE_INCOMPATIBLE: case VIR_CPU_COMPARE_INCOMPATIBLE:
vshPrint(ctl, _("CPU described in %s is incompatible with host CPU\n"), vshPrint(ctl, _("CPU described in %1$s is incompatible with host CPU\n"),
from); from);
return false; return false;
break; break;
case VIR_CPU_COMPARE_IDENTICAL: case VIR_CPU_COMPARE_IDENTICAL:
vshPrint(ctl, _("CPU described in %s is identical to host CPU\n"), vshPrint(ctl, _("CPU described in %1$s is identical to host CPU\n"),
from); from);
break; break;
case VIR_CPU_COMPARE_SUPERSET: case VIR_CPU_COMPARE_SUPERSET:
vshPrint(ctl, _("Host CPU is a superset of CPU described in %s\n"), vshPrint(ctl, _("Host CPU is a superset of CPU described in %1$s\n"),
from); from);
break; break;
case VIR_CPU_COMPARE_ERROR: case VIR_CPU_COMPARE_ERROR:
default: default:
vshError(ctl, _("Failed to compare host CPU with %s"), from); vshError(ctl, _("Failed to compare host CPU with %1$s"), from);
return false; return false;
} }
@ -1397,7 +1396,7 @@ cmdVersion(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
includeVersion %= 1000000; includeVersion %= 1000000;
minor = includeVersion / 1000; minor = includeVersion / 1000;
rel = includeVersion % 1000; rel = includeVersion % 1000;
vshPrint(ctl, _("Compiled against library: libvirt %d.%d.%d\n"), vshPrint(ctl, _("Compiled against library: libvirt %1$d.%2$d.%3$d\n"),
major, minor, rel); major, minor, rel);
if (virGetVersion(&libVersion, hvType, &apiVersion) < 0) { if (virGetVersion(&libVersion, hvType, &apiVersion) < 0) {
@ -1408,14 +1407,14 @@ cmdVersion(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
libVersion %= 1000000; libVersion %= 1000000;
minor = libVersion / 1000; minor = libVersion / 1000;
rel = libVersion % 1000; rel = libVersion % 1000;
vshPrint(ctl, _("Using library: libvirt %d.%d.%d\n"), vshPrint(ctl, _("Using library: libvirt %1$d.%2$d.%3$d\n"),
major, minor, rel); major, minor, rel);
major = apiVersion / 1000000; major = apiVersion / 1000000;
apiVersion %= 1000000; apiVersion %= 1000000;
minor = apiVersion / 1000; minor = apiVersion / 1000;
rel = apiVersion % 1000; rel = apiVersion % 1000;
vshPrint(ctl, _("Using API: %s %d.%d.%d\n"), hvType, vshPrint(ctl, _("Using API: %1$s %2$d.%3$d.%4$d\n"), hvType,
major, minor, rel); major, minor, rel);
if (virConnectGetVersion(priv->conn, &hvVersion) < 0) { if (virConnectGetVersion(priv->conn, &hvVersion) < 0) {
@ -1424,14 +1423,14 @@ cmdVersion(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
} }
if (hvVersion == 0) { if (hvVersion == 0) {
vshPrint(ctl, vshPrint(ctl,
_("Cannot extract running %s hypervisor version\n"), hvType); _("Cannot extract running %1$s hypervisor version\n"), hvType);
} else { } else {
major = hvVersion / 1000000; major = hvVersion / 1000000;
hvVersion %= 1000000; hvVersion %= 1000000;
minor = hvVersion / 1000; minor = hvVersion / 1000;
rel = hvVersion % 1000; rel = hvVersion % 1000;
vshPrint(ctl, _("Running hypervisor: %s %d.%d.%d\n"), vshPrint(ctl, _("Running hypervisor: %1$s %2$d.%3$d.%4$d\n"),
hvType, major, minor, rel); hvType, major, minor, rel);
} }
@ -1443,7 +1442,7 @@ cmdVersion(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
daemonVersion %= 1000000; daemonVersion %= 1000000;
minor = daemonVersion / 1000; minor = daemonVersion / 1000;
rel = daemonVersion % 1000; rel = daemonVersion % 1000;
vshPrint(ctl, _("Running against daemon: %d.%d.%d\n"), vshPrint(ctl, _("Running against daemon: %1$d.%2$d.%3$d\n"),
major, minor, rel); major, minor, rel);
} }
} }
@ -1644,29 +1643,26 @@ cmdHypervisorCPUCompare(vshControl *ctl,
switch (result) { switch (result) {
case VIR_CPU_COMPARE_INCOMPATIBLE: case VIR_CPU_COMPARE_INCOMPATIBLE:
vshPrint(ctl, vshPrint(ctl,
_("CPU described in %s is incompatible with the CPU provided " _("CPU described in %1$s is incompatible with the CPU provided by hypervisor on the host\n"),
"by hypervisor on the host\n"),
from); from);
return false; return false;
break; break;
case VIR_CPU_COMPARE_IDENTICAL: case VIR_CPU_COMPARE_IDENTICAL:
vshPrint(ctl, vshPrint(ctl,
_("CPU described in %s is identical to the CPU provided by " _("CPU described in %1$s is identical to the CPU provided by hypervisor on the host\n"),
"hypervisor on the host\n"),
from); from);
break; break;
case VIR_CPU_COMPARE_SUPERSET: case VIR_CPU_COMPARE_SUPERSET:
vshPrint(ctl, vshPrint(ctl,
_("The CPU provided by hypervisor on the host is a superset " _("The CPU provided by hypervisor on the host is a superset of CPU described in %1$s\n"),
"of CPU described in %s\n"),
from); from);
break; break;
case VIR_CPU_COMPARE_ERROR: case VIR_CPU_COMPARE_ERROR:
default: default:
vshError(ctl, _("Failed to compare hypervisor CPU with %s"), from); vshError(ctl, _("Failed to compare hypervisor CPU with %1$s"), from);
return false; return false;
} }

View File

@ -83,7 +83,7 @@ virshCommandOptInterfaceBy(vshControl *ctl, const vshCmd *cmd,
} }
if (!iface) if (!iface)
vshError(ctl, _("failed to get interface '%s'"), n); vshError(ctl, _("failed to get interface '%1$s'"), n);
return iface; return iface;
} }
@ -122,7 +122,7 @@ cmdInterfaceEdit(vshControl *ctl, const vshCmd *cmd)
#define EDIT_GET_XML virInterfaceGetXMLDesc(iface, flags) #define EDIT_GET_XML virInterfaceGetXMLDesc(iface, flags)
#define EDIT_NOT_CHANGED \ #define EDIT_NOT_CHANGED \
do { \ do { \
vshPrintExtra(ctl, _("Interface %s XML configuration not changed.\n"), \ vshPrintExtra(ctl, _("Interface %1$s XML configuration not changed.\n"), \
virInterfaceGetName(iface)); \ virInterfaceGetName(iface)); \
ret = true; \ ret = true; \
goto edit_cleanup; \ goto edit_cleanup; \
@ -131,7 +131,7 @@ cmdInterfaceEdit(vshControl *ctl, const vshCmd *cmd)
(iface_edited = virInterfaceDefineXML(priv->conn, doc_edited, 0)) (iface_edited = virInterfaceDefineXML(priv->conn, doc_edited, 0))
#include "virsh-edit.c" #include "virsh-edit.c"
vshPrintExtra(ctl, _("Interface %s XML configuration edited.\n"), vshPrintExtra(ctl, _("Interface %1$s XML configuration edited.\n"),
virInterfaceGetName(iface_edited)); virInterfaceGetName(iface_edited));
ret = true; ret = true;
@ -550,11 +550,11 @@ cmdInterfaceDefine(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (!(iface = virInterfaceDefineXML(priv->conn, buffer, flags))) { if (!(iface = virInterfaceDefineXML(priv->conn, buffer, flags))) {
vshError(ctl, _("Failed to define interface from %s"), from); vshError(ctl, _("Failed to define interface from %1$s"), from);
return false; return false;
} }
vshPrintExtra(ctl, _("Interface %s defined from %s\n"), vshPrintExtra(ctl, _("Interface %1$s defined from %2$s\n"),
virInterfaceGetName(iface), from); virInterfaceGetName(iface), from);
return true; return true;
} }
@ -587,11 +587,11 @@ cmdInterfaceUndefine(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virInterfaceUndefine(iface) < 0) { if (virInterfaceUndefine(iface) < 0) {
vshError(ctl, _("Failed to undefine interface %s"), name); vshError(ctl, _("Failed to undefine interface %1$s"), name);
return false; return false;
} }
vshPrintExtra(ctl, _("Interface %s undefined\n"), name); vshPrintExtra(ctl, _("Interface %1$s undefined\n"), name);
return true; return true;
} }
@ -623,11 +623,11 @@ cmdInterfaceStart(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virInterfaceCreate(iface, 0) < 0) { if (virInterfaceCreate(iface, 0) < 0) {
vshError(ctl, _("Failed to start interface %s"), name); vshError(ctl, _("Failed to start interface %1$s"), name);
return false; return false;
} }
vshPrintExtra(ctl, _("Interface %s started\n"), name); vshPrintExtra(ctl, _("Interface %1$s started\n"), name);
return true; return true;
} }
@ -659,11 +659,11 @@ cmdInterfaceDestroy(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virInterfaceDestroy(iface, 0) < 0) { if (virInterfaceDestroy(iface, 0) < 0) {
vshError(ctl, _("Failed to destroy interface %s"), name); vshError(ctl, _("Failed to destroy interface %1$s"), name);
return false; return false;
} }
vshPrintExtra(ctl, _("Interface %s destroyed\n"), name); vshPrintExtra(ctl, _("Interface %1$s destroyed\n"), name);
return false; return false;
} }
@ -832,7 +832,7 @@ cmdInterfaceBridge(vshControl *ctl, const vshCmd *cmd)
/* make sure "new" device doesn't already exist */ /* make sure "new" device doesn't already exist */
if ((br_handle = virInterfaceLookupByName(priv->conn, br_name))) { if ((br_handle = virInterfaceLookupByName(priv->conn, br_name))) {
vshError(ctl, _("Network device %s already exists"), br_name); vshError(ctl, _("Network device %1$s already exists"), br_name);
goto cleanup; goto cleanup;
} }
@ -849,26 +849,26 @@ cmdInterfaceBridge(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
if (!(xml_doc = virXMLParseStringCtxt(if_xml, if (!(xml_doc = virXMLParseStringCtxt(if_xml,
_("(interface definition)"), &ctxt))) { _("(interface definition)"), &ctxt))) {
vshError(ctl, _("Failed to parse configuration of %s"), if_name); vshError(ctl, _("Failed to parse configuration of %1$s"), if_name);
goto cleanup; goto cleanup;
} }
top_node = ctxt->node; top_node = ctxt->node;
/* Verify that the original device isn't already a bridge. */ /* Verify that the original device isn't already a bridge. */
if (!(if_type = virXMLPropString(top_node, "type"))) { if (!(if_type = virXMLPropString(top_node, "type"))) {
vshError(ctl, _("Existing device %s has no type"), if_name); vshError(ctl, _("Existing device %1$s has no type"), if_name);
goto cleanup; goto cleanup;
} }
if (STREQ(if_type, "bridge")) { if (STREQ(if_type, "bridge")) {
vshError(ctl, _("Existing device %s is already a bridge"), if_name); vshError(ctl, _("Existing device %1$s is already a bridge"), if_name);
goto cleanup; goto cleanup;
} }
/* verify the name in the XML matches the device name */ /* verify the name in the XML matches the device name */
if (!(if2_name = virXMLPropString(top_node, "name")) || if (!(if2_name = virXMLPropString(top_node, "name")) ||
STRNEQ(if2_name, if_name)) { STRNEQ(if2_name, if_name)) {
vshError(ctl, _("Interface name from config %s doesn't match given supplied name %s"), vshError(ctl, _("Interface name from config %1$s doesn't match given supplied name %2$s"),
if2_name, if_name); if2_name, if_name);
goto cleanup; goto cleanup;
} }
@ -890,7 +890,7 @@ cmdInterfaceBridge(vshControl *ctl, const vshCmd *cmd)
if (stp) { if (stp) {
delay_str = g_strdup_printf("%d", delay); delay_str = g_strdup_printf("%d", delay);
if (!xmlSetProp(br_node, BAD_CAST "delay", BAD_CAST delay_str)) { if (!xmlSetProp(br_node, BAD_CAST "delay", BAD_CAST delay_str)) {
vshError(ctl, _("Failed to set bridge delay %d in xml document"), delay); vshError(ctl, _("Failed to set bridge delay %1$d in xml document"), delay);
goto cleanup; goto cleanup;
} }
} }
@ -904,7 +904,7 @@ cmdInterfaceBridge(vshControl *ctl, const vshCmd *cmd)
} }
if (!xmlSetProp(top_node, BAD_CAST "name", BAD_CAST br_name)) { if (!xmlSetProp(top_node, BAD_CAST "name", BAD_CAST br_name)) {
vshError(ctl, _("Failed to set master bridge interface name to '%s' in xml document"), vshError(ctl, _("Failed to set master bridge interface name to '%1$s' in xml document"),
br_name); br_name);
goto cleanup; goto cleanup;
} }
@ -921,13 +921,13 @@ cmdInterfaceBridge(vshControl *ctl, const vshCmd *cmd)
* if_type, and the name to the original if_name. * if_type, and the name to the original if_name.
*/ */
if (!xmlSetProp(if_node, BAD_CAST "type", BAD_CAST if_type)) { if (!xmlSetProp(if_node, BAD_CAST "type", BAD_CAST if_type)) {
vshError(ctl, _("Failed to set new attached interface type to '%s' in xml document"), vshError(ctl, _("Failed to set new attached interface type to '%1$s' in xml document"),
if_type); if_type);
goto cleanup; goto cleanup;
} }
if (!xmlSetProp(if_node, BAD_CAST "name", BAD_CAST if_name)) { if (!xmlSetProp(if_node, BAD_CAST "name", BAD_CAST if_name)) {
vshError(ctl, _("Failed to set new attached interface name to '%s' in xml document"), vshError(ctl, _("Failed to set new attached interface name to '%1$s' in xml document"),
if_name); if_name);
goto cleanup; goto cleanup;
} }
@ -947,7 +947,7 @@ cmdInterfaceBridge(vshControl *ctl, const vshCmd *cmd)
virXMLNodeNameEqual(old, "vlan"))) { /* vlan stuff to move down */ virXMLNodeNameEqual(old, "vlan"))) { /* vlan stuff to move down */
xmlUnlinkNode(old); xmlUnlinkNode(old);
if (!xmlAddChild(if_node, old)) { if (!xmlAddChild(if_node, old)) {
vshError(ctl, _("Failed to move '%s' element in xml document"), old->name); vshError(ctl, _("Failed to move '%1$s' element in xml document"), old->name);
xmlFreeNode(old); xmlFreeNode(old);
goto cleanup; goto cleanup;
} }
@ -958,7 +958,7 @@ cmdInterfaceBridge(vshControl *ctl, const vshCmd *cmd)
xmlDocDumpMemory(xml_doc, &br_xml, &br_xml_size); xmlDocDumpMemory(xml_doc, &br_xml, &br_xml_size);
if (!br_xml || br_xml_size <= 0) { if (!br_xml || br_xml_size <= 0) {
vshError(ctl, _("Failed to format new xml document for bridge %s"), br_name); vshError(ctl, _("Failed to format new xml document for bridge %1$s"), br_name);
goto cleanup; goto cleanup;
} }
@ -967,21 +967,21 @@ cmdInterfaceBridge(vshControl *ctl, const vshCmd *cmd)
* independent original interface. * independent original interface.
*/ */
if (!(br_handle = virInterfaceDefineXML(priv->conn, (char *) br_xml, 0))) { if (!(br_handle = virInterfaceDefineXML(priv->conn, (char *) br_xml, 0))) {
vshError(ctl, _("Failed to define new bridge interface %s"), vshError(ctl, _("Failed to define new bridge interface %1$s"),
br_name); br_name);
goto cleanup; goto cleanup;
} }
vshPrintExtra(ctl, _("Created bridge %s with attached device %s\n"), vshPrintExtra(ctl, _("Created bridge %1$s with attached device %2$s\n"),
br_name, if_name); br_name, if_name);
/* start it up unless requested not to */ /* start it up unless requested not to */
if (!nostart) { if (!nostart) {
if (virInterfaceCreate(br_handle, 0) < 0) { if (virInterfaceCreate(br_handle, 0) < 0) {
vshError(ctl, _("Failed to start bridge interface %s"), br_name); vshError(ctl, _("Failed to start bridge interface %1$s"), br_name);
goto cleanup; goto cleanup;
} }
vshPrintExtra(ctl, _("Bridge interface %s started\n"), br_name); vshPrintExtra(ctl, _("Bridge interface %1$s started\n"), br_name);
} }
ret = true; ret = true;
@ -1051,19 +1051,19 @@ cmdInterfaceUnbridge(vshControl *ctl, const vshCmd *cmd)
if (!(xml_doc = virXMLParseStringCtxt(br_xml, if (!(xml_doc = virXMLParseStringCtxt(br_xml,
_("(bridge interface definition)"), _("(bridge interface definition)"),
&ctxt))) { &ctxt))) {
vshError(ctl, _("Failed to parse configuration of %s"), br_name); vshError(ctl, _("Failed to parse configuration of %1$s"), br_name);
goto cleanup; goto cleanup;
} }
top_node = ctxt->node; top_node = ctxt->node;
/* Verify that the device really is a bridge. */ /* Verify that the device really is a bridge. */
if (!(if_type = virXMLPropString(top_node, "type"))) { if (!(if_type = virXMLPropString(top_node, "type"))) {
vshError(ctl, _("Existing device %s has no type"), br_name); vshError(ctl, _("Existing device %1$s has no type"), br_name);
goto cleanup; goto cleanup;
} }
if (STRNEQ(if_type, "bridge")) { if (STRNEQ(if_type, "bridge")) {
vshError(ctl, _("Device %s is not a bridge"), br_name); vshError(ctl, _("Device %1$s is not a bridge"), br_name);
goto cleanup; goto cleanup;
} }
VIR_FREE(if_type); VIR_FREE(if_type);
@ -1071,7 +1071,7 @@ cmdInterfaceUnbridge(vshControl *ctl, const vshCmd *cmd)
/* verify the name in the XML matches the device name */ /* verify the name in the XML matches the device name */
if (!(if_name = virXMLPropString(top_node, "name")) || if (!(if_name = virXMLPropString(top_node, "name")) ||
STRNEQ(if_name, br_name)) { STRNEQ(if_name, br_name)) {
vshError(ctl, _("Interface name from config %s doesn't match given supplied name %s"), vshError(ctl, _("Interface name from config %1$s doesn't match given supplied name %2$s"),
if_name, br_name); if_name, br_name);
goto cleanup; goto cleanup;
} }
@ -1097,23 +1097,23 @@ cmdInterfaceUnbridge(vshControl *ctl, const vshCmd *cmd)
* the type/name of the attached interface. * the type/name of the attached interface.
*/ */
if (!(if_name = virXMLPropString(if_node, "name"))) { if (!(if_name = virXMLPropString(if_node, "name"))) {
vshError(ctl, _("Device attached to bridge %s has no name"), br_name); vshError(ctl, _("Device attached to bridge %1$s has no name"), br_name);
goto cleanup; goto cleanup;
} }
if (!(if_type = virXMLPropString(if_node, "type"))) { if (!(if_type = virXMLPropString(if_node, "type"))) {
vshError(ctl, _("Attached device %s has no type"), if_name); vshError(ctl, _("Attached device %1$s has no type"), if_name);
goto cleanup; goto cleanup;
} }
if (!xmlSetProp(top_node, BAD_CAST "type", BAD_CAST if_type)) { if (!xmlSetProp(top_node, BAD_CAST "type", BAD_CAST if_type)) {
vshError(ctl, _("Failed to set interface type to '%s' in xml document"), vshError(ctl, _("Failed to set interface type to '%1$s' in xml document"),
if_type); if_type);
goto cleanup; goto cleanup;
} }
if (!xmlSetProp(top_node, BAD_CAST "name", BAD_CAST if_name)) { if (!xmlSetProp(top_node, BAD_CAST "name", BAD_CAST if_name)) {
vshError(ctl, _("Failed to set interface name to '%s' in xml document"), vshError(ctl, _("Failed to set interface name to '%1$s' in xml document"),
if_name); if_name);
goto cleanup; goto cleanup;
} }
@ -1133,7 +1133,7 @@ cmdInterfaceUnbridge(vshControl *ctl, const vshCmd *cmd)
virXMLNodeNameEqual(old, "vlan"))) { /* vlan stuff to move down */ virXMLNodeNameEqual(old, "vlan"))) { /* vlan stuff to move down */
xmlUnlinkNode(old); xmlUnlinkNode(old);
if (!xmlAddChild(top_node, old)) { if (!xmlAddChild(top_node, old)) {
vshError(ctl, _("Failed to move '%s' element in xml document"), old->name); vshError(ctl, _("Failed to move '%1$s' element in xml document"), old->name);
xmlFreeNode(old); xmlFreeNode(old);
goto cleanup; goto cleanup;
} }
@ -1144,7 +1144,7 @@ cmdInterfaceUnbridge(vshControl *ctl, const vshCmd *cmd)
xmlDocDumpMemory(xml_doc, &if_xml, &if_xml_size); xmlDocDumpMemory(xml_doc, &if_xml, &if_xml_size);
if (!if_xml || if_xml_size <= 0) { if (!if_xml || if_xml_size <= 0) {
vshError(ctl, _("Failed to format new xml document for detached interface %s"), vshError(ctl, _("Failed to format new xml document for detached interface %1$s"),
if_name); if_name);
goto cleanup; goto cleanup;
} }
@ -1153,31 +1153,31 @@ cmdInterfaceUnbridge(vshControl *ctl, const vshCmd *cmd)
* can't safely define the unattached device. * can't safely define the unattached device.
*/ */
if (virInterfaceDestroy(br_handle, 0) < 0) { if (virInterfaceDestroy(br_handle, 0) < 0) {
vshError(ctl, _("Failed to destroy bridge interface %s"), br_name); vshError(ctl, _("Failed to destroy bridge interface %1$s"), br_name);
goto cleanup; goto cleanup;
} }
if (virInterfaceUndefine(br_handle) < 0) { if (virInterfaceUndefine(br_handle) < 0) {
vshError(ctl, _("Failed to undefine bridge interface %s"), br_name); vshError(ctl, _("Failed to undefine bridge interface %1$s"), br_name);
goto cleanup; goto cleanup;
} }
/* if_xml is the new interface to define. /* if_xml is the new interface to define.
*/ */
if (!(if_handle = virInterfaceDefineXML(priv->conn, (char *) if_xml, 0))) { if (!(if_handle = virInterfaceDefineXML(priv->conn, (char *) if_xml, 0))) {
vshError(ctl, _("Failed to define new interface %s"), if_name); vshError(ctl, _("Failed to define new interface %1$s"), if_name);
goto cleanup; goto cleanup;
} }
vshPrintExtra(ctl, _("Device %s un-attached from bridge %s\n"), vshPrintExtra(ctl, _("Device %1$s un-attached from bridge %2$s\n"),
if_name, br_name); if_name, br_name);
/* unless requested otherwise, undefine the bridge device */ /* unless requested otherwise, undefine the bridge device */
if (!nostart) { if (!nostart) {
if (virInterfaceCreate(if_handle, 0) < 0) { if (virInterfaceCreate(if_handle, 0) < 0) {
vshError(ctl, _("Failed to start interface %s"), if_name); vshError(ctl, _("Failed to start interface %1$s"), if_name);
goto cleanup; goto cleanup;
} }
vshPrintExtra(ctl, _("Interface %s started\n"), if_name); vshPrintExtra(ctl, _("Interface %1$s started\n"), if_name);
} }
ret = true; ret = true;

View File

@ -97,7 +97,7 @@ virshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd,
} }
if (!network) if (!network)
vshError(ctl, _("failed to get network '%s'"), n); vshError(ctl, _("failed to get network '%1$s'"), n);
return network; return network;
} }
@ -126,7 +126,7 @@ virshCommandOptNetworkPort(vshControl *ctl, const vshCmd *cmd,
port = virNetworkPortLookupByUUIDString(net, n); port = virNetworkPortLookupByUUIDString(net, n);
if (!port) if (!port)
vshError(ctl, _("failed to get network port '%s'"), n); vshError(ctl, _("failed to get network port '%1$s'"), n);
return port; return port;
} }
@ -167,16 +167,16 @@ cmdNetworkAutostart(vshControl *ctl, const vshCmd *cmd)
if (virNetworkSetAutostart(network, autostart) < 0) { if (virNetworkSetAutostart(network, autostart) < 0) {
if (autostart) if (autostart)
vshError(ctl, _("failed to mark network %s as autostarted"), name); vshError(ctl, _("failed to mark network %1$s as autostarted"), name);
else else
vshError(ctl, _("failed to unmark network %s as autostarted"), name); vshError(ctl, _("failed to unmark network %1$s as autostarted"), name);
return false; return false;
} }
if (autostart) if (autostart)
vshPrintExtra(ctl, _("Network %s marked as autostarted\n"), name); vshPrintExtra(ctl, _("Network %1$s marked as autostarted\n"), name);
else else
vshPrintExtra(ctl, _("Network %s unmarked as autostarted\n"), name); vshPrintExtra(ctl, _("Network %1$s unmarked as autostarted\n"), name);
return true; return true;
} }
@ -227,11 +227,11 @@ cmdNetworkCreate(vshControl *ctl, const vshCmd *cmd)
network = virNetworkCreateXML(priv->conn, buffer); network = virNetworkCreateXML(priv->conn, buffer);
if (!network) { if (!network) {
vshError(ctl, _("Failed to create network from %s"), from); vshError(ctl, _("Failed to create network from %1$s"), from);
return false; return false;
} }
vshPrintExtra(ctl, _("Network %s created from %s\n"), vshPrintExtra(ctl, _("Network %1$s created from %2$s\n"),
virNetworkGetName(network), from); virNetworkGetName(network), from);
return true; return true;
} }
@ -283,11 +283,11 @@ cmdNetworkDefine(vshControl *ctl, const vshCmd *cmd)
network = virNetworkDefineXML(priv->conn, buffer); network = virNetworkDefineXML(priv->conn, buffer);
if (!network) { if (!network) {
vshError(ctl, _("Failed to define network from %s"), from); vshError(ctl, _("Failed to define network from %1$s"), from);
return false; return false;
} }
vshPrintExtra(ctl, _("Network %s defined from %s\n"), vshPrintExtra(ctl, _("Network %1$s defined from %2$s\n"),
virNetworkGetName(network), from); virNetworkGetName(network), from);
return true; return true;
} }
@ -321,9 +321,9 @@ cmdNetworkDestroy(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virNetworkDestroy(network) == 0) { if (virNetworkDestroy(network) == 0) {
vshPrintExtra(ctl, _("Network %s destroyed\n"), name); vshPrintExtra(ctl, _("Network %1$s destroyed\n"), name);
} else { } else {
vshError(ctl, _("Failed to destroy network %s"), name); vshError(ctl, _("Failed to destroy network %1$s"), name);
ret = false; ret = false;
} }
@ -866,9 +866,9 @@ cmdNetworkStart(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virNetworkCreate(network) == 0) { if (virNetworkCreate(network) == 0) {
vshPrintExtra(ctl, _("Network %s started\n"), name); vshPrintExtra(ctl, _("Network %1$s started\n"), name);
} else { } else {
vshError(ctl, _("Failed to start network %s"), name); vshError(ctl, _("Failed to start network %1$s"), name);
ret = false; ret = false;
} }
return ret; return ret;
@ -903,9 +903,9 @@ cmdNetworkUndefine(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if (virNetworkUndefine(network) == 0) { if (virNetworkUndefine(network) == 0) {
vshPrintExtra(ctl, _("Network %s has been undefined\n"), name); vshPrintExtra(ctl, _("Network %1$s has been undefined\n"), name);
} else { } else {
vshError(ctl, _("Failed to undefine network %s"), name); vshError(ctl, _("Failed to undefine network %1$s"), name);
ret = false; ret = false;
} }
@ -996,7 +996,7 @@ cmdNetworkUpdate(vshControl *ctl, const vshCmd *cmd)
} else { } else {
command = virshNetworkUpdateCommandTypeFromString(commandStr); command = virshNetworkUpdateCommandTypeFromString(commandStr);
if (command <= 0) { if (command <= 0) {
vshError(ctl, _("unrecognized command name '%s'"), commandStr); vshError(ctl, _("unrecognized command name '%1$s'"), commandStr);
goto cleanup; goto cleanup;
} }
} }
@ -1006,7 +1006,7 @@ cmdNetworkUpdate(vshControl *ctl, const vshCmd *cmd)
section = virshNetworkSectionTypeFromString(sectionStr); section = virshNetworkSectionTypeFromString(sectionStr);
if (section <= 0) { if (section <= 0) {
vshError(ctl, _("unrecognized section name '%s'"), sectionStr); vshError(ctl, _("unrecognized section name '%1$s'"), sectionStr);
goto cleanup; goto cleanup;
} }
@ -1043,27 +1043,26 @@ cmdNetworkUpdate(vshControl *ctl, const vshCmd *cmd)
if (virNetworkUpdate(network, command, if (virNetworkUpdate(network, command,
section, parentIndex, xml, flags) < 0) { section, parentIndex, xml, flags) < 0) {
vshError(ctl, _("Failed to update network %s"), vshError(ctl, _("Failed to update network %1$s"),
virNetworkGetName(network)); virNetworkGetName(network));
goto cleanup; goto cleanup;
} }
if (config) { if (config) {
if (live) if (live)
vshPrintExtra(ctl, _("Updated network %s persistent config and " vshPrintExtra(ctl, _("Updated network %1$s persistent config and live state"),
"live state"),
virNetworkGetName(network)); virNetworkGetName(network));
else else
vshPrintExtra(ctl, _("Updated network %s persistent config"), vshPrintExtra(ctl, _("Updated network %1$s persistent config"),
virNetworkGetName(network)); virNetworkGetName(network));
} else if (live) { } else if (live) {
vshPrintExtra(ctl, _("Updated network %s live state"), vshPrintExtra(ctl, _("Updated network %1$s live state"),
virNetworkGetName(network)); virNetworkGetName(network));
} else if (virNetworkIsActive(network)) { } else if (virNetworkIsActive(network)) {
vshPrintExtra(ctl, _("Updated network %s live state"), vshPrintExtra(ctl, _("Updated network %1$s live state"),
virNetworkGetName(network)); virNetworkGetName(network));
} else { } else {
vshPrintExtra(ctl, _("Updated network %s persistent config"), vshPrintExtra(ctl, _("Updated network %1$s persistent config"),
virNetworkGetName(network)); virNetworkGetName(network));
} }
@ -1158,7 +1157,7 @@ cmdNetworkEdit(vshControl *ctl, const vshCmd *cmd)
#define EDIT_GET_XML virshNetworkGetXMLDesc(network) #define EDIT_GET_XML virshNetworkGetXMLDesc(network)
#define EDIT_NOT_CHANGED \ #define EDIT_NOT_CHANGED \
do { \ do { \
vshPrintExtra(ctl, _("Network %s XML configuration not changed.\n"), \ vshPrintExtra(ctl, _("Network %1$s XML configuration not changed.\n"), \
virNetworkGetName(network)); \ virNetworkGetName(network)); \
ret = true; \ ret = true; \
goto edit_cleanup; \ goto edit_cleanup; \
@ -1167,7 +1166,7 @@ cmdNetworkEdit(vshControl *ctl, const vshCmd *cmd)
(network_edited = virNetworkDefineXML(priv->conn, doc_edited)) (network_edited = virNetworkDefineXML(priv->conn, doc_edited))
#include "virsh-edit.c" #include "virsh-edit.c"
vshPrintExtra(ctl, _("Network %s XML configuration edited.\n"), vshPrintExtra(ctl, _("Network %1$s XML configuration edited.\n"),
virNetworkGetName(network_edited)); virNetworkGetName(network_edited));
ret = true; ret = true;
@ -1227,11 +1226,11 @@ vshEventLifecyclePrint(virConnectPtr conn G_GNUC_UNUSED,
if (virTimeStringNowRaw(timestamp) < 0) if (virTimeStringNowRaw(timestamp) < 0)
timestamp[0] = '\0'; timestamp[0] = '\0';
vshPrint(data->ctl, _("%s: event 'lifecycle' for network %s: %s\n"), vshPrint(data->ctl, _("%1$s: event 'lifecycle' for network %2$s: %3$s\n"),
timestamp, timestamp,
virNetworkGetName(net), virshNetworkEventToString(event)); virNetworkGetName(net), virshNetworkEventToString(event));
} else { } else {
vshPrint(data->ctl, _("event 'lifecycle' for network %s: %s\n"), vshPrint(data->ctl, _("event 'lifecycle' for network %1$s: %2$s\n"),
virNetworkGetName(net), virshNetworkEventToString(event)); virNetworkGetName(net), virshNetworkEventToString(event));
} }
@ -1312,7 +1311,7 @@ cmdNetworkEvent(vshControl *ctl, const vshCmd *cmd)
if (STREQ(eventName, virshNetworkEventCallbacks[event].name)) if (STREQ(eventName, virshNetworkEventCallbacks[event].name))
break; break;
if (event == VIR_NETWORK_EVENT_ID_LAST) { if (event == VIR_NETWORK_EVENT_ID_LAST) {
vshError(ctl, _("unknown event type %s"), eventName); vshError(ctl, _("unknown event type %1$s"), eventName);
return false; return false;
} }
@ -1345,7 +1344,7 @@ cmdNetworkEvent(vshControl *ctl, const vshCmd *cmd)
default: default:
goto cleanup; goto cleanup;
} }
vshPrint(ctl, _("events received: %d\n"), data.count); vshPrint(ctl, _("events received: %1$d\n"), data.count);
if (data.count) if (data.count)
ret = true; ret = true;
@ -1417,7 +1416,7 @@ cmdNetworkDHCPLeases(vshControl *ctl, const vshCmd *cmd)
return false; return false;
if ((nleases = virNetworkGetDHCPLeases(network, mac, &leases, flags)) < 0) { if ((nleases = virNetworkGetDHCPLeases(network, mac, &leases, flags)) < 0) {
vshError(ctl, _("Failed to get leases info for %s"), name); vshError(ctl, _("Failed to get leases info for %1$s"), name);
goto cleanup; goto cleanup;
} }
@ -1523,10 +1522,10 @@ cmdNetworkPortCreate(vshControl *ctl, const vshCmd *cmd)
if (port != NULL) { if (port != NULL) {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
virNetworkPortGetUUIDString(port, uuidstr); virNetworkPortGetUUIDString(port, uuidstr);
vshPrintExtra(ctl, _("Network port %s created from %s\n"), vshPrintExtra(ctl, _("Network port %1$s created from %2$s\n"),
uuidstr, from); uuidstr, from);
} else { } else {
vshError(ctl, _("Failed to create network from %s"), from); vshError(ctl, _("Failed to create network from %1$s"), from);
goto cleanup; goto cleanup;
} }
@ -1635,10 +1634,10 @@ cmdNetworkPortDelete(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
if (virNetworkPortDelete(port, 0) < 0) { if (virNetworkPortDelete(port, 0) < 0) {
vshError(ctl, _("Failed to delete network port %s"), uuidstr); vshError(ctl, _("Failed to delete network port %1$s"), uuidstr);
goto cleanup; goto cleanup;
} else { } else {
vshPrintExtra(ctl, _("Network port %s deleted\n"), uuidstr); vshPrintExtra(ctl, _("Network port %1$s deleted\n"), uuidstr);
} }
ret = true; ret = true;