[PATCH 6/9] error: mark most string arguments for translation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



error: mark most string arguments for translation
Also mark some arguments to __virRaiseError.

Signed-off-by: Jim Meyering <meyering@xxxxxxxxxx>
---
 Makefile.maint        |    4 +-
 po/POTFILES.in        |    2 +
 src/openvz_conf.c     |   42 +++++++++++--------
 src/openvz_driver.c   |   31 +++++++++-----
 src/remote_internal.c |  108 ++++++++++++++++++++++++++++---------------------
 5 files changed, 110 insertions(+), 77 deletions(-)

diff --git a/Makefile.maint b/Makefile.maint
index 6e4868e..fce59b4 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -316,10 +316,12 @@ msg_gen_function += xenXMError
 msg_gen_function += ReportError
 msg_gen_function += qemudReportError

+# Uncomment this after adjusting remaining diagnostics to be translatable.
+# msg_gen_function += error
+
 # msg_gen_function += virXenError
 # msg_gen_function += testError
 # msg_gen_function += openvzLog
-# msg_gen_function += error

 func_or := $(shell printf '$(msg_gen_function)'|tr -s '[[:space:]]' '|')
 func_re := ($(func_or))
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 54cb077..dfdb583 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -8,6 +8,8 @@ src/iptables.c
 src/libvirt.c
 src/lxc_conf.c
 src/lxc_driver.c
+src/openvz_conf.c
+src/openvz_driver.c
 src/proxy_internal.c
 src/qemu_conf.c
 src/qemu_driver.c
diff --git a/src/openvz_conf.c b/src/openvz_conf.c
index 364cb25..4a2b037 100644
--- a/src/openvz_conf.c
+++ b/src/openvz_conf.c
@@ -307,7 +307,7 @@ static struct openvz_vm_def

     root = xmlDocGetRootElement(xml);
     if ((root == NULL) || (!xmlStrEqual(root->name, BAD_CAST "domain"))) {
-        error(conn, VIR_ERR_INTERNAL_ERROR, "incorrect root element");
+        error(conn, VIR_ERR_INTERNAL_ERROR, _("incorrect root element"));
         goto bail_out;
     }

@@ -319,12 +319,12 @@ static struct openvz_vm_def

     /* Find out what type of OPENVZ virtualization to use */
     if (!(prop = xmlGetProp(root, BAD_CAST "type"))) {
-        error(conn, VIR_ERR_INTERNAL_ERROR, "missing domain type attribute");
+        error(conn, VIR_ERR_INTERNAL_ERROR, _("missing domain type attribute"));
         goto bail_out;
     }

     if (strcmp((char *)prop, "openvz")){
-        error(conn, VIR_ERR_INTERNAL_ERROR, "invalid domain type attribute");
+        error(conn, VIR_ERR_INTERNAL_ERROR, _("invalid domain type attribute"_));
         goto bail_out;
     }
     free(prop);
@@ -334,14 +334,14 @@ static struct openvz_vm_def
     obj = xmlXPathEval(BAD_CAST "string(/domain/name[1])", ctxt);
     if ((obj == NULL) || (obj->type != XPATH_STRING) ||
         (obj->stringval == NULL) || (obj->stringval[0] == 0)) {
-        error(conn, VIR_ERR_INTERNAL_ERROR,"invalid domain name");
+        error(conn, VIR_ERR_INTERNAL_ERROR, _("invalid domain name"));
         goto bail_out;
     }

     /* rejecting VPS ID <= OPENVZ_RSRV_VM_LIMIT for they are reserved */
     if (strtoI((const char *) obj->stringval) <= OPENVZ_RSRV_VM_LIMIT) {
         error(conn, VIR_ERR_INTERNAL_ERROR,
-                "VPS ID Error (must be an integer greater than 100");
+	      _("VPS ID Error (must be an integer greater than 100"));
         goto bail_out;
     }
     strncpy(def->name, (const char *) obj->stringval, OPENVZ_NAME_MAX);
