[libvirt PATCH 0/2] A few fixes in error messages

These fixes were separated from my "Use permutable format strings in translations" series. There are more VIR_PCI_DEVICE_ADDRESS_FMT cases fixed here compared to the format strings series as not all of them were identified by either syntax check or libvirt-pot-check. Jiri Denemark (2): Drop excess whitespace from error messages Do not use VIR_PCI_DEVICE_ADDRESS_FMT in translations src/conf/domain_conf.c | 6 ++---- src/libxl/libxl_driver.c | 15 +++++---------- src/qemu/qemu_hotplug.c | 14 ++++---------- src/util/virnetdevvportprofile.c | 3 +-- src/util/virsocketaddr.c | 3 +-- 5 files changed, 13 insertions(+), 28 deletions(-) -- 2.40.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/conf/domain_conf.c | 3 +-- src/util/virnetdevvportprofile.c | 3 +-- src/util/virsocketaddr.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9f49c6e62d..23fc19a409 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14881,8 +14881,7 @@ virDomainControllerAliasFind(const virDomainDef *def, } if (!def->controllers[contIndex]->info.alias) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Device alias was not set for %s controller " - "with index %d "), + _("Device alias was not set for %s controller with index %d"), contTypeStr, idx); return NULL; } diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprofile.c index ae23f795b2..95f3bd2fc0 100644 --- a/src/util/virnetdevvportprofile.c +++ b/src/util/virnetdevvportprofile.c @@ -577,8 +577,7 @@ virNetDevVPortProfileGetStatus(struct nlattr **tb, int32_t vf, virUUIDFormat(instanceId, instanceIdStr); virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not find vf/instanceId %u/%s " - " in netlink response"), + _("Could not find vf/instanceId %u/%s in netlink response"), vf, instanceIdStr); /* go through all the entries again. This seems tedious, diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c index 0480485ab7..7db9a7d7e8 100644 --- a/src/util/virsocketaddr.c +++ b/src/util/virsocketaddr.c @@ -906,8 +906,7 @@ virSocketAddrGetRange(virSocketAddr *start, virSocketAddr *end, virSocketAddrPrefixToNetmask(prefix, &netmask, VIR_SOCKET_ADDR_FAMILY(network)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("bad prefix %d for network %s when " - " checking range %s - %s"), + _("bad prefix %d for network %s when checking range %s - %s"), prefix, netStr, startStr, endStr); return -1; } -- 2.40.0

xgettext cannot handle strings concatenated with cpp macros. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/conf/domain_conf.c | 3 +-- src/libxl/libxl_driver.c | 15 +++++---------- src/qemu/qemu_hotplug.c | 14 ++++---------- 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 23fc19a409..8f87663e08 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19585,8 +19585,7 @@ virDomainDeviceInfoCheckABIStability(virDomainDeviceInfo *src, src->addr.pci.slot != dst->addr.pci.slot || src->addr.pci.function != dst->addr.pci.function) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target device PCI address " VIR_PCI_DEVICE_ADDRESS_FMT - "does not match source " VIR_PCI_DEVICE_ADDRESS_FMT), + _("Target device PCI address %04x:%02x:%02x.%d does not match source %04x:%02x:%02x.%d"), dst->addr.pci.domain, dst->addr.pci.bus, dst->addr.pci.slot, dst->addr.pci.function, src->addr.pci.domain, src->addr.pci.bus, diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 07dcfcdc05..6e002ab77c 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -3082,8 +3082,7 @@ libxlDomainAttachHostPCIDevice(libxlDriverPrivate *driver, if (virDomainHostdevFind(vm->def, hostdev, &found) >= 0) { virReportError(VIR_ERR_OPERATION_FAILED, - _("target pci device " VIR_PCI_DEVICE_ADDRESS_FMT - " already exists"), + _("target pci device %04x:%02x:%02x.%d already exists"), pcisrc->addr.domain, pcisrc->addr.bus, pcisrc->addr.slot, pcisrc->addr.function); goto cleanup; @@ -3101,8 +3100,7 @@ libxlDomainAttachHostPCIDevice(libxlDriverPrivate *driver, if (libxl_device_pci_add(cfg->ctx, vm->def->id, &pcidev, 0) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("libxenlight failed to attach pci device " - VIR_PCI_DEVICE_ADDRESS_FMT), + _("libxenlight failed to attach pci device %04x:%02x:%02x.%d"), pcisrc->addr.domain, pcisrc->addr.bus, pcisrc->addr.slot, pcisrc->addr.function); goto error; @@ -3659,8 +3657,7 @@ libxlDomainDetachHostPCIDevice(libxlDriverPrivate *driver, idx = virDomainHostdevFind(vm->def, hostdev, &detach); if (idx < 0) { virReportError(VIR_ERR_OPERATION_FAILED, - _("host pci device " VIR_PCI_DEVICE_ADDRESS_FMT - " not found"), + _("host pci device %04x:%02x:%02x.%d not found"), pcisrc->addr.domain, pcisrc->addr.bus, pcisrc->addr.slot, pcisrc->addr.function); goto cleanup; @@ -3668,8 +3665,7 @@ libxlDomainDetachHostPCIDevice(libxlDriverPrivate *driver, if (libxlIsMultiFunctionDevice(vm->def, detach->info)) { virReportError(VIR_ERR_OPERATION_FAILED, - _("cannot hot unplug multifunction PCI device: " - VIR_PCI_DEVICE_ADDRESS_FMT), + _("cannot hot unplug multifunction PCI device: %04x:%02x:%02x.%d"), pcisrc->addr.domain, pcisrc->addr.bus, pcisrc->addr.slot, pcisrc->addr.function); goto error; @@ -3681,8 +3677,7 @@ libxlDomainDetachHostPCIDevice(libxlDriverPrivate *driver, if (libxl_device_pci_remove(cfg->ctx, vm->def->id, &pcidev, 0) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("libxenlight failed to detach pci device " - VIR_PCI_DEVICE_ADDRESS_FMT), + _("libxenlight failed to detach pci device %04x:%02x:%02x.%d"), pcisrc->addr.domain, pcisrc->addr.bus, pcisrc->addr.slot, pcisrc->addr.function); goto error; diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index f5990d3da6..7f104c28be 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -5520,8 +5520,7 @@ qemuDomainDetachPrepHostdev(virDomainObj *vm, switch (subsys->type) { case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: virReportError(VIR_ERR_DEVICE_MISSING, - _("host pci device " VIR_PCI_DEVICE_ADDRESS_FMT - " not found"), + _("host pci device %04x:%02x:%02x.%d not found"), pcisrc->addr.domain, pcisrc->addr.bus, pcisrc->addr.slot, pcisrc->addr.function); break; @@ -6024,8 +6023,7 @@ qemuDomainDetachDeviceLive(virDomainObj *vm, if (qemuIsMultiFunctionDevice(vm->def, info)) { virReportError(VIR_ERR_OPERATION_FAILED, - _("cannot hot unplug %s device with multifunction PCI guest address: " - VIR_PCI_DEVICE_ADDRESS_FMT), + _("cannot hot unplug %s device with multifunction PCI guest address: %04x:%02x:%02x.%d"), virDomainDeviceTypeToString(detach.type), info->addr.pci.domain, info->addr.pci.bus, info->addr.pci.slot, info->addr.pci.function); @@ -6040,9 +6038,7 @@ qemuDomainDetachDeviceLive(virDomainObj *vm, info->addr.pci.bus); if (controllerIdx < 0) { virReportError(VIR_ERR_OPERATION_FAILED, - _("cannot hot unplug %s device with PCI guest address: " - VIR_PCI_DEVICE_ADDRESS_FMT - " - controller not found"), + _("cannot hot unplug %s device with PCI guest address: %04x:%02x:%02x.%d - controller not found"), virDomainDeviceTypeToString(detach.type), info->addr.pci.domain, info->addr.pci.bus, info->addr.pci.slot, info->addr.pci.function); @@ -6052,9 +6048,7 @@ qemuDomainDetachDeviceLive(virDomainObj *vm, controller = vm->def->controllers[controllerIdx]; if (controller->opts.pciopts.hotplug == VIR_TRISTATE_SWITCH_OFF) { virReportError(VIR_ERR_OPERATION_FAILED, - _("cannot hot unplug %s device with PCI guest address: " - VIR_PCI_DEVICE_ADDRESS_FMT - " - not allowed by controller"), + _("cannot hot unplug %s device with PCI guest address: %04x:%02x:%02x.%d - not allowed by controller"), virDomainDeviceTypeToString(detach.type), info->addr.pci.domain, info->addr.pci.bus, info->addr.pci.slot, info->addr.pci.function); -- 2.40.0

On a Thursday in 2023, Jiri Denemark wrote:
These fixes were separated from my "Use permutable format strings in translations" series. There are more VIR_PCI_DEVICE_ADDRESS_FMT cases fixed here compared to the format strings series as not all of them were identified by either syntax check or libvirt-pot-check.
Jiri Denemark (2): Drop excess whitespace from error messages Do not use VIR_PCI_DEVICE_ADDRESS_FMT in translations
src/conf/domain_conf.c | 6 ++---- src/libxl/libxl_driver.c | 15 +++++---------- src/qemu/qemu_hotplug.c | 14 ++++---------- src/util/virnetdevvportprofile.c | 3 +-- src/util/virsocketaddr.c | 3 +-- 5 files changed, 13 insertions(+), 28 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano
participants (2)
-
Jiri Denemark
-
Ján Tomko