Mark many more strings for translation. * Makefile.maint (err_func_re): Add to the list and make it readable. * po/POTFILES.in: Add src/util.c and src/xm_internal.c, and sort. Signed-off-by: Jim Meyering <meyering@xxxxxxxxxx> --- Makefile.maint | 33 +++++++- po/POTFILES.in | 10 ++- qemud/remote.c | 197 +++++++++++++++++++++++++------------------------ src/qemu_driver.c | 137 ++++++++++++++++++++-------------- src/storage_backend.c | 2 +- src/util.c | 2 +- src/virsh.c | 11 ++- src/xm_internal.c | 16 +++-- 8 files changed, 233 insertions(+), 175 deletions(-) diff --git a/Makefile.maint b/Makefile.maint index 879f211..d870bfd 100644 --- a/Makefile.maint +++ b/Makefile.maint @@ -298,8 +298,31 @@ sc_two_space_separator_in_usage: echo "$(ME): an option and its description"; \ 1>&2; exit 1; } || : -err_func_re = \ -(DISABLE_fprintf|qemudLog|(xmlRpc|vir(Xend|XML|Hash|Conf|Test|LibConn|StorageReport|lxc))Error) +msg_gen_function = +msg_gen_function += DISABLE_fprintf +msg_gen_function += virXendError +msg_gen_function += virXMLError +msg_gen_function += virHashError +msg_gen_function += virConfError +msg_gen_function += virTestError +msg_gen_function += virLibConnError +msg_gen_function += virStorageReportError +msg_gen_function += virxmlRpcError +msg_gen_function += virLog +msg_gen_function += qemudLog +msg_gen_function += remoteDispatchError +msg_gen_function += virStorageLog + +# msg_gen_function += xenXMError +# msg_gen_function += virXenError +# msg_gen_function += ReportError +# msg_gen_function += testError +# msg_gen_function += openvzLog +# msg_gen_function += qemudReportError +# msg_gen_function += error + +func_or := $(shell printf '$(msg_gen_function)'|tr -s '[[:space:]]' '|') +func_re := ($(func_or)) # Look for diagnostics that aren't marked for translation. # This won't find any for which error's format string is on a separate line. @@ -308,12 +331,12 @@ err_func_re = \ # "%s", _("no storage vol w..." sc_unmarked_diagnostics: @grep -nE \ - '\<(vshError|error) \([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \ + '\<$(func_re) \([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \ | grep -v '_''(' && \ { echo '$(ME): found unmarked diagnostic(s)' 1>&2; \ exit 1; } || : - @{ grep -nE '\<$(err_func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT)); \ - grep -A1 -nE '\<$(err_func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \ + @{ grep -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT)); \ + grep -A1 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \ | sed 's/_("[^"][^"]*"//;s/[ ]"%s"//' \ | grep '[ ]"' && \ { echo '$(ME): found unmarked diagnostic(s)' 1>&2; \ diff --git a/po/POTFILES.in b/po/POTFILES.in index 25e38ea..54cb077 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,6 +1,6 @@ gnulib/lib/gai_strerror.c -qemud/remote.c qemud/qemud.c +qemud/remote.c src/conf.c src/console.c src/hash.c @@ -12,20 +12,22 @@ src/proxy_internal.c src/qemu_conf.c src/qemu_driver.c src/remote_internal.c +src/sexpr.c src/storage_backend.c +src/storage_backend_disk.c src/storage_backend_fs.c -src/storage_backend_logical.c src/storage_backend_iscsi.c -src/storage_backend_disk.c +src/storage_backend_logical.c src/storage_conf.c src/storage_driver.c -src/sexpr.c src/test.c +src/util.c src/uuid.c src/virsh.c src/virterror.c src/xen_internal.c src/xend_internal.c +src/xm_internal.c src/xml.c src/xmlrpc.c src/xs_internal.c diff --git a/qemud/remote.c b/qemud/remote.c index c7db5fa..82b8dce 100644 --- a/qemud/remote.c +++ b/qemud/remote.c @@ -101,32 +101,34 @@ remoteDispatchClientRequest (struct qemud_server *server, xdrmem_create (&xdr, client->buffer, client->bufferLength, XDR_DECODE); if (!xdr_remote_message_header (&xdr, &req)) { - remoteDispatchError (client, NULL, "xdr_remote_message_header"); + remoteDispatchError (client, NULL, "%s", _("xdr_remote_message_header")); xdr_destroy (&xdr); return; } /* Check version, etc. */ if (req.prog != REMOTE_PROGRAM) { - remoteDispatchError (client, &req, "program mismatch (actual %x, expected %x)", + remoteDispatchError (client, &req, + _("program mismatch (actual %x, expected %x)"), req.prog, REMOTE_PROGRAM); xdr_destroy (&xdr); return; } if (req.vers != REMOTE_PROTOCOL_VERSION) { - remoteDispatchError (client, &req, "version mismatch (actual %x, expected %x)", + remoteDispatchError (client, &req, + _("version mismatch (actual %x, expected %x)"), req.vers, REMOTE_PROTOCOL_VERSION); xdr_destroy (&xdr); return; } if (req.direction != REMOTE_CALL) { - remoteDispatchError (client, &req, "direction (%d) != REMOTE_CALL", + remoteDispatchError (client, &req, _("direction (%d) != REMOTE_CALL"), (int) req.direction); xdr_destroy (&xdr); return; } if (req.status != REMOTE_OK) { - remoteDispatchError (client, &req, "status (%d) != REMOTE_OK", + remoteDispatchError (client, &req, _("status (%d) != REMOTE_OK"), (int) req.status); xdr_destroy (&xdr); return; @@ -142,7 +144,7 @@ remoteDispatchClientRequest (struct qemud_server *server, req.proc != REMOTE_PROC_AUTH_SASL_STEP && req.proc != REMOTE_PROC_AUTH_POLKIT ) { - remoteDispatchError (client, &req, "authentication required"); + remoteDispatchError (client, &req, "%s", _("authentication required")); xdr_destroy (&xdr); return; } @@ -155,7 +157,7 @@ remoteDispatchClientRequest (struct qemud_server *server, #include "remote_dispatch_proc_switch.h" default: - remoteDispatchError (client, &req, "unknown procedure: %d", + remoteDispatchError (client, &req, _("unknown procedure: %d"), req.proc); xdr_destroy (&xdr); return; @@ -163,7 +165,7 @@ remoteDispatchClientRequest (struct qemud_server *server, /* Parse args. */ if (!(*args_filter) (&xdr, args)) { - remoteDispatchError (client, &req, "parse args failed"); + remoteDispatchError (client, &req, "%s", _("parse args failed")); xdr_destroy (&xdr); return; } @@ -178,7 +180,8 @@ remoteDispatchClientRequest (struct qemud_server *server, * an internal error. */ if (rv < -2 || rv > 0) { - remoteDispatchError (client, &req, "internal error - dispatch function returned invalid code %d", rv); + remoteDispatchError (client, &req, + _("internal error - dispatch function returned invalid code %d"), rv); return; } @@ -200,14 +203,14 @@ remoteDispatchClientRequest (struct qemud_server *server, len = 0; /* We'll come back and write this later. */ if (!xdr_int (&xdr, &len)) { - remoteDispatchError (client, &req, "dummy length"); + remoteDispatchError (client, &req, "%s", _("dummy length")); xdr_destroy (&xdr); if (rv == 0) xdr_free (ret_filter, ret); return; } if (!xdr_remote_message_header (&xdr, &rep)) { - remoteDispatchError (client, &req, "serialise reply header"); + remoteDispatchError (client, &req, "%s", _("serialise reply header")); xdr_destroy (&xdr); if (rv == 0) xdr_free (ret_filter, ret); return; @@ -216,7 +219,7 @@ remoteDispatchClientRequest (struct qemud_server *server, /* If OK, serialise return structure, if error serialise error. */ if (rv == 0) { if (!(*ret_filter) (&xdr, ret)) { - remoteDispatchError (client, &req, "serialise return struct"); + remoteDispatchError (client, &req, "%s", _("serialise return struct")); xdr_destroy (&xdr); return; } @@ -271,7 +274,7 @@ remoteDispatchClientRequest (struct qemud_server *server, } if (!xdr_remote_error (&xdr, &error)) { - remoteDispatchError (client, &req, "serialise return error"); + remoteDispatchError (client, &req, "%s", _("serialise return error")); xdr_destroy (&xdr); return; } @@ -280,13 +283,13 @@ remoteDispatchClientRequest (struct qemud_server *server, /* Write the length word. */ len = xdr_getpos (&xdr); if (xdr_setpos (&xdr, 0) == 0) { - remoteDispatchError (client, &req, "xdr_setpos"); + remoteDispatchError (client, &req, "%s", _("xdr_setpos")); xdr_destroy (&xdr); return; } if (!xdr_int (&xdr, &len)) { - remoteDispatchError (client, &req, "serialise return length"); + remoteDispatchError (client, &req, "%s", _("serialise return length")); xdr_destroy (&xdr); return; } @@ -420,7 +423,7 @@ remoteDispatchOpen (struct qemud_server *server ATTRIBUTE_UNUSED, /* Already opened? */ if (client->conn) { - remoteDispatchError (client, req, "connection already open"); + remoteDispatchError (client, req, "%s", _("connection already open")); return -2; } @@ -446,7 +449,7 @@ remoteDispatchOpen (struct qemud_server *server ATTRIBUTE_UNUSED, #define CHECK_CONN(client) \ if (!client->conn) { \ - remoteDispatchError (client, req, "connection not open"); \ + remoteDispatchError (client, req, "%s", _("connection not open")); \ return -2; \ } @@ -493,7 +496,7 @@ remoteDispatchGetType (struct qemud_server *server ATTRIBUTE_UNUSED, */ ret->type = strdup (type); if (!ret->type) { - remoteDispatchError (client, req, "out of memory in strdup"); + remoteDispatchError (client, req, "%s", _("out of memory in strdup")); return -2; } @@ -607,7 +610,7 @@ remoteDispatchDomainGetSchedulerType (struct qemud_server *server ATTRIBUTE_UNUS dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -638,19 +641,19 @@ remoteDispatchDomainGetSchedulerParameters (struct qemud_server *server ATTRIBUT nparams = args->nparams; if (nparams > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX) { - remoteDispatchError (client, req, "nparams too large"); + remoteDispatchError (client, req, "%s", _("nparams too large")); return -2; } params = malloc (sizeof (*params) * nparams); if (params == NULL) { - remoteDispatchError (client, req, "out of memory allocating array"); + remoteDispatchError (client, req, "%s", _("out of memory allocating array")); return -2; } dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { free (params); - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -669,7 +672,7 @@ remoteDispatchDomainGetSchedulerParameters (struct qemud_server *server ATTRIBUT virDomainFree(dom); free (params); remoteDispatchError (client, req, - "out of memory allocating return array"); + "%s", _("out of memory allocating return array")); return -2; } @@ -680,7 +683,7 @@ remoteDispatchDomainGetSchedulerParameters (struct qemud_server *server ATTRIBUT virDomainFree(dom); free (params); remoteDispatchError (client, req, - "out of memory allocating return array"); + "%s", _("out of memory allocating return array")); return -2; } ret->params.params_val[i].value.type = params[i].type; @@ -700,7 +703,7 @@ remoteDispatchDomainGetSchedulerParameters (struct qemud_server *server ATTRIBUT default: virDomainFree(dom); free (params); - remoteDispatchError (client, req, "unknown type"); + remoteDispatchError (client, req, "%s", _("unknown type")); return -2; } } @@ -725,12 +728,12 @@ remoteDispatchDomainSetSchedulerParameters (struct qemud_server *server ATTRIBUT nparams = args->params.params_len; if (nparams > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX) { - remoteDispatchError (client, req, "nparams too large"); + remoteDispatchError (client, req, "%s", _("nparams too large")); return -2; } params = malloc (sizeof (*params) * nparams); if (params == NULL) { - remoteDispatchError (client, req, "out of memory allocating array"); + remoteDispatchError (client, req, "%s", _("out of memory allocating array")); return -2; } @@ -759,7 +762,7 @@ remoteDispatchDomainSetSchedulerParameters (struct qemud_server *server ATTRIBUT dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { free (params); - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -785,7 +788,7 @@ remoteDispatchDomainBlockStats (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } path = args->path; @@ -816,7 +819,7 @@ remoteDispatchDomainInterfaceStats (struct qemud_server *server ATTRIBUTE_UNUSED dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } path = args->path; @@ -848,7 +851,7 @@ remoteDispatchDomainAttachDevice (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -872,7 +875,7 @@ remoteDispatchDomainCreate (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -934,7 +937,7 @@ remoteDispatchDomainDestroy (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -956,7 +959,7 @@ remoteDispatchDomainDetachDevice (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -981,7 +984,7 @@ remoteDispatchDomainDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1007,7 +1010,7 @@ remoteDispatchDomainGetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1032,7 +1035,7 @@ remoteDispatchDomainGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1064,7 +1067,7 @@ remoteDispatchDomainGetMaxMemory (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1089,7 +1092,7 @@ remoteDispatchDomainGetMaxVcpus (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1114,7 +1117,7 @@ remoteDispatchDomainGetOsType (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1143,19 +1146,19 @@ remoteDispatchDomainGetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } if (args->maxinfo > REMOTE_VCPUINFO_MAX) { virDomainFree(dom); - remoteDispatchError (client, req, "maxinfo > REMOTE_VCPUINFO_MAX"); + remoteDispatchError (client, req, "%s", _("maxinfo > REMOTE_VCPUINFO_MAX")); return -2; } if (args->maxinfo * args->maplen > REMOTE_CPUMAPS_MAX) { virDomainFree(dom); - remoteDispatchError (client, req, "maxinfo * maplen > REMOTE_CPUMAPS_MAX"); + remoteDispatchError (client, req, "%s", _("maxinfo * maplen > REMOTE_CPUMAPS_MAX")); return -2; } @@ -1243,7 +1246,7 @@ remoteDispatchDomainMigratePerform (struct qemud_server *server ATTRIBUTE_UNUSED dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1292,7 +1295,7 @@ remoteDispatchListDefinedDomains (struct qemud_server *server ATTRIBUTE_UNUSED, if (args->maxnames > REMOTE_DOMAIN_NAME_LIST_MAX) { remoteDispatchError (client, req, - "maxnames > REMOTE_DOMAIN_NAME_LIST_MAX"); + "%s", _("maxnames > REMOTE_DOMAIN_NAME_LIST_MAX")); return -2; } @@ -1389,13 +1392,13 @@ remoteDispatchDomainPinVcpu (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } if (args->cpumap.cpumap_len > REMOTE_CPUMAP_MAX) { virDomainFree(dom); - remoteDispatchError (client, req, "cpumap_len > REMOTE_CPUMAP_MAX"); + remoteDispatchError (client, req, "%s", _("cpumap_len > REMOTE_CPUMAP_MAX")); return -2; } @@ -1422,7 +1425,7 @@ remoteDispatchDomainReboot (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1461,7 +1464,7 @@ remoteDispatchDomainResume (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1485,7 +1488,7 @@ remoteDispatchDomainSave (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1509,7 +1512,7 @@ remoteDispatchDomainCoreDump (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1533,7 +1536,7 @@ remoteDispatchDomainSetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1557,7 +1560,7 @@ remoteDispatchDomainSetMaxMemory (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1581,7 +1584,7 @@ remoteDispatchDomainSetMemory (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1605,7 +1608,7 @@ remoteDispatchDomainSetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1629,7 +1632,7 @@ remoteDispatchDomainShutdown (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1653,7 +1656,7 @@ remoteDispatchDomainSuspend (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1677,7 +1680,7 @@ remoteDispatchDomainUndefine (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1700,7 +1703,7 @@ remoteDispatchListDefinedNetworks (struct qemud_server *server ATTRIBUTE_UNUSED, if (args->maxnames > REMOTE_NETWORK_NAME_LIST_MAX) { remoteDispatchError (client, req, - "maxnames > REMOTE_NETWORK_NAME_LIST_MAX"); + "%s", _("maxnames > REMOTE_NETWORK_NAME_LIST_MAX")); return -2; } @@ -1726,7 +1729,7 @@ remoteDispatchListDomains (struct qemud_server *server ATTRIBUTE_UNUSED, if (args->maxids > REMOTE_DOMAIN_ID_LIST_MAX) { remoteDispatchError (client, req, - "maxids > REMOTE_DOMAIN_ID_LIST_MAX"); + "%s", _("maxids > REMOTE_DOMAIN_ID_LIST_MAX")); return -2; } @@ -1751,7 +1754,7 @@ remoteDispatchListNetworks (struct qemud_server *server ATTRIBUTE_UNUSED, if (args->maxnames > REMOTE_NETWORK_NAME_LIST_MAX) { remoteDispatchError (client, req, - "maxnames > REMOTE_NETWORK_NAME_LIST_MAX"); + "%s", _("maxnames > REMOTE_NETWORK_NAME_LIST_MAX")); return -2; } @@ -1778,7 +1781,7 @@ remoteDispatchNetworkCreate (struct qemud_server *server ATTRIBUTE_UNUSED, net = get_nonnull_network (client->conn, args->net); if (net == NULL) { - remoteDispatchError (client, req, "network not found"); + remoteDispatchError (client, req, "%s", _("network not found")); return -2; } @@ -1838,7 +1841,7 @@ remoteDispatchNetworkDestroy (struct qemud_server *server ATTRIBUTE_UNUSED, net = get_nonnull_network (client->conn, args->net); if (net == NULL) { - remoteDispatchError (client, req, "network not found"); + remoteDispatchError (client, req, "%s", _("network not found")); return -2; } @@ -1862,7 +1865,7 @@ remoteDispatchNetworkDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED, net = get_nonnull_network (client->conn, args->net); if (net == NULL) { - remoteDispatchError (client, req, "network not found"); + remoteDispatchError (client, req, "%s", _("network not found")); return -2; } @@ -1888,7 +1891,7 @@ remoteDispatchNetworkGetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED, net = get_nonnull_network (client->conn, args->net); if (net == NULL) { - remoteDispatchError (client, req, "network not found"); + remoteDispatchError (client, req, "%s", _("network not found")); return -2; } @@ -1912,7 +1915,7 @@ remoteDispatchNetworkGetBridgeName (struct qemud_server *server ATTRIBUTE_UNUSED net = get_nonnull_network (client->conn, args->net); if (net == NULL) { - remoteDispatchError (client, req, "network not found"); + remoteDispatchError (client, req, "%s", _("network not found")); return -2; } @@ -1974,7 +1977,7 @@ remoteDispatchNetworkSetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED, net = get_nonnull_network (client->conn, args->net); if (net == NULL) { - remoteDispatchError (client, req, "network not found"); + remoteDispatchError (client, req, "%s", _("network not found")); return -2; } @@ -1998,7 +2001,7 @@ remoteDispatchNetworkUndefine (struct qemud_server *server ATTRIBUTE_UNUSED, net = get_nonnull_network (client->conn, args->net); if (net == NULL) { - remoteDispatchError (client, req, "network not found"); + remoteDispatchError (client, req, "%s", _("network not found")); return -2; } @@ -2089,13 +2092,14 @@ static char *addrToString(struct qemud_client *client, port, sizeof(port), NI_NUMERICHOST | NI_NUMERICSERV)) != 0) { remoteDispatchError(client, req, - "Cannot resolve address %d: %s", err, gai_strerror(err)); + _("Cannot resolve address %d: %s"), + err, gai_strerror(err)); return NULL; } addr = malloc(strlen(host) + 1 + strlen(port) + 1); if (!addr) { - remoteDispatchError(client, req, "cannot allocate address"); + remoteDispatchError(client, req, "%s", _("cannot allocate address")); return NULL; } @@ -2137,7 +2141,8 @@ remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED, /* Get local address in form IPADDR:PORT */ salen = sizeof(sa); if (getsockname(client->fd, (struct sockaddr*)&sa, &salen) < 0) { - remoteDispatchError(client, req, "failed to get sock address %d (%s)", + remoteDispatchError(client, req, + _("failed to get sock address %d (%s)"), errno, strerror(errno)); return -2; } @@ -2148,7 +2153,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED, /* Get remote address in form IPADDR:PORT */ salen = sizeof(sa); if (getpeername(client->fd, (struct sockaddr*)&sa, &salen) < 0) { - remoteDispatchError(client, req, "failed to get peer address %d (%s)", + remoteDispatchError(client, req, _("failed to get peer address %d (%s)"), errno, strerror(errno)); free(localAddr); return -2; @@ -2413,7 +2418,8 @@ remoteDispatchAuthSaslStart (struct qemud_server *server, if (serverout) { ret->data.data_val = malloc(serveroutlen); if (!ret->data.data_val) { - remoteDispatchError (client, req, "out of memory allocating array"); + remoteDispatchError (client, req, + "%s", _("out of memory allocating array")); return -2; } memcpy(ret->data.data_val, serverout, serveroutlen); @@ -2493,7 +2499,8 @@ remoteDispatchAuthSaslStep (struct qemud_server *server, if (serverout) { ret->data.data_val = malloc(serveroutlen); if (!ret->data.data_val) { - remoteDispatchError (client, req, "out of memory allocating array"); + remoteDispatchError (client, req, + "%s", _("out of memory allocating array")); return -2; } memcpy(ret->data.data_val, serverout, serveroutlen); @@ -2737,7 +2744,7 @@ remoteDispatchListDefinedStoragePools (struct qemud_server *server ATTRIBUTE_UNU if (args->maxnames > REMOTE_NETWORK_NAME_LIST_MAX) { remoteDispatchError (client, req, - "maxnames > REMOTE_NETWORK_NAME_LIST_MAX"); + "%s", _("maxnames > REMOTE_NETWORK_NAME_LIST_MAX")); return -2; } @@ -2763,7 +2770,7 @@ remoteDispatchListStoragePools (struct qemud_server *server ATTRIBUTE_UNUSED, if (args->maxnames > REMOTE_STORAGE_POOL_NAME_LIST_MAX) { remoteDispatchError (client, req, - "maxnames > REMOTE_STORAGE_POOL_NAME_LIST_MAX"); + "%s", _("maxnames > REMOTE_STORAGE_POOL_NAME_LIST_MAX")); return -2; } @@ -2790,7 +2797,7 @@ remoteDispatchStoragePoolCreate (struct qemud_server *server ATTRIBUTE_UNUSED, pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -2850,7 +2857,7 @@ remoteDispatchStoragePoolBuild (struct qemud_server *server ATTRIBUTE_UNUSED, pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -2875,7 +2882,7 @@ remoteDispatchStoragePoolDestroy (struct qemud_server *server ATTRIBUTE_UNUSED, pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -2899,7 +2906,7 @@ remoteDispatchStoragePoolDelete (struct qemud_server *server ATTRIBUTE_UNUSED, pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -2923,7 +2930,7 @@ remoteDispatchStoragePoolRefresh (struct qemud_server *server ATTRIBUTE_UNUSED, pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -2948,7 +2955,7 @@ remoteDispatchStoragePoolGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED, pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -2979,7 +2986,7 @@ remoteDispatchStoragePoolDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED, pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -3005,7 +3012,7 @@ remoteDispatchStoragePoolGetAutostart (struct qemud_server *server ATTRIBUTE_UNU pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -3088,7 +3095,7 @@ remoteDispatchStoragePoolSetAutostart (struct qemud_server *server ATTRIBUTE_UNU pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -3112,7 +3119,7 @@ remoteDispatchStoragePoolUndefine (struct qemud_server *server ATTRIBUTE_UNUSED, pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -3166,13 +3173,13 @@ remoteDispatchStoragePoolListVolumes (struct qemud_server *server ATTRIBUTE_UNUS if (args->maxnames > REMOTE_STORAGE_VOL_NAME_LIST_MAX) { remoteDispatchError (client, req, - "maxnames > REMOTE_STORAGE_VOL_NAME_LIST_MAX"); + "%s", _("maxnames > REMOTE_STORAGE_VOL_NAME_LIST_MAX")); return -2; } pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -3201,7 +3208,7 @@ remoteDispatchStoragePoolNumOfVolumes (struct qemud_server *server ATTRIBUTE_UNU pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -3232,7 +3239,7 @@ remoteDispatchStorageVolCreateXml (struct qemud_server *server ATTRIBUTE_UNUSED, pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -3258,7 +3265,7 @@ remoteDispatchStorageVolDelete (struct qemud_server *server ATTRIBUTE_UNUSED, vol = get_nonnull_storage_vol (client->conn, args->vol); if (vol == NULL) { - remoteDispatchError (client, req, "storage_vol not found"); + remoteDispatchError (client, req, "%s", _("storage_vol not found")); return -2; } @@ -3283,7 +3290,7 @@ remoteDispatchStorageVolGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED, vol = get_nonnull_storage_vol (client->conn, args->vol); if (vol == NULL) { - remoteDispatchError (client, req, "storage_vol not found"); + remoteDispatchError (client, req, "%s", _("storage_vol not found")); return -2; } @@ -3313,7 +3320,7 @@ remoteDispatchStorageVolDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED, vol = get_nonnull_storage_vol (client->conn, args->vol); if (vol == NULL) { - remoteDispatchError (client, req, "storage_vol not found"); + remoteDispatchError (client, req, "%s", _("storage_vol not found")); return -2; } @@ -3340,7 +3347,7 @@ remoteDispatchStorageVolGetPath (struct qemud_server *server ATTRIBUTE_UNUSED, vol = get_nonnull_storage_vol (client->conn, args->vol); if (vol == NULL) { - remoteDispatchError (client, req, "storage_vol not found"); + remoteDispatchError (client, req, "%s", _("storage_vol not found")); return -2; } @@ -3368,7 +3375,7 @@ remoteDispatchStorageVolLookupByName (struct qemud_server *server ATTRIBUTE_UNUS pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } diff --git a/src/qemu_driver.c b/src/qemu_driver.c index 4a65a08..34abe14 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -474,12 +474,12 @@ static int qemudOpenMonitor(virConnectPtr conn, } if (qemudSetCloseExec(monfd) < 0) { qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, - _("Unable to set monitor close-on-exec flag")); + "%s", _("Unable to set monitor close-on-exec flag")); goto error; } if (qemudSetNonBlock(monfd) < 0) { qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, - _("Unable to put monitor into non-blocking mode")); + "%s", _("Unable to put monitor into non-blocking mode")); goto error; } @@ -608,7 +608,7 @@ static int qemudStartVMDaemon(virConnectPtr conn, if (qemudIsActiveVM(vm)) { qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, - _("VM is already active")); + "%s", _("VM is already active")); return -1; } @@ -616,7 +616,7 @@ static int qemudStartVMDaemon(virConnectPtr conn, int port = qemudNextFreeVNCPort(driver); if (port < 0) { qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, - _("Unable to find an unused VNC port")); + "%s", _("Unable to find an unused VNC port")); return -1; } vm->def->vncActivePort = port; @@ -930,7 +930,7 @@ dhcpStartDhcpDaemon(virConnectPtr conn, if (network->def->ipAddress[0] == '\0') { qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, - _("cannot start dhcp daemon without IP address for server")); + "%s", _("cannot start dhcp daemon without IP address for server")); return -1; } @@ -1142,7 +1142,7 @@ static int qemudStartNetworkDaemon(virConnectPtr conn, if (qemudIsActiveNetwork(network)) { qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, - _("network is already active")); + "%s", _("network is already active")); return -1; } @@ -1666,14 +1666,16 @@ static int qemudDomainSuspend(virDomainPtr dom) { return -1; } if (!qemudIsActiveVM(vm)) { - qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, _("domain is not running")); + qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, + "%s", _("domain is not running")); return -1; } if (vm->state == VIR_DOMAIN_PAUSED) return 0; if (qemudMonitorCommand(driver, vm, "stop", &info) < 0) { - qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, _("suspend operation failed")); + qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, + "%s", _("suspend operation failed")); return -1; } vm->state = VIR_DOMAIN_PAUSED; @@ -1688,17 +1690,20 @@ static int qemudDomainResume(virDomainPtr dom) { char *info; struct qemud_vm *vm = qemudFindVMByID(driver, dom->id); if (!vm) { - qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching id %d"), dom->id); + qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, + _("no domain with matching id %d"), dom->id); return -1; } if (!qemudIsActiveVM(vm)) { - qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, _("domain is not running")); + qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, + "%s", _("domain is not running")); return -1; } if (vm->state == VIR_DOMAIN_RUNNING) return 0; if (qemudMonitorCommand(driver, vm, "cont", &info) < 0) { - qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, _("resume operation failed")); + qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, + "%s", _("resume operation failed")); return -1; } vm->state = VIR_DOMAIN_RUNNING; @@ -1721,7 +1726,7 @@ static int qemudDomainShutdown(virDomainPtr dom) { if (qemudMonitorCommand(driver, vm, "system_powerdown", &info) < 0) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, - _("shutdown operation failed")); + "%s", _("shutdown operation failed")); return -1; } return 0; @@ -1754,7 +1759,7 @@ static char *qemudDomainGetOSType(virDomainPtr dom) { if (!vm) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, - _("no domain with matching uuid")); + "%s", _("no domain with matching uuid")); return NULL; } @@ -1791,7 +1796,7 @@ static int qemudDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) { if (newmax < vm->def->memory) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG, - _("cannot set max memory lower than current memory")); + "%s", _("cannot set max memory lower than current memory")); return -1; } @@ -1811,13 +1816,13 @@ static int qemudDomainSetMemory(virDomainPtr dom, unsigned long newmem) { if (qemudIsActiveVM(vm)) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, - _("cannot set memory of an active domain")); + "%s", _("cannot set memory of an active domain")); return -1; } if (newmem > vm->def->maxmem) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG, - _("cannot set memory higher than max memory")); + "%s", _("cannot set memory higher than max memory")); return -1; } @@ -1830,7 +1835,8 @@ static int qemudDomainGetInfo(virDomainPtr dom, struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData; struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid); if (!vm) { - qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid")); + qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, + "%s", _("no domain with matching uuid")); return -1; } @@ -1967,7 +1973,7 @@ static int qemudDomainSave(virDomainPtr dom, if (!qemudIsActiveVM(vm)) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, - _("domain is not running")); + "%s", _("domain is not running")); return -1; } @@ -1976,7 +1982,7 @@ static int qemudDomainSave(virDomainPtr dom, header.was_running = 1; if (qemudDomainSuspend(dom) != 0) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, - _("failed to pause domain")); + "%s", _("failed to pause domain")); return -1; } } @@ -1985,7 +1991,7 @@ static int qemudDomainSave(virDomainPtr dom, xml = qemudGenerateXML(dom->conn, driver, vm, vm->def, 0); if (!xml) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, - _("failed to get domain xml")); + "%s", _("failed to get domain xml")); return -1; } header.xml_len = strlen(xml) + 1; @@ -2000,7 +2006,7 @@ static int qemudDomainSave(virDomainPtr dom, if (safewrite(fd, &header, sizeof(header)) != sizeof(header)) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, - _("failed to write save header")); + "%s", _("failed to write save header")); close(fd); free(xml); return -1; @@ -2008,7 +2014,7 @@ static int qemudDomainSave(virDomainPtr dom, if (safewrite(fd, xml, header.xml_len) != header.xml_len) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, - _("failed to write xml")); + "%s", _("failed to write xml")); close(fd); free(xml); return -1; @@ -2021,14 +2027,14 @@ static int qemudDomainSave(virDomainPtr dom, safe_path = qemudEscapeShellArg(path); if (!safe_path) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, - _("out of memory")); + "%s", _("out of memory")); return -1; } if (asprintf (&command, "migrate \"exec:" "dd of='%s' oflag=append conv=notrunc 2>/dev/null" "\"", safe_path) == -1) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, - _("out of memory")); + "%s", _("out of memory")); free(safe_path); return -1; } @@ -2036,7 +2042,7 @@ static int qemudDomainSave(virDomainPtr dom, if (qemudMonitorCommand(driver, vm, command, &info) < 0) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, - _("migrate operation failed")); + "%s", _("migrate operation failed")); free(command); return -1; } @@ -2066,20 +2072,20 @@ static int qemudDomainRestore(virConnectPtr conn, /* Verify the header and read the XML */ if ((fd = open(path, O_RDONLY)) < 0) { qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, - _("cannot read domain image")); + "%s", _("cannot read domain image")); return -1; } if (saferead(fd, &header, sizeof(header)) != sizeof(header)) { qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, - _("failed to read qemu header")); + "%s", _("failed to read qemu header")); close(fd); return -1; } if (memcmp(header.magic, QEMUD_SAVE_MAGIC, sizeof(header.magic)) != 0) { qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, - _("image magic is incorrect")); + "%s", _("image magic is incorrect")); close(fd); return -1; } @@ -2094,14 +2100,14 @@ static int qemudDomainRestore(virConnectPtr conn, if ((xml = (char *)malloc(header.xml_len)) == NULL) { qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, - _("out of memory")); + "%s", _("out of memory")); close(fd); return -1; } if (saferead(fd, xml, header.xml_len) != header.xml_len) { qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, - _("failed to read XML")); + "%s", _("failed to read XML")); close(fd); free(xml); return -1; @@ -2110,7 +2116,7 @@ static int qemudDomainRestore(virConnectPtr conn, /* Create a domain from this XML */ if (!(def = qemudParseVMDef(conn, driver, xml, NULL))) { qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, - _("failed to parse XML")); + "%s", _("failed to parse XML")); close(fd); free(xml); return -1; @@ -2129,7 +2135,7 @@ static int qemudDomainRestore(virConnectPtr conn, if (!(vm = qemudAssignVMDef(conn, driver, def))) { qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, - _("failed to assign new VM")); + "%s", _("failed to assign new VM")); qemudFreeVMDef(def); close(fd); return -1; @@ -2144,7 +2150,7 @@ static int qemudDomainRestore(virConnectPtr conn, vm->stdin = -1; if (ret < 0) { qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, - _("failed to start VM")); + "%s", _("failed to start VM")); if (!vm->configFile[0]) qemudRemoveInactiveVM(driver, vm); return -1; @@ -2155,7 +2161,7 @@ static int qemudDomainRestore(virConnectPtr conn, char *info; if (qemudMonitorCommand(driver, vm, "cont", &info) < 0) { qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, - _("failed to resume domain")); + "%s", _("failed to resume domain")); return -1; } free(info); @@ -2171,7 +2177,8 @@ static char *qemudDomainDumpXML(virDomainPtr dom, struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData; struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid); if (!vm) { - qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid")); + qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, + "%s", _("no domain with matching uuid")); return NULL; } @@ -2215,7 +2222,7 @@ static int qemudDomainStart(virDomainPtr dom) { if (!vm) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, - _("no domain with matching uuid")); + "%s", _("no domain with matching uuid")); return -1; } @@ -2252,12 +2259,14 @@ static int qemudDomainUndefine(virDomainPtr dom) { struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid); if (!vm) { - qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid")); + qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, + "%s", _("no domain with matching uuid")); return -1; } if (qemudIsActiveVM(vm)) { - qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, _("cannot delete active domain")); + qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot delete active domain")); return -1; } @@ -2287,7 +2296,7 @@ static int qemudDomainChangeCDROM(virDomainPtr dom, safe_path = qemudEscapeMonitorArg(newdisk->src); if (!safe_path) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, - _("out of memory")); + "%s", _("out of memory")); return -1; } if (asprintf (&cmd, "change %s \"%s\"", @@ -2295,7 +2304,7 @@ static int qemudDomainChangeCDROM(virDomainPtr dom, /* olddisk->dst */ "cdrom", safe_path) == -1) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, - _("out of memory")); + "%s", _("out of memory")); free(safe_path); return -1; } @@ -2303,12 +2312,13 @@ static int qemudDomainChangeCDROM(virDomainPtr dom, } else if (asprintf(&cmd, "eject cdrom") == -1) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, - _("out of memory")); + "%s", _("out of memory")); return -1; } if (qemudMonitorCommand(driver, vm, cmd, &reply) < 0) { - qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, _("cannot change cdrom media")); + qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, + "%s", _("cannot change cdrom media")); free(cmd); return -1; } @@ -2327,12 +2337,14 @@ static int qemudDomainAttachDevice(virDomainPtr dom, struct qemud_vm_disk_def *disk; if (!vm) { - qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid")); + qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, + "%s", _("no domain with matching uuid")); return -1; } if (!qemudIsActiveVM(vm)) { - qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, _("cannot attach device on inactive domain")); + qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot attach device on inactive domain")); return -1; } @@ -2342,7 +2354,8 @@ static int qemudDomainAttachDevice(virDomainPtr dom, } if (dev->type != QEMUD_DEVICE_DISK || dev->data.disk.device != QEMUD_DISK_CDROM) { - qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT, _("only CDROM disk devices can be attached")); + qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT, + "%s", _("only CDROM disk devices can be attached")); free(dev); return -1; } @@ -2356,7 +2369,8 @@ static int qemudDomainAttachDevice(virDomainPtr dom, } if (!disk) { - qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT, _("CDROM not attached, cannot change media")); + qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT, + "%s", _("CDROM not attached, cannot change media")); free(dev); return -1; } @@ -2376,7 +2390,8 @@ static int qemudDomainGetAutostart(virDomainPtr dom, struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid); if (!vm) { - qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid")); + qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, + "%s", _("no domain with matching uuid")); return -1; } @@ -2391,7 +2406,8 @@ static int qemudDomainSetAutostart(virDomainPtr dom, struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid); if (!vm) { - qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid")); + qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, + "%s", _("no domain with matching uuid")); return -1; } @@ -2590,13 +2606,13 @@ qemudDomainInterfaceStats (virDomainPtr dom, if (!qemudIsActiveVM(vm)) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, - _("domain is not running")); + "%s", _("domain is not running")); return -1; } if (!path || path[0] == '\0') { qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG, - _("NULL or empty path")); + "%s", _("NULL or empty path")); return -1; } @@ -2638,7 +2654,8 @@ static virNetworkPtr qemudNetworkLookupByUUID(virConnectPtr conn ATTRIBUTE_UNUSE virNetworkPtr net; if (!network) { - qemudReportError(conn, NULL, NULL, VIR_ERR_NO_NETWORK, _("no network with matching uuid")); + qemudReportError(conn, NULL, NULL, VIR_ERR_NO_NETWORK, + "%s", _("no network with matching uuid")); return NULL; } @@ -2652,7 +2669,8 @@ static virNetworkPtr qemudNetworkLookupByName(virConnectPtr conn ATTRIBUTE_UNUSE virNetworkPtr net; if (!network) { - qemudReportError(conn, NULL, NULL, VIR_ERR_NO_NETWORK, _("no network with matching name")); + qemudReportError(conn, NULL, NULL, VIR_ERR_NO_NETWORK, + "%s", _("no network with matching name")); return NULL; } @@ -2781,7 +2799,8 @@ static int qemudNetworkUndefine(virNetworkPtr net) { struct qemud_network *network = qemudFindNetworkByUUID(driver, net->uuid); if (!network) { - qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_DOMAIN, _("no network with matching uuid")); + qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_DOMAIN, + "%s", _("no network with matching uuid")); return -1; } @@ -2806,7 +2825,7 @@ static int qemudNetworkStart(virNetworkPtr net) { if (!network) { qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK, - _("no network with matching uuid")); + "%s", _("no network with matching uuid")); return -1; } @@ -2820,7 +2839,7 @@ static int qemudNetworkDestroy(virNetworkPtr net) { if (!network) { qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK, - _("no network with matching uuid")); + "%s", _("no network with matching uuid")); return -1; } @@ -2835,7 +2854,7 @@ static char *qemudNetworkDumpXML(virNetworkPtr net, int flags ATTRIBUTE_UNUSED) if (!network) { qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK, - _("no network with matching uuid")); + "%s", _("no network with matching uuid")); return NULL; } @@ -2865,7 +2884,8 @@ static int qemudNetworkGetAutostart(virNetworkPtr net, struct qemud_network *network = qemudFindNetworkByUUID(driver, net->uuid); if (!network) { - qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK, _("no network with matching uuid")); + qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK, + "%s", _("no network with matching uuid")); return -1; } @@ -2880,7 +2900,8 @@ static int qemudNetworkSetAutostart(virNetworkPtr net, struct qemud_network *network = qemudFindNetworkByUUID(driver, net->uuid); if (!network) { - qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK, _("no network with matching uuid")); + qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK, + "%s", _("no network with matching uuid")); return -1; } diff --git a/src/storage_backend.c b/src/storage_backend.c index 4a58cb6..92aecfd 100644 --- a/src/storage_backend.c +++ b/src/storage_backend.c @@ -1,5 +1,5 @@ /* - * storage_backend.h: internal storage driver backend contract + * storage_backend.c: internal storage driver backend contract * * Copyright (C) 2007-2008 Red Hat, Inc. * Copyright (C) 2007-2008 Daniel P. Berrange diff --git a/src/util.c b/src/util.c index 69e899f..188b7a8 100644 --- a/src/util.c +++ b/src/util.c @@ -461,7 +461,7 @@ int virFileLinkPointsTo (const char *checkLink ATTRIBUTE_UNUSED, const char *checkDest ATTRIBUTE_UNUSED) { - virLog ("%s: not implemented", __FUNCTION__); + virLog (_("%s: not implemented"), __FUNCTION__); return 0; } diff --git a/src/virsh.c b/src/virsh.c index c541f88..e7189e2 100644 --- a/src/virsh.c +++ b/src/virsh.c @@ -1723,13 +1723,14 @@ cmdVcpupin(vshControl * ctl, vshCmd * cmd) vcpu = vshCommandOptInt(cmd, "vcpu", &vcpufound); if (!vcpufound) { - vshError(ctl, FALSE, _("vcpupin: Invalid or missing vCPU number.")); + vshError(ctl, FALSE, "%s", + _("vcpupin: Invalid or missing vCPU number.")); virDomainFree(dom); return FALSE; } if (!(cpulist = vshCommandOptString(cmd, "cpulist", NULL))) { - vshError(ctl, FALSE, _("vcpupin: Missing cpulist")); + vshError(ctl, FALSE, "%s", _("vcpupin: Missing cpulist")); virDomainFree(dom); return FALSE; } @@ -1740,7 +1741,7 @@ cmdVcpupin(vshControl * ctl, vshCmd * cmd) } if (virDomainGetInfo(dom, &info) != 0) { - vshError(ctl, FALSE, _("vcpupin: Invalid vCPU number.")); + vshError(ctl, FALSE, "%s", _("vcpupin: Invalid vCPU number.")); virDomainFree(dom); return FALSE; } @@ -4475,7 +4476,7 @@ cmdAttachDevice(vshControl * ctl, vshCmd * cmd) from = vshCommandOptString(cmd, "file", &found); if (!found) { - vshError(ctl, FALSE, _("attach-device: Missing <file> option")); + vshError(ctl, FALSE, "%s", _("attach-device: Missing <file> option")); virDomainFree(dom); return FALSE; } @@ -4532,7 +4533,7 @@ cmdDetachDevice(vshControl * ctl, vshCmd * cmd) from = vshCommandOptString(cmd, "file", &found); if (!found) { - vshError(ctl, FALSE, _("detach-device: Missing <file> option")); + vshError(ctl, FALSE, "%s", _("detach-device: Missing <file> option")); virDomainFree(dom); return FALSE; } diff --git a/src/xm_internal.c b/src/xm_internal.c index 6b4b4d7..55684e7 100644 --- a/src/xm_internal.c +++ b/src/xm_internal.c @@ -434,7 +434,8 @@ static int xenXMConfigCacheRefresh (virConnectPtr conn) { virHashRemoveEntry(configCache, path, NULL); } free(entry); - xenXMError (conn, VIR_ERR_INTERNAL_ERROR, "xenXMConfigCacheRefresh: name"); + xenXMError (conn, VIR_ERR_INTERNAL_ERROR, + _("xenXMConfigCacheRefresh: name")); goto cleanup; } @@ -444,7 +445,8 @@ static int xenXMConfigCacheRefresh (virConnectPtr conn) { if (virHashAddEntry(configCache, entry->filename, entry) < 0) { virConfFree(entry->conf); free(entry); - xenXMError (conn, VIR_ERR_INTERNAL_ERROR, "xenXMConfigCacheRefresh: virHashAddEntry"); + xenXMError (conn, VIR_ERR_INTERNAL_ERROR, + _("xenXMConfigCacheRefresh: virHashAddEntry")); goto cleanup; } } @@ -1254,21 +1256,23 @@ int xenXMDomainPinVcpu(virDomainPtr domain, return -1; } if (domain->conn->flags & VIR_CONNECT_RO) { - xenXMError (domain->conn, VIR_ERR_INVALID_ARG, "read only connection"); + xenXMError (domain->conn, VIR_ERR_INVALID_ARG, + _("read only connection")); return -1; } if (domain->id != -1) { - xenXMError (domain->conn, VIR_ERR_INVALID_ARG, "not inactive domain"); + xenXMError (domain->conn, VIR_ERR_INVALID_ARG, + _("not inactive domain")); return -1; } if (!(filename = virHashLookup(nameConfigMap, domain->name))) { - xenXMError (domain->conn, VIR_ERR_INTERNAL_ERROR, "virHashLookup"); + xenXMError (domain->conn, VIR_ERR_INTERNAL_ERROR, _("virHashLookup")); return -1; } if (!(entry = virHashLookup(configCache, filename))) { xenXMError (domain->conn, VIR_ERR_INTERNAL_ERROR, - "can't retrieve config file for domain"); + _("can't retrieve config file for domain")); return -1; } -- 1.5.5.rc0.22.g467c -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list