@@ -354,11 +354,11 @@ static struct openvz_vm_def
         int err;

         if ((err = virUUIDGenerate(def->uuid))) {
-            error(conn, VIR_ERR_INTERNAL_ERROR, "Failed to generate UUID");
+            error(conn, VIR_ERR_INTERNAL_ERROR, _("Failed to generate UUID"));
             goto bail_out;
         }
     } else if (virUUIDParse((const char *)obj->stringval, def->uuid) < 0) {
-        error(conn, VIR_ERR_INTERNAL_ERROR, "malformed uuid element");
+        error(conn, VIR_ERR_INTERNAL_ERROR, _("malformed uuid element"));
         goto bail_out;
     }
     xmlXPathFreeObject(obj);
@@ -389,7 +389,8 @@ static struct openvz_vm_def
     if (xmlStrlen(obj->stringval) >= (OPENVZ_IP_MAX)) {
         char errorMessage[OPENVZ_MAX_ERROR_LEN];

-        snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "ipaddress length too long");
+        snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s",
+		 _("ipaddress length too long"));
         error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
         goto bail_out;
     }
@@ -411,7 +412,8 @@ static struct openvz_vm_def
     if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
         char errorMessage[OPENVZ_MAX_ERROR_LEN];

-        snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "netmask length too long");
+        snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s",
+		 _("netmask length too long"));
         error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
         goto bail_out;
     }
@@ -427,7 +429,8 @@ static struct openvz_vm_def
     if (strlen((const char *) obj->stringval) >= (OPENVZ_HOSTNAME_MAX - 1)) {
         char errorMessage[OPENVZ_MAX_ERROR_LEN];

-        snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "hostname length too long");
+        snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1,
+		 "%s", _("hostname length too long"));
         error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
         goto bail_out;
     }
@@ -444,7 +447,8 @@ static struct openvz_vm_def
     if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
         char errorMessage[OPENVZ_MAX_ERROR_LEN];

-        snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "gateway length too long");
+        snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1,
+                 "%s", _("gateway length too long"));
         error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
         goto bail_out;
     }
@@ -461,7 +465,8 @@ static struct openvz_vm_def
     if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
         char errorMessage[OPENVZ_MAX_ERROR_LEN];

-        snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "nameserver length too long");
+        snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1,
+                 "%s", _("nameserver length too long"));
         error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
         goto bail_out;
     }
@@ -483,7 +488,8 @@ static struct openvz_vm_def
     if (strlen((const char *) obj->stringval) >= (OPENVZ_PROFILE_MAX - 1)) {
         char errorMessage[OPENVZ_MAX_ERROR_LEN];

-        snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "profile length too long");
+        snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1,
+                 "%s", _("profile length too long"));
         error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
         goto bail_out;
     }
