hypervisor: Update format strings in translated messages

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 11:50:56 +01:00
parent 7d8f371801
commit 1d279b0abd
3 changed files with 33 additions and 44 deletions

View File

@ -166,7 +166,7 @@ virDomainCgroupSetupDomainBlkioParameters(virCgroup *cgroup,
} }
} }
} else { } else {
virReportError(VIR_ERR_INVALID_ARG, _("Unknown blkio parameter %s"), virReportError(VIR_ERR_INVALID_ARG, _("Unknown blkio parameter %1$s"),
param->field); param->field);
ret = -1; ret = -1;
virBlkioDeviceArrayClear(devices, ndevices); virBlkioDeviceArrayClear(devices, ndevices);
@ -370,7 +370,7 @@ virDomainCgroupInitCgroup(const char *prefix,
if (!g_path_is_absolute(vm->def->resource->partition)) { if (!g_path_is_absolute(vm->def->resource->partition)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Resource partition '%s' must start with '/'"), _("Resource partition '%1$s' must start with '/'"),
vm->def->resource->partition); vm->def->resource->partition);
return -1; return -1;
} }

View File

@ -151,7 +151,7 @@ virDomainDriverMergeBlkioDevice(virBlkioDevice **dest_array,
} else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS)) { } else if (STREQ(type, VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS)) {
dest->wbps = src->wbps; dest->wbps = src->wbps;
} else { } else {
virReportError(VIR_ERR_INVALID_ARG, _("Unknown parameter %s"), virReportError(VIR_ERR_INVALID_ARG, _("Unknown parameter %1$s"),
type); type);
return -1; return -1;
} }
@ -256,7 +256,7 @@ virDomainDriverParseBlkioDeviceStr(char *blkioDeviceStr, const char *type,
goto number_error; goto number_error;
} else { } else {
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("unknown parameter '%s'"), type); _("unknown parameter '%1$s'"), type);
goto cleanup; goto cleanup;
} }
@ -279,13 +279,13 @@ virDomainDriverParseBlkioDeviceStr(char *blkioDeviceStr, const char *type,
parse_error: parse_error:
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("unable to parse blkio device '%s' '%s'"), _("unable to parse blkio device '%1$s' '%2$s'"),
type, blkioDeviceStr); type, blkioDeviceStr);
goto cleanup; goto cleanup;
number_error: number_error:
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("invalid value '%s' for parameter '%s' of device '%s'"), _("invalid value '%1$s' for parameter '%2$s' of device '%3$s'"),
temp, type, result[i].path); temp, type, result[i].path);
cleanup: cleanup:
@ -362,7 +362,7 @@ virDomainDriverNodeDeviceGetPCIInfo(virNodeDeviceDef *def,
if (!cap) { if (!cap) {
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("device %s is not a PCI device"), def->name); _("device %1$s is not a PCI device"), def->name);
return -1; return -1;
} }
@ -525,7 +525,7 @@ virDomainDriverAddIOThreadCheck(virDomainDef *def,
{ {
if (virDomainIOThreadIDFind(def, iothread_id)) { if (virDomainIOThreadIDFind(def, iothread_id)) {
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("an IOThread is already using iothread_id '%u'"), _("an IOThread is already using iothread_id '%1$u'"),
iothread_id); iothread_id);
return -1; return -1;
} }
@ -548,7 +548,7 @@ virDomainDriverDelIOThreadCheck(virDomainDef *def,
if (!virDomainIOThreadIDFind(def, iothread_id)) { if (!virDomainIOThreadIDFind(def, iothread_id)) {
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("cannot find IOThread '%u' in iothreadids list"), _("cannot find IOThread '%1$u' in iothreadids list"),
iothread_id); iothread_id);
return -1; return -1;
} }
@ -556,8 +556,7 @@ virDomainDriverDelIOThreadCheck(virDomainDef *def,
for (i = 0; i < def->ndisks; i++) { for (i = 0; i < def->ndisks; i++) {
if (def->disks[i]->iothread == iothread_id) { if (def->disks[i]->iothread == iothread_id) {
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("cannot remove IOThread %u since it " _("cannot remove IOThread %1$u since it is being used by disk '%2$s'"),
"is being used by disk '%s'"),
iothread_id, def->disks[i]->dst); iothread_id, def->disks[i]->dst);
return -1; return -1;
} }
@ -566,8 +565,7 @@ virDomainDriverDelIOThreadCheck(virDomainDef *def,
for (i = 0; i < def->ncontrollers; i++) { for (i = 0; i < def->ncontrollers; i++) {
if (def->controllers[i]->iothread == iothread_id) { if (def->controllers[i]->iothread == iothread_id) {
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("cannot remove IOThread '%u' since it " _("cannot remove IOThread '%1$u' since it is being used by controller"),
"is being used by controller"),
iothread_id); iothread_id);
return -1; return -1;
} }

View File

@ -94,13 +94,12 @@ static int virHostdevIsPCINodeDeviceUsed(virPCIDeviceAddress *devAddr, void *opa
if (actual_drvname && actual_domname) if (actual_drvname && actual_domname)
virReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
_("PCI device %s is in use by " _("PCI device %1$s is in use by driver %2$s, domain %3$s"),
"driver %s, domain %s"),
virPCIDeviceGetName(actual), virPCIDeviceGetName(actual),
actual_drvname, actual_domname); actual_drvname, actual_domname);
else else
virReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
_("PCI device %s is in use"), _("PCI device %1$s is in use"),
virPCIDeviceGetName(actual)); virPCIDeviceGetName(actual));
return -1; return -1;
} }
@ -171,7 +170,7 @@ virHostdevManagerNew(void)
if (g_mkdir_with_parents(hostdevMgr->stateDir, 0777) < 0) { if (g_mkdir_with_parents(hostdevMgr->stateDir, 0777) < 0) {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("Failed to create state dir '%s'"), _("Failed to create state dir '%1$s'"),
hostdevMgr->stateDir); hostdevMgr->stateDir);
return NULL; return NULL;
} }
@ -188,7 +187,7 @@ virHostdevManagerNew(void)
if (g_mkdir_with_parents(hostdevMgr->stateDir, 0777) < 0) { if (g_mkdir_with_parents(hostdevMgr->stateDir, 0777) < 0) {
umask(old_umask); umask(old_umask);
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("Failed to create state dir '%s'"), _("Failed to create state dir '%1$s'"),
hostdevMgr->stateDir); hostdevMgr->stateDir);
return NULL; return NULL;
} }
@ -250,7 +249,7 @@ virHostdevGetPCIHostDevice(const virDomainHostdevDef *hostdev,
virPCIDeviceSetStubDriver(actual, VIR_PCI_STUB_DRIVER_XEN); virPCIDeviceSetStubDriver(actual, VIR_PCI_STUB_DRIVER_XEN);
} else { } else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("pci backend driver '%s' is not supported"), _("pci backend driver '%1$s' is not supported"),
virDomainHostdevSubsysPCIBackendTypeToString(pcisrc->backend)); virDomainHostdevSubsysPCIBackendTypeToString(pcisrc->backend));
return -1; return -1;
} }
@ -333,7 +332,7 @@ virHostdevNetDevice(virDomainHostdevDef *hostdev,
if (!(*linkdev)) { if (!(*linkdev)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("The device at %s has no network device name"), _("The device at %1$s has no network device name"),
sysfs_path); sysfs_path);
return -1; return -1;
} }
@ -378,9 +377,7 @@ virHostdevNetConfigVirtPortProfile(const char *linkdev, int vf,
case VIR_NETDEV_VPORT_PROFILE_8021QBG: case VIR_NETDEV_VPORT_PROFILE_8021QBG:
case VIR_NETDEV_VPORT_PROFILE_LAST: case VIR_NETDEV_VPORT_PROFILE_LAST:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("virtualport type %s is " _("virtualport type %1$s is currently not supported on interfaces of type hostdev"),
"currently not supported on interfaces of type "
"hostdev"),
virNetDevVPortTypeToString(virtPort->virtPortType)); virNetDevVPortTypeToString(virtPort->virtPortType));
break; break;
@ -475,8 +472,7 @@ virHostdevSetNetConfig(virDomainHostdevDef *hostdev,
if (virtPort) { if (virtPort) {
if (vlan) { if (vlan) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("direct setting of the vlan tag is not allowed " _("direct setting of the vlan tag is not allowed for hostdev devices using %1$s mode"),
"for hostdev devices using %s mode"),
virNetDevVPortTypeToString(virtPort->virtPortType)); virNetDevVPortTypeToString(virtPort->virtPortType));
return -1; return -1;
} }
@ -611,7 +607,7 @@ virHostdevResetAllPCIDevices(virHostdevManager *mgr,
VIR_DEBUG("Resetting PCI device %s", virPCIDeviceGetName(pci)); VIR_DEBUG("Resetting PCI device %s", virPCIDeviceGetName(pci));
if (virPCIDeviceReset(pci, mgr->activePCIHostdevs, if (virPCIDeviceReset(pci, mgr->activePCIHostdevs,
mgr->inactivePCIHostdevs) < 0) { mgr->inactivePCIHostdevs) < 0) {
VIR_ERROR(_("Failed to reset PCI device: %s"), VIR_ERROR(_("Failed to reset PCI device: %1$s"),
virGetLastErrorMessage()); virGetLastErrorMessage());
ret = -1; ret = -1;
} }
@ -642,7 +638,7 @@ virHostdevReattachAllPCIDevices(virHostdevManager *mgr,
if (virPCIDeviceReattach(actual, if (virPCIDeviceReattach(actual,
mgr->activePCIHostdevs, mgr->activePCIHostdevs,
mgr->inactivePCIHostdevs) < 0) { mgr->inactivePCIHostdevs) < 0) {
VIR_ERROR(_("Failed to re-attach PCI device: %s"), VIR_ERROR(_("Failed to re-attach PCI device: %1$s"),
virGetLastErrorMessage()); virGetLastErrorMessage());
} }
} else { } else {
@ -699,7 +695,7 @@ virHostdevPreparePCIDevicesImpl(virHostdevManager *mgr,
if (!usesVFIO && !virPCIDeviceIsAssignable(pci, strict_acs_check)) { if (!usesVFIO && !virPCIDeviceIsAssignable(pci, strict_acs_check)) {
virReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
_("PCI device %s is not assignable"), _("PCI device %1$s is not assignable"),
virPCIDeviceGetName(pci)); virPCIDeviceGetName(pci));
goto cleanup; goto cleanup;
} }
@ -788,8 +784,7 @@ virHostdevPreparePCIDevicesImpl(virHostdevManager *mgr,
goto reattachdevs; goto reattachdevs;
} else { } else {
virReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
_("Unmanaged PCI device %s must be manually " _("Unmanaged PCI device %1$s must be manually detached from the host"),
"detached from the host"),
virPCIDeviceGetName(pci)); virPCIDeviceGetName(pci));
goto reattachdevs; goto reattachdevs;
} }
@ -1012,7 +1007,7 @@ virHostdevReAttachPCIDevicesImpl(virHostdevManager *mgr,
if (!actual || if (!actual ||
virPCIDeviceListAdd(mgr->inactivePCIHostdevs, actual) < 0) { virPCIDeviceListAdd(mgr->inactivePCIHostdevs, actual) < 0) {
VIR_ERROR(_("Failed to add PCI device %s to the inactive list"), VIR_ERROR(_("Failed to add PCI device %1$s to the inactive list"),
virGetLastErrorMessage()); virGetLastErrorMessage());
virResetLastError(); virResetLastError();
} }
@ -1104,7 +1099,7 @@ virHostdevReAttachPCIDevices(virHostdevManager *mgr,
return; return;
if (!(pcidevs = virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs))) { if (!(pcidevs = virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs))) {
VIR_ERROR(_("Failed to allocate PCI device list: %s"), VIR_ERROR(_("Failed to allocate PCI device list: %1$s"),
virGetLastErrorMessage()); virGetLastErrorMessage());
virResetLastError(); virResetLastError();
return; return;
@ -1340,13 +1335,12 @@ virHostdevMarkUSBDevices(virHostdevManager *mgr,
virUSBDeviceGetUsedBy(tmp, &other_drvname, &other_domname); virUSBDeviceGetUsedBy(tmp, &other_drvname, &other_domname);
if (other_drvname && other_domname) if (other_drvname && other_domname)
virReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
_("USB device %s is in use by " _("USB device %1$s is in use by driver %2$s, domain %3$s"),
"driver %s, domain %s"),
virUSBDeviceGetName(tmp), virUSBDeviceGetName(tmp),
other_drvname, other_domname); other_drvname, other_domname);
else else
virReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
_("USB device %s is already in use"), _("USB device %1$s is already in use"),
virUSBDeviceGetName(tmp)); virUSBDeviceGetName(tmp));
goto error; goto error;
} }
@ -1423,13 +1417,11 @@ virHostdevFindUSBDevice(virDomainHostdevDef *hostdev,
} else if (rc > 1) { } else if (rc > 1) {
if (autoAddress) { if (autoAddress) {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("Multiple USB devices for %x:%x were found," _("Multiple USB devices for %1$x:%2$x were found, but none of them is at bus:%3$u device:%4$u"),
" but none of them is at bus:%u device:%u"),
vendor, product, bus, device); vendor, product, bus, device);
} else { } else {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("Multiple USB devices for %x:%x, " _("Multiple USB devices for %1$x:%2$x, use <address> to specify one"),
"use <address> to specify one"),
vendor, product); vendor, product);
} }
return -1; return -1;
@ -1610,8 +1602,7 @@ virHostdevPrepareSCSIDevices(virHostdevManager *mgr,
if (!(scsi_shareable && tmp_shareable)) { if (!(scsi_shareable && tmp_shareable)) {
virReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
_("SCSI device %s is already in use by " _("SCSI device %1$s is already in use by other domain(s) as '%2$s'"),
"other domain(s) as '%s'"),
virSCSIDeviceGetName(tmp), virSCSIDeviceGetName(tmp),
tmp_shareable ? "shareable" : "non-shareable"); tmp_shareable ? "shareable" : "non-shareable");
goto error; goto error;
@ -2287,7 +2278,7 @@ virHostdevPrepareOneNVMeDevice(virHostdevManager *hostdev_mgr,
addrStr = virPCIDeviceAddressAsString(addr); addrStr = virPCIDeviceAddressAsString(addr);
virReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
_("NVMe device %s already in use by driver %s domain %s"), _("NVMe device %1$s already in use by driver %2$s domain %3$s"),
NULLSTR(addrStr), actual_drvname, actual_domname); NULLSTR(addrStr), actual_drvname, actual_domname);
goto cleanup; goto cleanup;
} }
@ -2376,7 +2367,7 @@ virHostdevPrepareNVMeDevices(virHostdevManager *hostdev_mgr,
while (lastGoodDiskIdx >= 0) { while (lastGoodDiskIdx >= 0) {
if (virHostdevReAttachOneNVMeDevice(hostdev_mgr, drv_name, dom_name, if (virHostdevReAttachOneNVMeDevice(hostdev_mgr, drv_name, dom_name,
disks[lastGoodDiskIdx]->src) < 0) { disks[lastGoodDiskIdx]->src) < 0) {
VIR_ERROR(_("Failed to reattach NVMe for disk target: %s"), VIR_ERROR(_("Failed to reattach NVMe for disk target: %1$s"),
disks[lastGoodDiskIdx]->dst); disks[lastGoodDiskIdx]->dst);
} }
@ -2446,7 +2437,7 @@ virHostdevReAttachNVMeDevices(virHostdevManager *hostdev_mgr,
for (i = 0; i < ndisks; i++) { for (i = 0; i < ndisks; i++) {
if (virHostdevReAttachOneNVMeDevice(hostdev_mgr, drv_name, if (virHostdevReAttachOneNVMeDevice(hostdev_mgr, drv_name,
dom_name, disks[i]->src) < 0) { dom_name, disks[i]->src) < 0) {
VIR_ERROR(_("Failed to reattach NVMe for disk target: %s"), VIR_ERROR(_("Failed to reattach NVMe for disk target: %1$s"),
disks[i]->dst); disks[i]->dst);
ret = -1; ret = -1;
} }