From f9947f75b9044fe7273d221eccb34bad7e12daff Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Thu, 24 Aug 2023 17:04:34 +0200 Subject: [PATCH] tools: Move error messages onto a single line Error messages are exempt from the 80 columns rule. Move them onto one line. Signed-off-by: Michal Privoznik Reviewed-by: Pavel Hrdina --- tools/virsh-domain-event.c | 15 +++++--------- tools/virsh-domain.c | 36 +++++++++++---------------------- tools/virsh-host.c | 9 +++------ tools/virsh-network.c | 6 ++---- tools/virsh-nodedev.c | 3 +-- tools/virsh-pool.c | 3 +-- tools/virsh.c | 9 +++------ tools/virt-admin.c | 21 +++++++------------ tools/virt-host-validate-ch.c | 12 ++++------- tools/virt-host-validate-qemu.c | 15 +++++--------- tools/vsh.c | 12 ++++------- 11 files changed, 47 insertions(+), 94 deletions(-) diff --git a/tools/virsh-domain-event.c b/tools/virsh-domain-event.c index 2969c22a91..6887c195a0 100644 --- a/tools/virsh-domain-event.c +++ b/tools/virsh-domain-event.c @@ -418,8 +418,7 @@ virshEventGraphicsPrint(virConnectPtr conn G_GNUC_UNUSED, g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; size_t i; - virBufferAsprintf(&buf, _("event 'graphics' for domain '%1$s': " - "%2$s local[%3$s %4$s %5$s] remote[%6$s %7$s %8$s] %9$s\n"), + virBufferAsprintf(&buf, _("event 'graphics' for domain '%1$s': %2$s local[%3$s %4$s %5$s] remote[%6$s %7$s %8$s] %9$s\n"), virDomainGetName(dom), virshGraphicsPhaseToString(phase), virshGraphicsAddressToString(local->family), @@ -497,8 +496,7 @@ virshEventDiskChangePrint(virConnectPtr conn G_GNUC_UNUSED, { g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; - virBufferAsprintf(&buf, _("event 'disk-change' for domain '%1$s' disk %2$s: " - "%3$s -> %4$s: %5$s\n"), + virBufferAsprintf(&buf, _("event 'disk-change' for domain '%1$s' disk %2$s: %3$s -> %4$s: %5$s\n"), virDomainGetName(dom), alias, NULLSTR(oldSrc), @@ -633,8 +631,7 @@ virshEventAgentLifecyclePrint(virConnectPtr conn G_GNUC_UNUSED, { g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; - virBufferAsprintf(&buf, _("event 'agent-lifecycle' for domain '%1$s': state: " - "'%2$s' reason: '%3$s'\n"), + virBufferAsprintf(&buf, _("event 'agent-lifecycle' for domain '%1$s': state: '%2$s' reason: '%3$s'\n"), virDomainGetName(dom), UNKNOWNSTR(virshEventAgentLifecycleStateTypeToString(state)), UNKNOWNSTR(virshEventAgentLifecycleReasonTypeToString(reason))); @@ -649,8 +646,7 @@ virshEventMigrationIterationPrint(virConnectPtr conn G_GNUC_UNUSED, { g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; - virBufferAsprintf(&buf, _("event 'migration-iteration' for domain '%1$s': " - "iteration: '%2$d'\n"), + virBufferAsprintf(&buf, _("event 'migration-iteration' for domain '%1$s': iteration: '%2$d'\n"), virDomainGetName(dom), iteration); @@ -727,8 +723,7 @@ virshEventBlockThresholdPrint(virConnectPtr conn G_GNUC_UNUSED, { g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; - virBufferAsprintf(&buf, _("event 'block-threshold' for domain '%1$s': " - "dev: %2$s(%3$s) %4$llu %5$llu\n"), + virBufferAsprintf(&buf, _("event 'block-threshold' for domain '%1$s': dev: %2$s(%3$s) %4$llu %5$llu\n"), virDomainGetName(dom), dev, NULLSTR(path), threshold, excess); virshEventPrint(opaque, &buf); diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index e0776c991f..7250c1989e 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2143,14 +2143,12 @@ cmdBlockcommit(vshControl *ctl, const vshCmd *cmd) if (!blocking) { if (verbose) { - vshError(ctl, "%s", _("--verbose requires at least one of --timeout, " - "--wait, --pivot, or --keep-overlay")); + vshError(ctl, "%s", _("--verbose requires at least one of --timeout, --wait, --pivot, or --keep-overlay")); return false; } if (async) { - vshError(ctl, "%s", _("--async requires at least one of --timeout, " - "--wait, --pivot, or --keep-overlay")); + vshError(ctl, "%s", _("--async requires at least one of --timeout, --wait, --pivot, or --keep-overlay")); return false; } } @@ -2214,8 +2212,7 @@ cmdBlockcommit(vshControl *ctl, const vshCmd *cmd) goto cleanup; } - vshPrintExtra(ctl, "\n%s", _("Commit complete, overlay " - "image kept")); + vshPrintExtra(ctl, "\n%s", _("Commit complete, overlay image kept")); } else { vshPrintExtra(ctl, "\n%s", _("Now in synchronized phase")); } @@ -2411,14 +2408,12 @@ cmdBlockcopy(vshControl *ctl, const vshCmd *cmd) if (!blocking) { if (verbose) { - vshError(ctl, "%s", _("--verbose requires at least one of --timeout, " - "--wait, --pivot, or --finish")); + vshError(ctl, "%s", _("--verbose requires at least one of --timeout, --wait, --pivot, or --finish")); return false; } if (async) { - vshError(ctl, "%s", _("--async requires at least one of --timeout, " - "--wait, --pivot, or --finish")); + vshError(ctl, "%s", _("--async requires at least one of --timeout, --wait, --pivot, or --finish")); return false; } } @@ -3703,8 +3698,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) if (!(vol_string || remove_all_storage) && wipe_storage) { vshError(ctl, - _("'--wipe-storage' requires '--storage ' or " - "'--remove-all-storage'")); + _("'--wipe-storage' requires '--storage ' or '--remove-all-storage'")); return false; } @@ -3789,8 +3783,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) if (vol_string || remove_all_storage) { if (running) { vshError(ctl, - _("Storage volume deletion is supported only on " - "stopped domains")); + _("Storage volume deletion is supported only on stopped domains")); goto cleanup; } @@ -3927,8 +3920,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) if (has_managed_save) { if (!managed_save) { vshError(ctl, "%s", - _("Refusing to undefine while domain managed save " - "image exists")); + _("Refusing to undefine while domain managed save image exists")); goto cleanup; } if (virDomainManagedSaveRemove(dom, 0) < 0) { @@ -5149,8 +5141,7 @@ cmdSchedInfoUpdate(vshControl *ctl, const vshCmd *cmd, g_autofree char *set_field = g_strdup(opt->data); if (!(set_val = strchr(set_field, '='))) { - vshError(ctl, "%s", _("Invalid syntax for --set, " - "expecting name=value")); + vshError(ctl, "%s", _("Invalid syntax for --set, expecting name=value")); goto cleanup; } @@ -7400,8 +7391,7 @@ cmdGuestvcpus(vshControl *ctl, const vshCmd *cmd) return false; if (cpulist && !(enable || disable)) { - vshError(ctl, _("One of options --enable or --disable is required by " - "option --cpulist")); + vshError(ctl, _("One of options --enable or --disable is required by option --cpulist")); return false; } @@ -12528,8 +12518,7 @@ virshDomainDetachInterface(char *doc, if (virMacAddrCompare(tmp_mac, mac) == 0) { if (matchNode) { /* this is the 2nd match, so it's ambiguous */ - vshError(ctl, _("Domain has multiple interfaces matching MAC address %1$s. " - "You must use detach-device and specify the device pci address to remove it."), + vshError(ctl, _("Domain has multiple interfaces matching MAC address %1$s. You must use detach-device and specify the device pci address to remove it."), mac); return false; } @@ -13787,8 +13776,7 @@ cmdDomDirtyRateCalc(vshControl *ctl, const vshCmd *cmd) if (virDomainStartDirtyRateCalc(dom, seconds, flags) < 0) return false; - vshPrintExtra(ctl, _("Start to calculate domain's memory " - "dirty rate successfully.\n")); + vshPrintExtra(ctl, _("Start to calculate domain's memory dirty rate successfully.\n")); return true; } diff --git a/tools/virsh-host.c b/tools/virsh-host.c index ad440d5123..21aca5f6dc 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -355,8 +355,7 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd) nodes_cnt = virXPathNodeSet("/capabilities/host/topology/cells/cell/pages", ctxt, &nodes); if (nodes_cnt <= 0) { - vshError(ctl, "%s", _("could not get information about " - "supported page sizes")); + vshError(ctl, "%s", _("could not get information about supported page sizes")); goto cleanup; } } @@ -548,8 +547,7 @@ cmdAllocpages(vshControl *ctl, const vshCmd *cmd) ctxt, &nodes); if (nodes_cnt == -1) { - vshError(ctl, "%s", _("could not get information about " - "NUMA topology")); + vshError(ctl, "%s", _("could not get information about NUMA topology")); return false; } @@ -1180,8 +1178,7 @@ vshExtractCPUDefXMLs(vshControl *ctl, while (nodes[i]->properties) { if (xmlRemoveProp(nodes[i]->properties) < 0) { vshError(ctl, - _("Cannot extract CPU definition from domain " - "capabilities XML")); + _("Cannot extract CPU definition from domain capabilities XML")); return NULL; } } diff --git a/tools/virsh-network.c b/tools/virsh-network.c index de5d60593a..f6d2db54ba 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -1093,8 +1093,7 @@ cmdNetworkList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) if (optTable + optName + optUUID > 1) { vshError(ctl, "%s", - _("Only one argument from --table, --name and --uuid " - "may be specified.")); + _("Only one argument from --table, --name and --uuid may be specified.")); return false; } @@ -2140,8 +2139,7 @@ cmdNetworkPortList(vshControl *ctl, const vshCmd *cmd) if (optTable + optUUID > 1) { vshError(ctl, "%s", - _("Only one argument from --table and --uuid " - "may be specified.")); + _("Only one argument from --table and --uuid may be specified.")); return false; } diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index a079c8063b..82b8fb44fc 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -297,8 +297,7 @@ virshNodeDeviceListCollect(vshControl *ctl, device = list->devices[i]; if ((ncaps = virNodeDeviceNumOfCaps(device)) < 0) { - vshError(ctl, "%s", _("Failed to get capability numbers " - "of the device")); + vshError(ctl, "%s", _("Failed to get capability numbers of the device")); goto cleanup; } diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 56bd414dc9..5803530d79 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -895,8 +895,7 @@ virshStoragePoolListCollect(vshControl *ctl, /* There is no way to get the pool type */ if (VSH_MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_POOL_TYPE)) { - vshError(ctl, "%s", _("Filtering using --type is not supported " - "by this libvirt")); + vshError(ctl, "%s", _("Filtering using --type is not supported by this libvirt")); goto cleanup; } diff --git a/tools/virsh.c b/tools/virsh.c index 40c23e4180..d9922a35fc 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -166,8 +166,7 @@ virshConnect(vshControl *ctl, const char *uri, bool readonly) virConnectSetKeepAlive(c, interval, count) != 0) { if (keepalive_forced) { vshError(ctl, "%s", - _("Cannot setup keepalive on connection " - "as requested, disconnecting")); + _("Cannot setup keepalive on connection as requested, disconnecting")); g_clear_pointer(&c, virConnectClose); goto cleanup; } @@ -209,8 +208,7 @@ virshReconnect(vshControl *ctl, const char *name, bool readonly, bool force) if (ret < 0) vshError(ctl, "%s", _("Failed to disconnect from the hypervisor")); else if (ret > 0) - vshError(ctl, "%s", _("One or more references were leaked after " - "disconnect from the hypervisor")); + vshError(ctl, "%s", _("One or more references were leaked after disconnect from the hypervisor")); } priv->conn = virshConnect(ctl, name ? name : ctl->connname, readonly); @@ -400,8 +398,7 @@ virshDeinit(vshControl *ctl) if (ret < 0) vshError(ctl, "%s", _("Failed to disconnect from the hypervisor")); else if (ret > 0) - vshError(ctl, "%s", _("One or more references were leaked after " - "disconnect from the hypervisor")); + vshError(ctl, "%s", _("One or more references were leaked after disconnect from the hypervisor")); } virResetLastError(); diff --git a/tools/virt-admin.c b/tools/virt-admin.c index 9d01890447..15a639f1ea 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -139,8 +139,7 @@ vshAdmDisconnect(vshControl *ctl) if (ret < 0) vshError(ctl, "%s", _("Failed to disconnect from the admin server")); else if (ret > 0) - vshError(ctl, "%s", _("One or more references were leaked after " - "disconnect from the hypervisor")); + vshError(ctl, "%s", _("One or more references were leaked after disconnect from the hypervisor")); priv->conn = NULL; return ret; } @@ -500,8 +499,7 @@ cmdSrvThreadpoolSet(vshControl *ctl, const vshCmd *cmd) if (!nparams) { vshError(ctl, "%s", - _("At least one of options --min-workers, --max-workers, " - "--priority-workers is mandatory")); + _("At least one of options --min-workers, --max-workers, --priority-workers is mandatory")); goto cleanup; } @@ -509,8 +507,7 @@ cmdSrvThreadpoolSet(vshControl *ctl, const vshCmd *cmd) VIR_THREADPOOL_WORKERS_MAX, &max) && virTypedParamsGetUInt(params, nparams, VIR_THREADPOOL_WORKERS_MIN, &min) && min > max) { - vshError(ctl, "%s", _("--min-workers must be less than or equal to " - "--max-workers")); + vshError(ctl, "%s", _("--min-workers must be less than or equal to --max-workers")); goto cleanup; } @@ -820,8 +817,7 @@ cmdSrvClientsInfo(vshControl *ctl, const vshCmd *cmd) goto cleanup; if (virAdmServerGetClientLimits(srv, ¶ms, &nparams, 0) < 0) { - vshError(ctl, "%s", _("Unable to retrieve client limits " - "from server's configuration")); + vshError(ctl, "%s", _("Unable to retrieve client limits from server's configuration")); goto cleanup; } @@ -904,8 +900,7 @@ cmdSrvClientsSet(vshControl *ctl, const vshCmd *cmd) #undef PARSE_CMD_TYPED_PARAM if (!nparams) { - vshError(ctl, "%s", _("At least one of options --max-clients, " - "--max-unauth-clients is mandatory")); + vshError(ctl, "%s", _("At least one of options --max-clients, --max-unauth-clients is mandatory")); goto cleanup; } @@ -914,8 +909,7 @@ cmdSrvClientsSet(vshControl *ctl, const vshCmd *cmd) virTypedParamsGetUInt(params, nparams, VIR_SERVER_CLIENTS_UNAUTH_MAX, &unauth_max) && unauth_max > max) { - vshError(ctl, "%s", _("--max-unauth-clients must be less than or equal to " - "--max-clients")); + vshError(ctl, "%s", _("--max-unauth-clients must be less than or equal to --max-clients")); goto cleanup; } @@ -936,8 +930,7 @@ cmdSrvClientsSet(vshControl *ctl, const vshCmd *cmd) vshSaveLibvirtError(); error: - vshError(ctl, "%s", _("Unable to change server's client-related " - "configuration limits")); + vshError(ctl, "%s", _("Unable to change server's client-related configuration limits")); goto cleanup; } diff --git a/tools/virt-host-validate-ch.c b/tools/virt-host-validate-ch.c index b26f82738d..9d235ed7ab 100644 --- a/tools/virt-host-validate-ch.c +++ b/tools/virt-host-validate-ch.c @@ -33,8 +33,7 @@ int virHostValidateCh(void) bool hasVirtFlag = false; virArch arch = virArchFromHost(); const char *kvmhint = - _("Check that CPU and firmware supports virtualization " - "and kvm module is loaded"); + _("Check that CPU and firmware supports virtualization and kvm module is loaded"); if (!(flags = virHostValidateGetCPUFlags())) return -1; @@ -43,8 +42,7 @@ int virHostValidateCh(void) switch ((int)arch) { case VIR_ARCH_X86_64: hasVirtFlag = true; - kvmhint = _("Check that the 'kvm-intel' or 'kvm-amd' modules are " - "loaded & the BIOS has enabled virtualization"); + kvmhint = _("Check that the 'kvm-intel' or 'kvm-amd' modules are loaded & the BIOS has enabled virtualization"); if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SVM) || virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_VMX)) hasHwVirt = true; @@ -64,8 +62,7 @@ int virHostValidateCh(void) virHostMsgPass(); } else { virHostMsgFail(VIR_HOST_VALIDATE_FAIL, - _("Only emulated CPUs are available, performance will be " - "significantly limited")); + _("Only emulated CPUs are available, performance will be significantly limited")); ret = -1; } } @@ -75,8 +72,7 @@ int virHostValidateCh(void) kvmhint) < 0) ret = -1; else if (virHostValidateDeviceAccessible("CH", "/dev/kvm", VIR_HOST_VALIDATE_FAIL, - _("Check /dev/kvm is world writable or you are in " - "a group that is allowed to access it")) < 0) + _("Check /dev/kvm is world writable or you are in a group that is allowed to access it")) < 0) ret = -1; } diff --git a/tools/virt-host-validate-qemu.c b/tools/virt-host-validate-qemu.c index 096419869c..3eeee516d3 100644 --- a/tools/virt-host-validate-qemu.c +++ b/tools/virt-host-validate-qemu.c @@ -34,8 +34,7 @@ int virHostValidateQEMU(void) bool hasHwVirt = false; bool hasVirtFlag = false; virArch arch = virArchFromHost(); - const char *kvmhint = _("Check that CPU and firmware supports virtualization " - "and kvm module is loaded"); + const char *kvmhint = _("Check that CPU and firmware supports virtualization and kvm module is loaded"); if (!(flags = virHostValidateGetCPUFlags())) return -1; @@ -44,8 +43,7 @@ int virHostValidateQEMU(void) case VIR_ARCH_I686: case VIR_ARCH_X86_64: hasVirtFlag = true; - kvmhint = _("Check that the 'kvm-intel' or 'kvm-amd' modules are " - "loaded & the BIOS has enabled virtualization"); + kvmhint = _("Check that the 'kvm-intel' or 'kvm-amd' modules are loaded & the BIOS has enabled virtualization"); if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SVM) || virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_VMX)) hasHwVirt = true; @@ -71,8 +69,7 @@ int virHostValidateQEMU(void) virHostMsgPass(); } else { virHostMsgFail(VIR_HOST_VALIDATE_FAIL, - _("Host not compatible with KVM; HW virtualization CPU features not found. " - "Only emulated CPUs are available; performance will be significantly limited")); + _("Host not compatible with KVM; HW virtualization CPU features not found. Only emulated CPUs are available; performance will be significantly limited")); ret = -1; } } @@ -84,8 +81,7 @@ int virHostValidateQEMU(void) ret = -1; else if (virHostValidateDeviceAccessible("QEMU", "/dev/kvm", VIR_HOST_VALIDATE_FAIL, - _("Check /dev/kvm is world writable or you are in " - "a group that is allowed to access it")) < 0) + _("Check /dev/kvm is world writable or you are in a group that is allowed to access it")) < 0) ret = -1; } @@ -101,8 +97,7 @@ int virHostValidateQEMU(void) if (virHostValidateDeviceExists("QEMU", "/dev/vhost-net", VIR_HOST_VALIDATE_WARN, - _("Load the 'vhost_net' module to improve performance " - "of virtio networking")) < 0) + _("Load the 'vhost_net' module to improve performance of virtio networking")) < 0) ret = -1; if (virHostValidateDeviceExists("QEMU", "/dev/net/tun", diff --git a/tools/vsh.c b/tools/vsh.c index 41f55a91fa..65deaa77e8 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -2358,8 +2358,7 @@ vshAskReedit(vshControl *ctl, const char *msg, bool relax_avail) if (relax_avail) { vshPrintRaw(ctl, - _("i - turn off validation and try to redefine " - "again"), + _("i - turn off validation and try to redefine again"), NULL); } @@ -2385,8 +2384,7 @@ vshAskReedit(vshControl *ctl, const char *msg G_GNUC_UNUSED, bool relax_avail G_GNUC_UNUSED) { - vshDebug(ctl, VSH_ERR_WARNING, "%s", _("This function is not " - "supported on WIN32 platform")); + vshDebug(ctl, VSH_ERR_WARNING, "%s", _("This function is not supported on WIN32 platform")); return 0; } #endif /* WIN32 */ @@ -3022,8 +3020,7 @@ vshInit(vshControl *ctl, const vshCmdGrp *groups, const vshCmdDef *set) } if (!groups && !set) { - vshError(ctl, "%s", _("command groups and command set " - "cannot both be NULL")); + vshError(ctl, "%s", _("command groups and command set cannot both be NULL")); return false; } @@ -3041,8 +3038,7 @@ bool vshInitReload(vshControl *ctl) { if (!cmdGroups && !cmdSet) { - vshError(ctl, "%s", _("command groups and command are both NULL " - "run vshInit before reloading")); + vshError(ctl, "%s", _("command groups and command are both NULL run vshInit before reloading")); return false; }