@@ -519,14 +525,14 @@ openvzGetVPSInfo(virConnectPtr conn) {
     driver->num_inactive = 0;

     if((fp = popen(VZLIST " -a -ovpsid,status -H 2>/dev/null", "r")) == NULL) {
-        error(conn, VIR_ERR_INTERNAL_ERROR, "popen failed");
+        error(conn, VIR_ERR_INTERNAL_ERROR, _("popen failed"));
         return NULL;
     }
     pnext = &vm;
     while(!feof(fp)) {
         *pnext = calloc(1, sizeof(**pnext));
         if(!*pnext) {
-            error(conn, VIR_ERR_INTERNAL_ERROR, "calloc failed");
+            error(conn, VIR_ERR_INTERNAL_ERROR, _("calloc failed"));
             goto error;
         }

@@ -535,7 +541,7 @@ openvzGetVPSInfo(virConnectPtr conn) {

         if (fscanf(fp, "%d %s\n", &veid, status) != 2) {
 	    error(conn, VIR_ERR_INTERNAL_ERROR,
-	          "Failed to parse vzlist output");
+	          _("Failed to parse vzlist output"));
 	    goto error;
 	}
         if(strcmp(status, "stopped")) {
@@ -555,7 +561,7 @@ openvzGetVPSInfo(virConnectPtr conn) {

         vmdef = calloc(1, sizeof(*vmdef));
         if(!vmdef) {
-            error(conn, VIR_ERR_INTERNAL_ERROR, "calloc failed");
+            error(conn, VIR_ERR_INTERNAL_ERROR, _("calloc failed"));
 	    goto error;
         }

@@ -565,7 +571,7 @@ openvzGetVPSInfo(virConnectPtr conn) {

         if(ret == -1) {
             error(conn, VIR_ERR_INTERNAL_ERROR,
-	          "UUID in config file malformed");
+	          _("UUID in config file malformed"));
 	    free(vmdef);
             goto error;
         }
diff --git a/src/openvz_driver.c b/src/openvz_driver.c
index 29cb244..0e94d02 100644
--- a/src/openvz_driver.c
+++ b/src/openvz_driver.c
@@ -146,7 +146,7 @@ static virDomainPtr openvzDomainLookupByID(virConnectPtr conn,
     virDomainPtr dom;

     if (!vm) {
-        error(conn, VIR_ERR_INTERNAL_ERROR, "no domain with matching id");
+        error(conn, VIR_ERR_INTERNAL_ERROR, _("no domain with matching id"));
         return NULL;
     }

@@ -174,7 +174,7 @@ static virDomainPtr openvzDomainLookupByUUID(virConnectPtr conn,
     virDomainPtr dom;

     if (!vm) {
-        error(conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+        error(conn, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid"));
         return NULL;
     }

@@ -195,7 +195,7 @@ static virDomainPtr openvzDomainLookupByName(virConnectPtr conn,
     virDomainPtr dom;

     if (!vm) {
-        error(conn, VIR_ERR_INTERNAL_ERROR, "no domain with matching name");
+        error(conn, VIR_ERR_INTERNAL_ERROR, _("no domain with matching name"));
         return NULL;
     }

@@ -215,7 +215,8 @@ static int openvzDomainGetInfo(virDomainPtr dom,
     struct openvz_vm *vm = openvzFindVMByUUID(driver, dom->uuid);

     if (!vm) {
-        error(dom->conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+        error(dom->conn, VIR_ERR_INVALID_DOMAIN,
+              _("no domain with matching uuid"));
         return -1;
     }

@@ -238,12 +239,14 @@ static int openvzDomainShutdown(virDomainPtr dom) {
     struct openvz_vm *vm = openvzFindVMByID(driver, dom->id);

     if (!vm) {
-        error(dom->conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching id");
+        error(dom->conn, VIR_ERR_INVALID_DOMAIN,
+              _("no domain with matching id"));
         return -1;
     }

     if (vm->status != VIR_DOMAIN_RUNNING) {
-        error(dom->conn, VIR_ERR_OPERATION_DENIED, "domain is not in running state");
+        error(dom->conn, VIR_ERR_OPERATION_DENIED,
+              _("domain is not in running state"));
         return -1;
     }
     snprintf(cmdbuf, CMDBUF_LEN - 1, VZCTL " stop %d ", dom->id);
@@ -281,12 +284,14 @@ static int openvzDomainReboot(virDomainPtr dom,
     struct openvz_vm *vm = openvzFindVMByID(driver, dom->id);

     if (!vm) {
-        error(dom->conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching id");
+        error(dom->conn, VIR_ERR_INVALID_DOMAIN,
+              _("no domain with matching id"));
         return -1;
     }

     if (vm->status != VIR_DOMAIN_RUNNING) {
-        error(dom->conn, VIR_ERR_OPERATION_DENIED, "domain is not in running state");
+        error(dom->conn, VIR_ERR_OPERATION_DENIED,
+              _("domain is not in running state"));
         return -1;
     }
     snprintf(cmdbuf, CMDBUF_LEN - 1, VZCTL " restart %d ", dom->id);
@@ -473,12 +478,14 @@ openvzDomainCreate(virDomainPtr dom)
     struct openvz_vm_def *vmdef;

     if (!vm) {
-        error(dom->conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching id");
+        error(dom->conn, VIR_ERR_INVALID_DOMAIN,
+              _("no domain with matching id"));
         return -1;
     }

     if (vm->status != VIR_DOMAIN_SHUTOFF) {
-        error(dom->conn, VIR_ERR_OPERATION_DENIED, "domain is not in shutoff state");
+        error(dom->conn, VIR_ERR_OPERATION_DENIED,
+              _("domain is not in shutoff state"));
         return -1;
     }

@@ -518,12 +525,12 @@ openvzDomainUndefine(virDomainPtr dom)
     struct openvz_vm *vm = openvzFindVMByUUID(driver, dom->uuid);

     if (!vm) {
-        error(conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+        error(conn, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid"));
         return -1;
     }

     if (openvzIsActiveVM(vm)) {
-        error(conn, VIR_ERR_INTERNAL_ERROR, "cannot delete active domain");
+        error(conn, VIR_ERR_INTERNAL_ERROR, _("cannot delete active domain"));
         return -1;
     }
     snprintf(cmdbuf, CMDBUF_LEN - 1, VZCTL " destroy %s ", vm->vmdef->name);
diff --git a/src/remote_internal.c b/src/remote_internal.c
index 8d2d9e5..be4c573 100644
--- a/src/remote_internal.c
+++ b/src/remote_internal.c
@@ -879,7 +879,7 @@ check_cert_file (virConnectPtr conn, const char *type, const char *file)
     if (stat(file, &sb) < 0) {
         __virRaiseError (conn, NULL, NULL, VIR_FROM_REMOTE, VIR_ERR_RPC,
                          VIR_ERR_ERROR, LIBVIRT_CACERT, NULL, NULL, 0, 0,
-                         "Cannot access %s '%s': %s (%d)",
+                         _("Cannot access %s '%s': %s (%d)"),
                          type, file, strerror(errno), errno);
         return -1;
     }
@@ -1018,7 +1018,7 @@ negotiate_gnutls_on_connection (virConnectPtr conn,
     }
     if (len != 1 || buf[0] != '\1') {
         error (conn, VIR_ERR_RPC,
-               "server verification (of our certificate or IP address) failed\n");
+          _("server verification (of our certificate or IP address) failed\n"));
         return NULL;
     }

@@ -1117,7 +1117,7 @@ verify_certificate (virConnectPtr conn ATTRIBUTE_UNUSED,
                      VIR_FROM_REMOTE, VIR_ERR_RPC,
                      VIR_ERR_ERROR, priv->hostname, NULL, NULL,
                      0, 0,
-                     "Certificate's owner does not match the hostname (%s)",
+                     _("Certificate's owner does not match the hostname (%s)"),
                      priv->hostname);
                 gnutls_x509_crt_deinit (cert);
                 return -1;
@@ -3473,8 +3473,9 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv, int in_open,
             want = REMOTE_AUTH_POLKIT;
         } else {
             __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
-                             VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                             "unknown authentication type %s", authtype);
+                             VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
+                             NULL, NULL, NULL, 0, 0,
+                             _("unknown authentication type %s"), authtype);
             return -1;
         }
         for (i = 0 ; i < ret.types.types_len ; i++) {
@@ -3484,7 +3485,8 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv, int in_open,
         if (type == REMOTE_AUTH_NONE) {
             __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
                              VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                             "requested authentication type %s rejected", authtype);
+                             _("requested authentication type %s rejected"),
+                             authtype);
             return -1;
         }
     } else {
@@ -3522,8 +3524,10 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv, int in_open,

     default:
         __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
-                         VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                         "unsupported authentication type %d", ret.types.types_val[0]);
+                         VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
+                         NULL, NULL, NULL, 0, 0,
+                         _("unsupported authentication type %d"),
+                         ret.types.types_val[0]);
         free(ret.types.types_val);
         return -1;
     }
@@ -3550,15 +3554,18 @@ static char *addrToString(struct sockaddr_storage *sa, socklen_t salen)
                            port, sizeof(port),
                            NI_NUMERICHOST | NI_NUMERICSERV)) != 0) {
         __virRaiseError (NULL, NULL, NULL, VIR_FROM_REMOTE,
-                         VIR_ERR_NO_MEMORY, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                         "Cannot resolve address %d: %s", err, gai_strerror(err));
+                         VIR_ERR_NO_MEMORY, VIR_ERR_ERROR,
+                         NULL, NULL, NULL, 0, 0,
+                         _("Cannot resolve address %d: %s"),
+                         err, gai_strerror(err));
         return NULL;
     }

     addr = malloc(strlen(host) + 1 + strlen(port) + 1);
     if (!addr) {
         __virRaiseError (NULL, NULL, NULL, VIR_FROM_REMOTE,
-                         VIR_ERR_NO_MEMORY, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
+                         VIR_ERR_NO_MEMORY, VIR_ERR_ERROR,
+                         NULL, NULL, NULL, 0, 0,
                          "address");
         return NULL;
     }
@@ -3769,7 +3776,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
     if (err != SASL_OK) {
         __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
                          VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                         "failed to initialize SASL library: %d (%s)",
+                         _("failed to initialize SASL library: %d (%s)"),
                          err, sasl_errstring(err, NULL, NULL));
         goto cleanup;
     }
@@ -3779,7 +3786,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
     if (getsockname(priv->sock, (struct sockaddr*)&sa, &salen) < 0) {
         __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
                          VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                         "failed to get sock address %d (%s)",
+                         _("failed to get sock address %d (%s)"),
                          socket_errno (), strerror(socket_errno ()));
         goto cleanup;
     }
@@ -3791,7 +3798,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
     if (getpeername(priv->sock, (struct sockaddr*)&sa, &salen) < 0) {
         __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
                          VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                         "failed to get peer address %d (%s)",
+                         _("failed to get peer address %d (%s)"),
                          socket_errno (), strerror(socket_errno ()));
         goto cleanup;
     }
@@ -3817,7 +3824,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
     if (err != SASL_OK) {
         __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
                          VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                         "Failed to create SASL client context: %d (%s)",
+                         _("Failed to create SASL client context: %d (%s)"),
                          err, sasl_errstring(err, NULL, NULL));
         goto cleanup;
     }
@@ -3830,7 +3837,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
         if (!(ssf = (sasl_ssf_t)gnutls_cipher_get_key_size(cipher))) {
             __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
                              VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                             "invalid cipher size for TLS session");
+                             "%s", _("invalid cipher size for TLS session"));
             goto cleanup;
         }
         ssf *= 8; /* key size is bytes, sasl wants bits */
