openvzLog: mark its string arguments for translation

* Makefile.maint (msg_gen_function): Add openvzLog.
* src/openvz_conf.c (openvzAssignVMDef, openvzParseXML): Mark strings.
* src/openvz_driver.c (openvzDomainShutdown, openvzDomainReboot):
(openvzDomainDefineXML, openvzDomainCreateLinux):
(openvzDomainCreate, openvzDomainUndefine): Likewise.
This commit is contained in:
Jim Meyering 2008-03-27 14:00:28 +00:00
parent 5bb81e1d87
commit 7f8639261a
4 changed files with 43 additions and 26 deletions

View File

@ -1,5 +1,12 @@
Thu Mar 27 14:36:56 CET 2008 Jim Meyering <meyering@redhat.com> Thu Mar 27 14:36:56 CET 2008 Jim Meyering <meyering@redhat.com>
openvzLog: mark its string arguments for translation
* Makefile.maint (msg_gen_function): Add openvzLog.
* src/openvz_conf.c (openvzAssignVMDef, openvzParseXML): Mark strings.
* src/openvz_driver.c (openvzDomainShutdown, openvzDomainReboot):
(openvzDomainDefineXML, openvzDomainCreateLinux):
(openvzDomainCreate, openvzDomainUndefine): Likewise.
error: mark most string arguments for translation error: mark most string arguments for translation
Also mark some arguments to __virRaiseError. Also mark some arguments to __virRaiseError.
* Makefile.maint (msg_gen_function): Add error. * Makefile.maint (msg_gen_function): Add error.

View File

@ -315,13 +315,13 @@ msg_gen_function += virStorageLog
msg_gen_function += xenXMError msg_gen_function += xenXMError
msg_gen_function += ReportError msg_gen_function += ReportError
msg_gen_function += qemudReportError msg_gen_function += qemudReportError
msg_gen_function += openvzLog
# Uncomment this after adjusting remaining diagnostics to be translatable. # Uncomment this after adjusting remaining diagnostics to be translatable.
# msg_gen_function += error # msg_gen_function += error
# msg_gen_function += virXenError # msg_gen_function += virXenError
# msg_gen_function += testError # msg_gen_function += testError
# msg_gen_function += openvzLog
func_or := $(shell printf '$(msg_gen_function)'|tr -s '[[:space:]]' '|') func_or := $(shell printf '$(msg_gen_function)'|tr -s '[[:space:]]' '|')
func_re := ($(func_or)) func_re := ($(func_or))

View File

