[libvirt PATCH 05/51] ch: Update format strings in translated messages

Jiri Denemark jdenemar at redhat.com
Fri Mar 10 16:09:21 UTC 2023


Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 src/ch/ch_conf.c    |  2 +-
 src/ch/ch_domain.c  |  4 ++--
 src/ch/ch_driver.c  | 20 ++++++++++----------
 src/ch/ch_monitor.c | 27 ++++++++++++++-------------
 src/ch/ch_process.c |  6 +++---
 5 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/src/ch/ch_conf.c b/src/ch/ch_conf.c
index 0d07fa270c..2bb2eaf820 100644
--- a/src/ch/ch_conf.c
+++ b/src/ch/ch_conf.c
@@ -202,7 +202,7 @@ chExtractVersion(virCHDriver *driver)
 
     if (virStringParseVersion(&version, tmp, true) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Unable to parse cloud-hypervisor version: %s"), tmp);
+                       _("Unable to parse cloud-hypervisor version: %1$s"), tmp);
         return -1;
     }
 
diff --git a/src/ch/ch_domain.c b/src/ch/ch_domain.c
index cf98654479..35e3471cba 100644
--- a/src/ch/ch_domain.c
+++ b/src/ch/ch_domain.c
@@ -176,7 +176,7 @@ chValidateDomainDeviceDef(const virDomainDeviceDef *dev,
     case VIR_DOMAIN_DEVICE_AUDIO:
     case VIR_DOMAIN_DEVICE_CRYPTO:
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Cloud-Hypervisor doesn't support '%s' device"),
+                       _("Cloud-Hypervisor doesn't support '%1$s' device"),
                        virDomainDeviceTypeToString(dev->type));
         return -1;
 
@@ -340,7 +340,7 @@ virCHDomainObjFromDomain(virDomainPtr domain)
     if (!vm) {
         virUUIDFormat(domain->uuid, uuidstr);
         virReportError(VIR_ERR_NO_DOMAIN,
-                       _("no domain with matching uuid '%s' (%s)"),
+                       _("no domain with matching uuid '%1$s' (%2$s)"),
                        uuidstr, domain->name);
         return NULL;
     }
diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
index 12fbe31c24..72fe3198b2 100644
--- a/src/ch/ch_driver.c
+++ b/src/ch/ch_driver.c
@@ -631,7 +631,7 @@ static virDomainPtr chDomainLookupByID(virConnectPtr conn,
 
     if (!vm) {
         virReportError(VIR_ERR_NO_DOMAIN,
-                       _("no domain with matching id '%d'"), id);
+                       _("no domain with matching id '%1$d'"), id);
         goto cleanup;
     }
 
@@ -656,7 +656,7 @@ static virDomainPtr chDomainLookupByName(virConnectPtr conn,
 
     if (!vm) {
         virReportError(VIR_ERR_NO_DOMAIN,
-                       _("no domain with matching name '%s'"), name);
+                       _("no domain with matching name '%1$s'"), name);
         goto cleanup;
     }
 
@@ -683,7 +683,7 @@ static virDomainPtr chDomainLookupByUUID(virConnectPtr conn,
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(uuid, uuidstr);
         virReportError(VIR_ERR_NO_DOMAIN,
-                       _("no domain with matching uuid '%s'"), uuidstr);
+                       _("no domain with matching uuid '%1$s'"), uuidstr);
         goto cleanup;
     }
 
@@ -817,14 +817,14 @@ chDomainOpenConsole(virDomainPtr dom,
      }
 
      if (!chr) {
-          virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot find character device %s"),
+          virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot find character device %1$s"),
                          NULLSTR(dev_name));
           goto cleanup;
      }
 
      if (chr->source->type != VIR_DOMAIN_CHR_TYPE_PTY) {
           virReportError(VIR_ERR_INTERNAL_ERROR,
-                         _("character device %s is not using a PTY"),
+                         _("character device %1$s is not using a PTY"),
                          dev_name ? dev_name : NULLSTR(chr->info.alias));
           goto cleanup;
      }