@@ -3840,7 +3847,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
         if (err != SASL_OK) {
             __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
                              VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                             "cannot set external SSF %d (%s)",
+                             _("cannot set external SSF %d (%s)"),
                              err, sasl_errstring(err, NULL, NULL));
             goto cleanup;
         }
@@ -3859,7 +3866,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
     if (err != SASL_OK) {
         __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
                          VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                         "cannot set security props %d (%s)",
+                         _("cannot set security props %d (%s)"),
                          err, sasl_errstring(err, NULL, NULL));
         goto cleanup;
     }
@@ -3876,8 +3883,10 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
     if (wantmech) {
         if (strstr(mechlist, wantmech) == NULL) {
             __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
-                             VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                             "SASL mechanism %s not supported by server", wantmech);
+                             VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
+                             NULL, NULL, NULL, 0, 0,
+                             _("SASL mechanism %s not supported by server"),
+                             wantmech);
             free(iret.mechlist);
             goto cleanup;
         }
@@ -3895,7 +3904,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
     if (err != SASL_OK && err != SASL_CONTINUE && err != SASL_INTERACT) {
         __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
                          VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                         "Failed to start SASL negotiation: %d (%s)",
+                         _("Failed to start SASL negotiation: %d (%s)"),
                          err, sasl_errdetail(saslconn));
         free(iret.mechlist);
         goto cleanup;