@ -237,7 +237,8 @@ openvzAssignVMDef(virConnectPtr conn,
} }
else else
{ {
openvzLog(OPENVZ_ERR, "Error already an active OPENVZ VM having id '%s'", openvzLog(OPENVZ_ERR,
_("Error already an active OPENVZ VM having id '%s'"),
def->name); def->name);
openvzFreeVMDef(def); openvzFreeVMDef(def);
return NULL; /* can't redefine an active domain */ return NULL; /* can't redefine an active domain */
@ -383,7 +384,8 @@ static struct openvz_vm_def
obj = xmlXPathEval(BAD_CAST"string(/domain/container/network/ipaddress[1])", ctxt); obj = xmlXPathEval(BAD_CAST"string(/domain/container/network/ipaddress[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING) || (obj->stringval == NULL) if ((obj == NULL) || (obj->type != XPATH_STRING) || (obj->stringval == NULL)
|| (obj->stringval[0] == 0)) { || (obj->stringval[0] == 0)) {
openvzLog(OPENVZ_WARN, "No IP address in the given xml config file '%s'", openvzLog(OPENVZ_WARN,
_("No IP address in the given xml config file '%s'"),
xml->name); xml->name);
} }
if (xmlStrlen(obj->stringval) >= (OPENVZ_IP_MAX)) { if (xmlStrlen(obj->stringval) >= (OPENVZ_IP_MAX)) {
@ -395,7 +397,8 @@ static struct openvz_vm_def
goto bail_out; goto bail_out;
} }
if (!(ovzIp = calloc(1, sizeof(*ovzIp)))) { 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; goto bail_out;
} }
strncpy(ovzIp->ip, (const char *) obj->stringval, OPENVZ_IP_MAX); strncpy(ovzIp->ip, (const char *) obj->stringval, OPENVZ_IP_MAX);
@ -406,7 +409,8 @@ static struct openvz_vm_def
obj = xmlXPathEval(BAD_CAST "string(/domain/container/network/netmask[1])", ctxt); obj = xmlXPathEval(BAD_CAST "string(/domain/container/network/netmask[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING) if ((obj == NULL) || (obj->type != XPATH_STRING)
|| (obj->stringval == NULL) || (obj->stringval[0] == 0)) || (obj->stringval == NULL) || (obj->stringval[0] == 0))
openvzLog(OPENVZ_WARN, "No Netmask address in the given xml config file '%s'", openvzLog(OPENVZ_WARN,
_("No Netmask address in the given xml config file '%s'"),
xml->name); xml->name);
if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) { if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
@ -424,7 +428,9 @@ static struct openvz_vm_def
obj = xmlXPathEval(BAD_CAST "string(/domain/container/network/hostname[1])", ctxt); obj = xmlXPathEval(BAD_CAST "string(/domain/container/network/hostname[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING) || (obj->stringval == NULL) if ((obj == NULL) || (obj->type != XPATH_STRING) || (obj->stringval == NULL)
|| (obj->stringval[0] == 0)) || (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)) { if (strlen((const char *) obj->stringval) >= (OPENVZ_HOSTNAME_MAX - 1)) {
char errorMessage[OPENVZ_MAX_ERROR_LEN]; char errorMessage[OPENVZ_MAX_ERROR_LEN];
@ -441,7 +447,8 @@ static struct openvz_vm_def
obj = xmlXPathEval(BAD_CAST"string(/domain/container/network/gateway[1])", ctxt); obj = xmlXPathEval(BAD_CAST"string(/domain/container/network/gateway[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING) || (obj->stringval == NULL) if ((obj == NULL) || (obj->type != XPATH_STRING) || (obj->stringval == NULL)
|| (obj->stringval[0] == 0)) || (obj->stringval[0] == 0))
openvzLog(OPENVZ_WARN, "No Gateway address in the given xml config file '%s'", openvzLog(OPENVZ_WARN,
_("No Gateway address in the given xml config file '%s'"),
xml->name); xml->name);
if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) { if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
@ -459,7 +466,8 @@ static struct openvz_vm_def
obj = xmlXPathEval(BAD_CAST "string(/domain/container/network/nameserver[1])", ctxt); obj = xmlXPathEval(BAD_CAST "string(/domain/container/network/nameserver[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING) || (obj->stringval == NULL) if ((obj == NULL) || (obj->type != XPATH_STRING) || (obj->stringval == NULL)
|| (obj->stringval[0] == 0)) || (obj->stringval[0] == 0))
openvzLog(OPENVZ_WARN, "No Nameserver address inthe given xml config file '%s'", openvzLog(OPENVZ_WARN,
_("No Nameserver address inthe given xml config file '%s'"),
xml->name); xml->name);
if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) { if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
@ -471,7 +479,8 @@ static struct openvz_vm_def
goto bail_out; goto bail_out;
} }
if (!(ovzNs = calloc(1, sizeof(*ovzNs)))) { 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; goto bail_out;
} }
strncpy(ovzNs->ip, (const char *) obj->stringval, OPENVZ_IP_MAX); strncpy(ovzNs->ip, (const char *) obj->stringval, OPENVZ_IP_MAX);

View File

@ -253,7 +253,7 @@ static int openvzDomainShutdown(virDomainPtr dom) {
if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1) 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; goto bail_out;
} }
@ -298,7 +298,7 @@ static int openvzDomainReboot(virDomainPtr dom,
if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1) 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; goto bail_out1;
} }
ret = virExec(dom->conn, (char **)cmdExec, &pid, -1, &outfd, &errfd); 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)); vm = openvzFindVMByID(driver, strtoI(vmdef->name));
if (vm) { if (vm) {
openvzLog(OPENVZ_ERR, "Already an OPENVZ VM active with the id '%s'", openvzLog(OPENVZ_ERR, _("Already an OPENVZ VM active with the id '%s'"),
vmdef->name); vmdef->name);
goto bail_out2; goto bail_out2;
} }
if (!(vm = openvzAssignVMDef(conn, driver, vmdef))) { if (!(vm = openvzAssignVMDef(conn, driver, vmdef))) {
openvzFreeVMDef(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); 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) 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; goto bail_out2;
} }
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd); 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)); vm = openvzFindVMByID(driver, strtoI(vmdef->name));
if (vm) { if (vm) {
openvzFreeVMDef(vmdef); 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)); strtoI(vmdef->name));
return NULL; return NULL;
} }
if (!(vm = openvzAssignVMDef(conn, driver, vmdef))) { if (!(vm = openvzAssignVMDef(conn, driver, vmdef))) {
openvzLog(OPENVZ_ERR, "Error creating OPENVZ VM"); openvzLog(OPENVZ_ERR, "%s", _("Error creating OPENVZ VM"));
return NULL; return NULL;
} }
@ -424,7 +425,7 @@ openvzDomainCreateLinux(virConnectPtr conn, const char *xml,
if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1) 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; goto bail_out3;
} }
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd); 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) 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; goto bail_out3;
} }
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd); ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
@ -494,7 +495,7 @@ openvzDomainCreate(virDomainPtr dom)
if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1) 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; goto bail_out4;
} }
ret = virExec(dom->conn, (char **)cmdExec, &pid, -1, &outfd, &errfd); ret = virExec(dom->conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
@ -537,7 +538,7 @@ openvzDomainUndefine(virDomainPtr dom)
if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1) 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; goto bail_out5;
} }
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd); ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);