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

[Libvir] [PATCH 7/9] openvzLog: mark its string arguments for translation



openvzLog: mark its string arguments for translation

Signed-off-by: Jim Meyering <meyering redhat com>
---
 Makefile.maint      |    2 +-
 src/openvz_conf.c   |   35 ++++++++++++++++++++++-------------
 src/openvz_driver.c |   25 +++++++++++++------------
 3 files changed, 36 insertions(+), 26 deletions(-)

diff --git a/Makefile.maint b/Makefile.maint
index fce59b4..55a9677 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -315,13 +315,13 @@ msg_gen_function += virStorageLog
 msg_gen_function += xenXMError
 msg_gen_function += ReportError
 msg_gen_function += qemudReportError
+msg_gen_function += openvzLog

 # 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

 func_or := $(shell printf '$(msg_gen_function)'|tr -s '[[:space:]]' '|')
 func_re := ($(func_or))
diff --git a/src/openvz_conf.c b/src/openvz_conf.c
index 4a2b037..65344c5 100644
--- a/src/openvz_conf.c
+++ b/src/openvz_conf.c
@@ -237,8 +237,9 @@ openvzAssignVMDef(virConnectPtr conn,
         }
         else
         {
-            openvzLog(OPENVZ_ERR, "Error already an active OPENVZ VM having id '%s'",
-                    def->name);
+            openvzLog(OPENVZ_ERR,
+		      _("Error already an active OPENVZ VM having id '%s'"),
+		      def->name);
             openvzFreeVMDef(def);
             return NULL; /* can't redefine an active domain */
         }
@@ -383,8 +384,9 @@ static struct openvz_vm_def
     obj = xmlXPathEval(BAD_CAST"string(/domain/container/network/ipaddress[1])", ctxt);
     if ((obj == NULL) || (obj->type != XPATH_STRING) || (obj->stringval == NULL)
             || (obj->stringval[0] == 0)) {
-        openvzLog(OPENVZ_WARN, "No IP address in the given xml config file '%s'",
-                xml->name);
+        openvzLog(OPENVZ_WARN,
+		  _("No IP address in the given xml config file '%s'"),
+		  xml->name);
     }
     if (xmlStrlen(obj->stringval) >= (OPENVZ_IP_MAX)) {
         char errorMessage[OPENVZ_MAX_ERROR_LEN];
@@ -395,7 +397,8 @@ static struct openvz_vm_def
         goto bail_out;
     }
     if (!(ovzIp = calloc(1, sizeof(*ovzIp)))) {
-        openvzLog(OPENVZ_ERR, "Failed to Create Memory for 'ovz_ip' structure");
+        openvzLog(OPENVZ_ERR,
+		  _("Failed to Create Memory for 'ovz_ip' structure"));
         goto bail_out;
     }
     strncpy(ovzIp->ip, (const char *) obj->stringval, OPENVZ_IP_MAX);
@@ -406,8 +409,9 @@ static struct openvz_vm_def
     obj = xmlXPathEval(BAD_CAST "string(/domain/container/network/netmask[1])", ctxt);
     if ((obj == NULL) || (obj->type != XPATH_STRING)
         || (obj->stringval == NULL) || (obj->stringval[0] == 0))
-        openvzLog(OPENVZ_WARN, "No Netmask address in the given xml config file '%s'",
-                xml->name);
+        openvzLog(OPENVZ_WARN,
+		  _("No Netmask address in the given xml config file '%s'"),
+		  xml->name);

     if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
         char errorMessage[OPENVZ_MAX_ERROR_LEN];
@@ -424,7 +428,9 @@ static struct openvz_vm_def
     obj = xmlXPathEval(BAD_CAST "string(/domain/container/network/hostname[1])", ctxt);
     if ((obj == NULL) || (obj->type != XPATH_STRING) || (obj->stringval == NULL)
             || (obj->stringval[0] == 0))
-        openvzLog(OPENVZ_WARN, "No hostname in the given xml config file '%s'", xml->name);
+        openvzLog(OPENVZ_WARN,
+		  _("No hostname in the given xml config file '%s'"),
+		  xml->name);

     if (strlen((const char *) obj->stringval) >= (OPENVZ_HOSTNAME_MAX - 1)) {
         char errorMessage[OPENVZ_MAX_ERROR_LEN];
@@ -441,8 +447,9 @@ static struct openvz_vm_def
     obj = xmlXPathEval(BAD_CAST"string(/domain/container/network/gateway[1])", ctxt);
     if ((obj == NULL) || (obj->type != XPATH_STRING) || (obj->stringval == NULL)
             || (obj->stringval[0] == 0))
-        openvzLog(OPENVZ_WARN, "No Gateway address in the given xml config file '%s'",
-                xml->name);
+        openvzLog(OPENVZ_WARN,
+		  _("No Gateway address in the given xml config file '%s'"),
+		  xml->name);

     if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
         char errorMessage[OPENVZ_MAX_ERROR_LEN];
@@ -459,8 +466,9 @@ static struct openvz_vm_def
     obj = xmlXPathEval(BAD_CAST "string(/domain/container/network/nameserver[1])", ctxt);
     if ((obj == NULL) || (obj->type != XPATH_STRING) || (obj->stringval == NULL)
             || (obj->stringval[0] == 0))
-        openvzLog(OPENVZ_WARN, "No Nameserver address inthe given xml config file '%s'",
-                xml->name);
+        openvzLog(OPENVZ_WARN,
+		  _("No Nameserver address inthe given xml config file '%s'"),
+		  xml->name);

     if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
         char errorMessage[OPENVZ_MAX_ERROR_LEN];
@@ -471,7 +479,8 @@ static struct openvz_vm_def
         goto bail_out;
     }
     if (!(ovzNs = calloc(1, sizeof(*ovzNs)))) {
-        openvzLog(OPENVZ_ERR, "Failed to Create Memory for 'ovz_ns' structure");
+        openvzLog(OPENVZ_ERR,
+                  _("Failed to Create Memory for 'ovz_ns' structure"));
         goto bail_out;
     }
     strncpy(ovzNs->ip, (const char *) obj->stringval, OPENVZ_IP_MAX);