@@ -3911,8 +3920,9 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
         if ((ncred =
              remoteAuthMakeCredentials(interact, &cred)) < 0) {
             __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
-                             VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                             "Failed to make auth credentials");
+                             VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
+                             NULL, NULL, NULL, 0, 0,
+                             "%s", _("Failed to make auth credentials"));
             free(iret.mechlist);
             goto cleanup;
         }
@@ -3936,7 +3946,8 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
     if (clientoutlen > REMOTE_AUTH_SASL_DATA_MAX) {
         __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
                          VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                         "SASL negotiation data too long: %d bytes", clientoutlen);
+                         _("SASL negotiation data too long: %d bytes"),
+                         clientoutlen);
         goto cleanup;
     }
     /* NB, distinction of NULL vs "" is *critical* in SASL */
@@ -3975,7 +3986,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
         if (err != SASL_OK && err != SASL_CONTINUE && err != SASL_INTERACT) {
             __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
                              VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                             "Failed SASL step: %d (%s)",
+                             _("Failed SASL step: %d (%s)"),
                              err, sasl_errdetail(saslconn));
             goto cleanup;
         }
@@ -3989,7 +4000,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
             if ((ncred = remoteAuthMakeCredentials(interact, &cred)) < 0) {
                 __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
                                  VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                                 "Failed to make auth credentials");