@@ -930,7 +930,7 @@ chConnectSupportsFeature(virConnectPtr conn,
         case VIR_DRV_FEATURE_NETWORK_UPDATE_HAS_CORRECT_ORDER:
         case VIR_DRV_FEATURE_FD_PASSING:
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("Global feature %d should have already been handled"),
+                           _("Global feature %1$d should have already been handled"),
                            feature);
             return -1;
         case VIR_DRV_FEATURE_MIGRATION_V2:
@@ -1158,7 +1158,7 @@ chDomainPinVcpuLive(virDomainObj *vm,
 
     if (!(vcpuinfo = virDomainDefGetVcpu(def, vcpu))) {
         virReportError(VIR_ERR_INVALID_ARG,
-                       _("vcpu %d is out of range of live cpu count %d"),
+                       _("vcpu %1$d is out of range of live cpu count %2$d"),
                        vcpu, virDomainDefGetVcpusMax(def));
         return -1;
     }
@@ -1228,7 +1228,7 @@ chDomainPinVcpuFlags(virDomainPtr dom,
     if (persistentDef &&
         !(vcpuinfo = virDomainDefGetVcpu(persistentDef, vcpu))) {
         virReportError(VIR_ERR_INVALID_ARG,
-                       _("vcpu %d is out of range of persistent cpu count %d"),
+                       _("vcpu %1$d is out of range of persistent cpu count %2$d"),
                        vcpu, virDomainDefGetVcpus(persistentDef));
         goto endjob;
     }
@@ -1609,7 +1609,7 @@ chDomainSetNumaParameters(virDomainPtr dom,
 
             if (mode < 0 || mode >= VIR_DOMAIN_NUMATUNE_MEM_LAST) {
                 virReportError(VIR_ERR_INVALID_ARG,
-                               _("unsupported numatune mode: '%d'"), mode);
+                               _("unsupported numatune mode: '%1$d'"), mode);
                 goto cleanup;
             }
 
@@ -1620,7 +1620,7 @@ chDomainSetNumaParameters(virDomainPtr dom,
 
             if (virBitmapIsAllClear(nodeset)) {
                 virReportError(VIR_ERR_OPERATION_INVALID,
-                               _("Invalid nodeset of 'numatune': %s"),
+                               _("Invalid nodeset of 'numatune': %1$s"),
                                param->value.s);
                 goto cleanup;
             }
diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c
index 7b8f0a8077..d902bc6959 100644
--- a/src/ch/ch_monitor.c
+++ b/src/ch/ch_monitor.c
@@ -176,7 +176,8 @@ virCHMonitorBuildDiskJson(virJSONValue *disks, virDomainDiskDef *diskdef)
         }
         if (diskdef->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) {
             virReportError(VIR_ERR_INVALID_ARG,
-                           _("Only virtio bus types are supported for '%s'"), diskdef->src->path);
+                           _("Only virtio bus types are supported for '%1$s'"),
+                           diskdef->src->path);
             return -1;
         }
         if (virJSONValueObjectAppendString(disk, "path", diskdef->src->path) < 0)
@@ -253,7 +254,7 @@ virCHMonitorBuildNetJson(virJSONValue *nets,
 
                 if (virSocketAddrPrefixToNetmask(ip->prefix, &netmask, AF_INET) < 0) {
                     virReportError(VIR_ERR_INTERNAL_ERROR,
-                                   _("Failed to translate net prefix %d to netmask"),
+                                   _("Failed to translate net prefix %1$d to netmask"),
                                    ip->prefix);
                     return -1;
                 }
@@ -331,7 +332,7 @@ virCHMonitorBuildNetJson(virJSONValue *nets,
     if (netdef->driver.virtio.rx_queue_size || netdef->driver.virtio.tx_queue_size) {
         if (netdef->driver.virtio.rx_queue_size != netdef->driver.virtio.tx_queue_size) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-               _("virtio rx_queue_size option %d is not same with tx_queue_size %d"),
+               _("virtio rx_queue_size option %1$d is not same with tx_queue_size %2$d"),
                netdef->driver.virtio.rx_queue_size,
                netdef->driver.virtio.tx_queue_size);
             return -1;
@@ -388,7 +389,7 @@ virCHMonitorBuildDeviceJson(virJSONValue *devices,
         path = g_strdup_printf("/sys/bus/pci/devices/%s/", name);
         if (!virFileExists(path)) {
             virReportError(VIR_ERR_DEVICE_MISSING,
-                           _("host pci device %s not found"), path);
+                           _("host pci device %1$s not found"), path);
             return -1;
         }
         if (virJSONValueObjectAppendString(device, "path", path) < 0)
@@ -481,28 +482,28 @@ chMonitorCreateSocket(const char *socket_path)
     addr.sun_family = AF_UNIX;
     if (virStrcpyStatic(addr.sun_path, socket_path) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("UNIX socket path '%s' too long"),
+                       _("UNIX socket path '%1$s' too long"),
                        socket_path);
         goto error;
     }
 
     if (unlink(socket_path) < 0 && errno != ENOENT) {
         virReportSystemError(errno,
-                             _("Unable to unlink %s"),
+                             _("Unable to unlink %1$s"),
                              socket_path);
         goto error;
     }
 
     if (bind(fd, (struct sockaddr *)&addr, addrlen) < 0) {
         virReportSystemError(errno,
-                             _("Unable to bind to UNIX socket path '%s'"),
+                             _("Unable to bind to UNIX socket path '%1$s'"),
                              socket_path);
         goto error;
     }
 
     if (listen(fd, 1) < 0) {
         virReportSystemError(errno,
-                             _("Unable to listen to UNIX socket path '%s'"),
+                             _("Unable to listen to UNIX socket path '%1$s'"),
                              socket_path);
         goto error;
     }
@@ -543,7 +544,7 @@ virCHMonitorNew(virDomainObj *vm, const char *socketdir)
     mon->socketpath = g_strdup_printf("%s/%s-socket", socketdir, vm->def->name);
     if (g_mkdir_with_parents(socketdir, 0777) < 0) {
         virReportSystemError(errno,
-                             _("Cannot create socket directory '%s'"),
+                             _("Cannot create socket directory '%1$s'"),
                              socketdir);
         return NULL;
     }
@@ -553,7 +554,7 @@ virCHMonitorNew(virDomainObj *vm, const char *socketdir)
     socket_fd = chMonitorCreateSocket(mon->socketpath);
     if (socket_fd < 0) {
         virReportSystemError(errno,
-                             _("Cannot create socket '%s'"),
+                             _("Cannot create socket '%1$s'"),
                              mon->socketpath);
         return NULL;
     }
@@ -619,7 +620,7 @@ virCHMonitorCurlPerform(CURL *handle)
 
     if (errorCode != CURLE_OK) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("curl_easy_perform() returned an error: %s (%d)"),
+                       _("curl_easy_perform() returned an error: %1$s (%2$d)"),
                        curl_easy_strerror(errorCode), errorCode);
         return -1;
     }