diff --git a/src/openvz_driver.c b/src/openvz_driver.c
index 0e94d02..1db3c60 100644
--- a/src/openvz_driver.c
+++ b/src/openvz_driver.c
@@ -253,7 +253,7 @@ static int openvzDomainShutdown(virDomainPtr dom) {

     if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
     {
-        openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
+        openvzLog(OPENVZ_ERR, "%s", _("Error in parsing Options to OPENVZ"));
         goto bail_out;
     }

@@ -298,7 +298,7 @@ static int openvzDomainReboot(virDomainPtr dom,

     if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
     {
-        openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
+        openvzLog(OPENVZ_ERR, "%s", _("Error in parsing Options to OPENVZ"));
         goto bail_out1;
     }
     ret = virExec(dom->conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
@@ -328,13 +328,13 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)

     vm = openvzFindVMByID(driver, strtoI(vmdef->name));
     if (vm) {
-        openvzLog(OPENVZ_ERR, "Already an OPENVZ VM active with the id '%s'",
-                vmdef->name);
+        openvzLog(OPENVZ_ERR, _("Already an OPENVZ VM active with the id '%s'"),
+                  vmdef->name);
         goto bail_out2;
     }
     if (!(vm = openvzAssignVMDef(conn, driver, vmdef))) {
         openvzFreeVMDef(vmdef);
-        openvzLog(OPENVZ_ERR, "Error creating OPENVZ VM");
+        openvzLog(OPENVZ_ERR, "%s", _("Error creating OPENVZ VM"));
     }

     snprintf(cmdbuf, CMDBUF_LEN - 1, VZCTL " create %s", vmdef->name);
@@ -357,7 +357,7 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)

     if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
     {
-        openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
+        openvzLog(OPENVZ_ERR, "%s", _("Error in parsing Options to OPENVZ"));
         goto bail_out2;
     }
     ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
@@ -395,12 +395,13 @@ openvzDomainCreateLinux(virConnectPtr conn, const char *xml,
     vm = openvzFindVMByID(driver, strtoI(vmdef->name));
     if (vm) {
         openvzFreeVMDef(vmdef);
-        openvzLog(OPENVZ_ERR, "Already an OPENVZ VM defined with the id '%d'",
+        openvzLog(OPENVZ_ERR,
+                  _("Already an OPENVZ VM defined with the id '%d'"),
                 strtoI(vmdef->name));
         return NULL;
     }
     if (!(vm = openvzAssignVMDef(conn, driver, vmdef))) {
-        openvzLog(OPENVZ_ERR, "Error creating OPENVZ VM");
+        openvzLog(OPENVZ_ERR, "%s", _("Error creating OPENVZ VM"));
         return NULL;
     }

@@ -424,7 +425,7 @@ openvzDomainCreateLinux(virConnectPtr conn, const char *xml,

     if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
     {
-        openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
+        openvzLog(OPENVZ_ERR, "%s", _("Error in parsing Options to OPENVZ"));
         goto bail_out3;
     }
     ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
@@ -440,7 +441,7 @@ openvzDomainCreateLinux(virConnectPtr conn, const char *xml,

     if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
     {
-        openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
+        openvzLog(OPENVZ_ERR, "%s", _("Error in parsing Options to OPENVZ"));
         goto bail_out3;
     }
     ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
@@ -494,7 +495,7 @@ openvzDomainCreate(virDomainPtr dom)

     if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
     {
-        openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
+        openvzLog(OPENVZ_ERR, "%s", _("Error in parsing Options to OPENVZ"));
         goto bail_out4;
     }
     ret = virExec(dom->conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
@@ -537,7 +538,7 @@ openvzDomainUndefine(virDomainPtr dom)

     if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
     {
-        openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
+        openvzLog(OPENVZ_ERR, "%s", _("Error in parsing Options to OPENVZ"));
         goto bail_out5;
     }
     ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
--
1.5.5.rc0.22.g467c


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