+                                 "%s", _("Failed to make auth credentials"));
                 goto cleanup;
             }
             /* Run the authentication callback */
@@ -4053,7 +4064,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
         if (err != SASL_OK) {
             __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
                              VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                             "cannot query SASL ssf on connection %d (%s)",
+                             _("cannot query SASL ssf on connection %d (%s)"),
                              err, sasl_errstring(err, NULL, NULL));
             goto cleanup;
         }
@@ -4062,7 +4073,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
         if (ssf < 56) { /* 56 == DES level, good for Kerberos */
             __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
                              VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                             "negotiation SSF %d was not strong enough", ssf);
+                             _("negotiation SSF %d was not strong enough"), ssf);
             goto cleanup;
         }
     }
@@ -4116,7 +4127,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open,
             if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) {
                 __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
                                  VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                                 "Failed to collect auth credentials");
+                                 _("Failed to collect auth credentials"));
                 return -1;
             }
         } else {
@@ -4183,7 +4194,7 @@ call (virConnectPtr conn, struct private_data *priv,
     xdrmem_create (&xdr, buffer, sizeof buffer, XDR_ENCODE);
     if (!xdr_remote_message_header (&xdr, &hdr)) {
         error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
-               VIR_ERR_RPC, "xdr_remote_message_header");
+               VIR_ERR_RPC, _("xdr_remote_message_header failed"));
         return -1;
     }

@@ -4205,7 +4216,8 @@ call (virConnectPtr conn, struct private_data *priv,
     /* Encode the length word. */
     xdrmem_create (&xdr, buffer2, sizeof buffer2, XDR_ENCODE);
     if (!xdr_int (&xdr, &len)) {
-        error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, VIR_ERR_RPC, _("xdr_int (length word)"));
+        error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, VIR_ERR_RPC,
+               _("xdr_int (length word)"));
         return -1;
     }
     xdr_destroy (&xdr);