@@ -629,8 +630,8 @@ virCHMonitorCurlPerform(CURL *handle)
 
     if (errorCode != CURLE_OK) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned an "
-                         "error: %s (%d)"), curl_easy_strerror(errorCode),
+                       _("curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned an error: %1$s (%2$d)"),
+                       curl_easy_strerror(errorCode),
                        errorCode);
         return -1;
     }
diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c
index 77f55e777b..c145a78496 100644
--- a/src/ch/ch_process.c
+++ b/src/ch/ch_process.c
@@ -67,7 +67,7 @@ virCHProcessUpdateConsoleDevice(virDomainObj *vm,
     dev = virJSONValueObjectGet(config, device);
     if (!dev) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("missing '%s' in 'config' from cloud-hypervisor"),
+                       _("missing '%1$s' in 'config' from cloud-hypervisor"),
                        device);
         return;
     }
@@ -75,7 +75,7 @@ virCHProcessUpdateConsoleDevice(virDomainObj *vm,
     file = virJSONValueObjectGet(dev, "file");
     if (!file) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("missing 'file' in '%s' from cloud-hypervisor"),
+                       _("missing 'file' in '%1$s' from cloud-hypervisor"),
                        device);
         return;
     }
@@ -83,7 +83,7 @@ virCHProcessUpdateConsoleDevice(virDomainObj *vm,
     path = virJSONValueGetString(file);
     if (!path) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("unable to parse contents of 'file' field in '%s' from cloud-hypervisor"),
+                       _("unable to parse contents of 'file' field in '%1$s' from cloud-hypervisor"),
                        device);
         return;
     }
-- 
2.39.2



More information about the libvir-list mailing list