@@ -4222,7 +4234,7 @@ call (virConnectPtr conn, struct private_data *priv,
     xdrmem_create (&xdr, buffer2, sizeof buffer2, XDR_DECODE);
     if (!xdr_int (&xdr, &len)) {
         error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
-               VIR_ERR_RPC, "xdr_int (length word, reply)");
+               VIR_ERR_RPC, _("xdr_int (length word, reply)"));
         return -1;
     }
     xdr_destroy (&xdr);
@@ -4232,7 +4244,7 @@ call (virConnectPtr conn, struct private_data *priv,

     if (len < 0 || len > REMOTE_MESSAGE_MAX) {
         error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
-               VIR_ERR_RPC, "packet received from server too large");
+               VIR_ERR_RPC, _("packet received from server too large"));
         return -1;
     }

@@ -4244,22 +4256,24 @@ call (virConnectPtr conn, struct private_data *priv,
     xdrmem_create (&xdr, buffer, len, XDR_DECODE);
     if (!xdr_remote_message_header (&xdr, &hdr)) {
         error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
-               VIR_ERR_RPC, "xdr_remote_message_header (reply)");
+               VIR_ERR_RPC, _("invalid header in reply"));
         return -1;
     }

     /* Check program, version, etc. are what we expect. */
     if (hdr.prog != REMOTE_PROGRAM) {
-        __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
+        __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
+                         NULL, NULL, VIR_FROM_REMOTE,
                          VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                         "unknown program (received %x, expected %x)",
+                         _("unknown program (received %x, expected %x)"),
                          hdr.prog, REMOTE_PROGRAM);
         return -1;
     }
     if (hdr.vers != REMOTE_PROTOCOL_VERSION) {
-        __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
+        __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
+                         NULL, NULL, VIR_FROM_REMOTE,
                          VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                         "unknown protocol version (received %x, expected %x)",
+                         _("unknown protocol version (received %x, expected %x)"),
                          hdr.vers, REMOTE_PROTOCOL_VERSION);
         return -1;
     }
@@ -4269,23 +4283,25 @@ call (virConnectPtr conn, struct private_data *priv,
      * message being received at this point.
      */
     if (hdr.proc != proc_nr) {
-        __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
+        __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
+                         NULL, NULL, VIR_FROM_REMOTE,
                          VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                         "unknown procedure (received %x, expected %x)",
+                         _("unknown procedure (received %x, expected %x)"),
                          hdr.proc, proc_nr);
         return -1;
     }
     if (hdr.direction != REMOTE_REPLY) {
-        __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
+        __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
+                         NULL, NULL, VIR_FROM_REMOTE,
                          VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                         "unknown direction (received %x, expected %x)",
+                         _("unknown direction (received %x, expected %x)"),
                          hdr.direction, REMOTE_REPLY);
         return -1;
     }
     if (hdr.serial != serial) {
         __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
                          VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                         "unknown serial (received %x, expected %x)",
+                         _("unknown serial (received %x, expected %x)"),
                          hdr.serial, serial);
         return -1;
     }
@@ -4328,7 +4344,7 @@ call (virConnectPtr conn, struct private_data *priv,
     default:
         __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
                          VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                         "unknown status (received %x)",
+                         _("unknown status (received %x)"),
                          hdr.status);
         xdr_destroy (&xdr);
         return -1;
@@ -4437,7 +4453,7 @@ really_read_buf (virConnectPtr conn, struct private_data *priv,
         }
         if (err == 0) {
             error (in_open ? NULL : conn,
-                   VIR_ERR_RPC, "socket closed unexpectedly");
+                   VIR_ERR_RPC, _("socket closed unexpectedly"));
             return -1;
         }
         return err;
@@ -4454,7 +4470,7 @@ really_read_buf (virConnectPtr conn, struct private_data *priv,
         }
         if (err == 0) {
             error (in_open ? NULL : conn,
-                   VIR_ERR_RPC, "socket closed unexpectedly");
+                   VIR_ERR_RPC, _("socket closed unexpectedly"));
             return -1;
         }
         return err;
--
1.5.5.rc0.22.g467c

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]