[Libvir] [PATCH 1/9] Mark many more strings for translation.
by Jim Meyering
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(a)redhat.com>
---
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
16 years, 9 months
[Libvir] iptables masquerade rule overexpansive
by Charles Duffy
On my system, libvirt-0.4.0-2ubuntu6 added the following rule to allow
my virtual hosts NATted access to the outside world:
> Chain POSTROUTING (policy ACCEPT 33904 packets, 2146K bytes)
> pkts bytes target prot opt in out source destination
> 779 102K MASQUERADE all -- * * 192.168.65.0/24 0.0.0.0/0
This resulted in *all* traffic being masqueraded, even between two
different VMs -- preventing hostbased authentication between these VMs.
To temporarily resolve this, I added an additional rule, as follows:
> Chain POSTROUTING (policy ACCEPT 34049 packets, 2160K bytes)
> pkts bytes target prot opt in out source destination
> 156 9752 ACCEPT all -- * * 192.168.65.0/24 192.168.65.0/24
> 865 109K MASQUERADE all -- * * 192.168.65.0/24 0.0.0.0/0
The network definition being used was as follows:
> <network>
> <name>default</name>
> <uuid>a7c5b18c-9d38-40ed-9b12-8b1a27013b85</uuid>
> <bridge name="virbr%d" />
> <forward/>
> <ip address="192.168.65.253" netmask="255.255.255.0"/>
> </network>
I'm frankly unclear on why the packets attempted to forward through .253
in any event -- the routing tables on both VMs refer to 192.168.65.0/24
as part of the local network, so my expectation is that no attempt to
route through the default gateway should have occurred.
In any event, having libvirt extend the MASQUERADE rule to avoid
impacting traffic between hosts on the virtual network -- or adding a
paired ACCEPT, as I did above -- would probably be a Good Thing.
16 years, 9 months
[Libvir] [PATCH] lxc: shutdown and destroy domain
by Dave Leskovec
This patch contains the shutdown and destroy domain support for Linux Containers.
A shutdown of the container is requested by sending a SIGINT to the container
root process.
A container is destroyed by sending a SIGKILL to the container root process.
When this process exits, it takes all container child processes with it.
Thanks!
--
Best Regards,
Dave Leskovec
IBM Linux Technology Center
Open Virtualization
16 years, 9 months
[Libvir] lxc patches
by Dave Leskovec
Sorry - I should have mentioned that the two lxc patches I just posted are built
on Dan B's patch. The order is this:
Dan's patch
lxc_start.patch
lxc_stop.patch
Thanks!
--
Best Regards,
Dave Leskovec
IBM Linux Technology Center
Open Virtualization
16 years, 9 months
[Libvir] building ruby bindings
by Vadim Zaliva
Hi!
I am trying to build Ruby bindings for libvirt 0.4.1.
I have checked out ruby-libvirt from mercurial repository, but it
fails during the build:
# rake build
(in /home/lord/tmp/ruby-libvirt)
make
gcc -I. -I/usr/lib/ruby/1.8/i386-linux -I/usr/lib/ruby/1.8/i386-linux -
I. -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -
fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -
mtune=generic -fasynchronous-unwind-tables -Wall -fPIC -c _libvirt.c
_libvirt.c:165: error: expected Б─≤,Б─≥ or Б─≤;Б─≥ before Б─≤{Б─≥ token
make: *** [_libvirt.o] Error 1
rake aborted!
Command failed with status (2): [make...]
/home/lord/tmp/ruby-libvirt/Rakefile:52
(See full trace by running task with --trace)
The offending line is:
NORETURN(static void vir_error(virConnectPtr conn, const char *fn)) {
rb_raise(rb_eSystemCallError, "libvir call %s failed", fn);
}
removing NORETURN macro around function definition eliminates the
error and all tests pass:
# rake test
(in /home/lord/tmp/ruby-libvirt)
Loaded suite /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/
rake_test_loader
Started
.....
Finished in 0.006453 seconds.
5 tests, 58 assertions, 0 failures, 0 errors
Here is some information about my system:
# gcc --version
gcc (GCC) 4.1.2 20070626 (Red Hat 4.1.2-14)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There
is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
# cat /etc/redhat-release
CentOS release 5 (Final)
# arch
i686
Sincerely,
Vadim
16 years, 9 months
[Libvir] [PATCH] mark error messages as translatable
by Guido Günther
This patch marks the error messages in qemu_driver.c as translatable,
some of them were marked as such already. Please apply.
-- Guido
---
src/qemu_driver.c | 200 ++++++++++++++++++++++++++--------------------------
1 files changed, 100 insertions(+), 100 deletions(-)
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index af5fc40..719f46e 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -392,7 +392,7 @@ qemudReadMonitorOutput(virConnectPtr conn,
ret = read(fd, buf+got, buflen-got-1);
if (ret == 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "QEMU quit during %s startup\n%s", what, buf);
+ _("QEMU quit during %s startup\n%s"), what, buf);
return -1;
}
if (ret < 0) {
@@ -402,7 +402,7 @@ qemudReadMonitorOutput(virConnectPtr conn,
if (errno != EAGAIN) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Failure while reading %s startup output: %s",
+ _("Failure while reading %s startup output: %s"),
what, strerror(errno));
return -1;
}
@@ -410,12 +410,12 @@ qemudReadMonitorOutput(virConnectPtr conn,
ret = poll(&pfd, 1, MONITOR_TIMEOUT);
if (ret == 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Timed out while reading %s startup output", what);
+ _("Timed out while reading %s startup output"), what);
return -1;
} else if (ret == -1) {
if (errno != EINTR) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Failure while reading %s startup output: %s",
+ _("Failure while reading %s startup output: %s"),
what, strerror(errno));
return -1;
}
@@ -426,7 +426,7 @@ qemudReadMonitorOutput(virConnectPtr conn,
continue;
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Failure while reading %s startup output", what);
+ _("Failure while reading %s startup output"), what);
return -1;
}
} else {
@@ -438,7 +438,7 @@ qemudReadMonitorOutput(virConnectPtr conn,
}
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Out of space while reading %s startup output", what);
+ _("Out of space while reading %s startup output"), what);
return -1;
#undef MONITOR_TIMEOUT
@@ -469,17 +469,17 @@ static int qemudOpenMonitor(virConnectPtr conn,
if (!(monfd = open(monitor, O_RDWR))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Unable to open monitor path %s", monitor);
+ _("Unable to open monitor path %s"), monitor);
return -1;
}
if (qemudSetCloseExec(monfd) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Unable to set monitor close-on-exec flag");
+ _("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");
+ _("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");
+ _("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");
+ _("Unable to find an unused VNC port"));
return -1;
}
vm->def->vncActivePort = port;
@@ -629,7 +629,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
4 + /* suffix .log */
1 /* NULL */) > PATH_MAX) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "config file path too long: %s/%s.log",
+ _("config file path too long: %s/%s.log"),
driver->logDir, vm->def->name);
return -1;
}
@@ -640,7 +640,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
if (virFileMakePath(driver->logDir) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot create log directory %s: %s",
+ _("cannot create log directory %s: %s"),
driver->logDir, strerror(errno));
return -1;
}
@@ -648,13 +648,13 @@ static int qemudStartVMDaemon(virConnectPtr conn,
if ((vm->logfile = open(logfile, O_CREAT | O_TRUNC | O_WRONLY,
S_IRUSR | S_IWUSR)) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to create logfile %s: %s",
+ _("failed to create logfile %s: %s"),
logfile, strerror(errno));
return -1;
}
if (qemudSetCloseExec(vm->logfile) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Unable to set VM logfile close-on-exec flag %s",
+ _("Unable to set VM logfile close-on-exec flag %s"),
strerror(errno));
close(vm->logfile);
vm->logfile = -1;
@@ -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");
+ _("cannot start dhcp daemon without IP address for server"));
return -1;
}
@@ -962,14 +962,14 @@ qemudAddIptablesRules(virConnectPtr conn,
/* allow DHCP requests through to dnsmasq */
if ((err = iptablesAddTcpInput(driver->iptables, network->bridge, 67))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to allow DHCP requests from '%s' : %s\n",
+ _("failed to add iptables rule to allow DHCP requests from '%s' : %s\n"),
network->bridge, strerror(err));
goto err1;
}
if ((err = iptablesAddUdpInput(driver->iptables, network->bridge, 67))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to allow DHCP requests from '%s' : %s\n",
+ _("failed to add iptables rule to allow DHCP requests from '%s' : %s\n"),
network->bridge, strerror(err));
goto err2;
}
@@ -977,14 +977,14 @@ qemudAddIptablesRules(virConnectPtr conn,
/* allow DNS requests through to dnsmasq */
if ((err = iptablesAddTcpInput(driver->iptables, network->bridge, 53))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to allow DNS requests from '%s' : %s\n",
+ _("failed to add iptables rule to allow DNS requests from '%s' : %s\n"),
network->bridge, strerror(err));
goto err3;
}
if ((err = iptablesAddUdpInput(driver->iptables, network->bridge, 53))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to allow DNS requests from '%s' : %s\n",
+ _("failed to add iptables rule to allow DNS requests from '%s' : %s\n"),
network->bridge, strerror(err));
goto err4;
}
@@ -994,14 +994,14 @@ qemudAddIptablesRules(virConnectPtr conn,
if ((err = iptablesAddForwardRejectOut(driver->iptables, network->bridge))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to block outbound traffic from '%s' : %s\n",
+ _("failed to add iptables rule to block outbound traffic from '%s' : %s\n"),
network->bridge, strerror(err));
goto err5;
}
if ((err = iptablesAddForwardRejectIn(driver->iptables, network->bridge))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to block inbound traffic to '%s' : %s\n",
+ _("failed to add iptables rule to block inbound traffic to '%s' : %s\n"),
network->bridge, strerror(err));
goto err6;
}
@@ -1009,7 +1009,7 @@ qemudAddIptablesRules(virConnectPtr conn,
/* Allow traffic between guests on the same bridge */
if ((err = iptablesAddForwardAllowCross(driver->iptables, network->bridge))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to allow cross bridge traffic on '%s' : %s\n",
+ _("failed to add iptables rule to allow cross bridge traffic on '%s' : %s\n"),
network->bridge, strerror(err));
goto err7;
}
@@ -1027,7 +1027,7 @@ qemudAddIptablesRules(virConnectPtr conn,
network->bridge,
network->def->forwardDev))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to allow forwarding from '%s' : %s\n",
+ _("failed to add iptables rule to allow forwarding from '%s' : %s\n"),
network->bridge, strerror(err));
goto err8;
}
@@ -1038,7 +1038,7 @@ qemudAddIptablesRules(virConnectPtr conn,
network->bridge,
network->def->forwardDev))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to allow forwarding to '%s' : %s\n",
+ _("failed to add iptables rule to allow forwarding to '%s' : %s\n"),
network->bridge, strerror(err));
goto err9;
}
@@ -1048,7 +1048,7 @@ qemudAddIptablesRules(virConnectPtr conn,
network->def->network,
network->def->forwardDev))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to enable masquerading : %s\n",
+ _("failed to add iptables rule to enable masquerading : %s\n"),
strerror(err));
goto err10;
}
@@ -1142,13 +1142,13 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if (qemudIsActiveNetwork(network)) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "network is already active");
+ _("network is already active"));
return -1;
}
if (!driver->brctl && (err = brInit(&driver->brctl))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot initialize bridge support: %s", strerror(err));
+ _("cannot initialize bridge support: %s"), strerror(err));
return -1;
}
@@ -1161,7 +1161,7 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if ((err = brAddBridge(driver->brctl, name, network->bridge, sizeof(network->bridge)))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot create bridge '%s' : %s", name, strerror(err));
+ _("cannot create bridge '%s' : %)"), name, strerror(err));
return -1;
}
@@ -1169,14 +1169,14 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if (network->def->forwardDelay &&
(err = brSetForwardDelay(driver->brctl, network->bridge, network->def->forwardDelay))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to set bridge forward delay to %d\n",
+ _("failed to set bridge forward delay to %d\n"),
network->def->forwardDelay);
goto err_delbr;
}
if ((err = brSetEnableSTP(driver->brctl, network->bridge, network->def->disableSTP ? 0 : 1))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to set bridge STP to %s\n",
+ _("failed to set bridge STP to %s\n"),
network->def->disableSTP ? "off" : "on");
goto err_delbr;
}
@@ -1184,7 +1184,7 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if (network->def->ipAddress[0] &&
(err = brSetInetAddress(driver->brctl, network->bridge, network->def->ipAddress))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot set IP address on bridge '%s' to '%s' : %s\n",
+ _("cannot set IP address on bridge '%s' to '%s' : %s\n"),
network->bridge, network->def->ipAddress, strerror(err));
goto err_delbr;
}
@@ -1192,7 +1192,7 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if (network->def->netmask[0] &&
(err = brSetInetNetmask(driver->brctl, network->bridge, network->def->netmask))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot set netmask on bridge '%s' to '%s' : %s\n",
+ _("cannot set netmask on bridge '%s' to '%s' : %s\n"),
network->bridge, network->def->netmask, strerror(err));
goto err_delbr;
}
@@ -1200,7 +1200,7 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if (network->def->ipAddress[0] &&
(err = brSetInterfaceUp(driver->brctl, network->bridge, 1))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to bring the bridge '%s' up : %s\n",
+ _("failed to bring the bridge '%s' up : %s\n"),
network->bridge, strerror(err));
goto err_delbr;
}
@@ -1211,7 +1211,7 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if (network->def->forward &&
!qemudEnableIpForwarding()) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to enable IP forwarding : %s\n", strerror(err));
+ _("failed to enable IP forwarding : %s\n"), strerror(err));
goto err_delbr2;
}
@@ -1662,18 +1662,18 @@ static int qemudDomainSuspend(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, _("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, _("suspend operation failed"));
return -1;
}
vm->state = VIR_DOMAIN_PAUSED;
@@ -1688,17 +1688,17 @@ 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, _("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, _("resume operation failed"));
return -1;
}
vm->state = VIR_DOMAIN_RUNNING;
@@ -1715,13 +1715,13 @@ static int qemudDomainShutdown(virDomainPtr dom) {
if (!vm) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "no domain with matching id %d", dom->id);
+ _("no domain with matching id %d"), dom->id);
return -1;
}
if (qemudMonitorCommand(driver, vm, "system_powerdown", &info) < 0) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "shutdown operation failed");
+ _("shutdown operation failed"));
return -1;
}
return 0;
@@ -1735,7 +1735,7 @@ static int qemudDomainDestroy(virDomainPtr dom) {
if (!vm) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "no domain with matching id %d", dom->id);
+ _("no domain with matching id %d"), dom->id);
return -1;
}
@@ -1754,7 +1754,7 @@ static char *qemudDomainGetOSType(virDomainPtr dom) {
if (!vm) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "no domain with matching uuid");
+ _("no domain with matching uuid"));
return NULL;
}
@@ -1830,7 +1830,7 @@ 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, _("no domain with matching uuid"));
return -1;
}
@@ -1840,7 +1840,7 @@ static int qemudDomainGetInfo(virDomainPtr dom,
info->cpuTime = 0;
} else {
if (qemudGetProcessInfo(&(info->cpuTime), vm->pid) < 0) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, "cannot read cputime for domain");
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, ("cannot read cputime for domain"));
return -1;
}
}
@@ -1961,13 +1961,13 @@ static int qemudDomainSave(virDomainPtr dom,
if (!vm) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "no domain with matching id %d", dom->id);
+ _("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");
+ _("domain is not running"));
return -1;
}
@@ -1976,7 +1976,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");
+ _("failed to pause domain"));
return -1;
}
}
@@ -1985,7 +1985,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");
+ _("failed to get domain xml"));
return -1;
}
header.xml_len = strlen(xml) + 1;
@@ -1993,14 +1993,14 @@ static int qemudDomainSave(virDomainPtr dom,
/* Write header to file, followed by XML */
if ((fd = open(path, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR)) < 0) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "failed to create '%s'", path);
+ _("failed to create '%s'"), path);
free(xml);
return -1;
}
if (safewrite(fd, &header, sizeof(header)) != sizeof(header)) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "failed to write save header");
+ _("failed to write save header"));
close(fd);
free(xml);
return -1;
@@ -2008,7 +2008,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");
+ _("failed to write xml"));
close(fd);
free(xml);
return -1;
@@ -2021,14 +2021,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");
+ _("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");
+ _("out of memory"));
free(safe_path);
return -1;
}
@@ -2036,7 +2036,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");
+ _("migrate operation failed"));
free(command);
return -1;
}
@@ -2066,27 +2066,27 @@ 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");
+ _("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");
+ _("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");
+ _("image magic is incorrect"));
close(fd);
return -1;
}
if (header.version > QEMUD_SAVE_VERSION) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "image version is not supported (%d > %d)",
+ _("image version is not supported (%d > %d)"),
header.version, QEMUD_SAVE_VERSION);
close(fd);
return -1;
@@ -2094,14 +2094,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");
+ _("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");
+ _("failed to read XML"));
close(fd);
free(xml);
return -1;
@@ -2110,7 +2110,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");
+ _("failed to parse XML"));
close(fd);
free(xml);
return -1;
@@ -2122,14 +2122,14 @@ static int qemudDomainRestore(virConnectPtr conn,
if (!vm) vm = qemudFindVMByName(driver, def->name);
if (vm && qemudIsActiveVM(vm)) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "domain is already active as '%s'", vm->def->name);
+ _("domain is already active as '%s'"), vm->def->name);
close(fd);
return -1;
}
if (!(vm = qemudAssignVMDef(conn, driver, def))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "failed to assign new VM");
+ _("failed to assign new VM"));
qemudFreeVMDef(def);
close(fd);
return -1;
@@ -2144,7 +2144,7 @@ static int qemudDomainRestore(virConnectPtr conn,
vm->stdin = -1;
if (ret < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "failed to start VM");
+ _("failed to start VM"));
if (!vm->configFile[0])
qemudRemoveInactiveVM(driver, vm);
return -1;
@@ -2155,7 +2155,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");
+ _("failed to resume domain"));
return -1;
}
free(info);
@@ -2171,7 +2171,7 @@ 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, _("no domain with matching uuid"));
return NULL;
}
@@ -2215,7 +2215,7 @@ static int qemudDomainStart(virDomainPtr dom) {
if (!vm) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "no domain with matching uuid");
+ _("no domain with matching uuid"));
return -1;
}
@@ -2252,12 +2252,12 @@ 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, _("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, _("cannot delete active domain"));
return -1;
}
@@ -2287,7 +2287,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");
+ _("out of memory"));
return -1;
}
if (asprintf (&cmd, "change %s \"%s\"",
@@ -2295,7 +2295,7 @@ static int qemudDomainChangeCDROM(virDomainPtr dom,
/* olddisk->dst */ "cdrom",
safe_path) == -1) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "out of memory");
+ _("out of memory"));
free(safe_path);
return -1;
}
@@ -2303,12 +2303,12 @@ static int qemudDomainChangeCDROM(virDomainPtr dom,
} else if (asprintf(&cmd, "eject cdrom") == -1) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "out of memory");
+ _("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, _("cannot change cdrom media"));
free(cmd);
return -1;
}
@@ -2327,12 +2327,12 @@ 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, _("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, _("cannot attach device on inactive domain"));
return -1;
}
@@ -2342,7 +2342,7 @@ 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, _("only CDROM disk devices can be attached"));
free(dev);
return -1;
}
@@ -2356,7 +2356,7 @@ 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, _("CDROM not attached, cannot change media"));
free(dev);
return -1;
}
@@ -2376,7 +2376,7 @@ 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, _("no domain with matching uuid"));
return -1;
}
@@ -2391,7 +2391,7 @@ 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, _("no domain with matching uuid"));
return -1;
}
@@ -2405,21 +2405,21 @@ static int qemudDomainSetAutostart(virDomainPtr dom,
if ((err = virFileMakePath(driver->autostartDir))) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot create autostart directory %s: %s",
+ _("cannot create autostart directory %s: %s"),
driver->autostartDir, strerror(err));
return -1;
}
if (symlink(vm->configFile, vm->autostartLink) < 0) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- "Failed to create symlink '%s' to '%s': %s",
+ _("Failed to create symlink '%s' to '%s': %s"),
vm->autostartLink, vm->configFile, strerror(errno));
return -1;
}
} else {
if (unlink(vm->autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- "Failed to delete symlink '%s': %s",
+ _("Failed to delete symlink '%s': %s"),
vm->autostartLink, strerror(errno));
return -1;
}
@@ -2584,19 +2584,19 @@ qemudDomainInterfaceStats (virDomainPtr dom,
if (!vm) {
qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "no domain with matching id %d", dom->id);
+ _("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");
+ _("domain is not running"));
return -1;
}
if (!path || path[0] == '\0') {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- "NULL or empty path");
+ _("NULL or empty path"));
return -1;
}
@@ -2619,7 +2619,7 @@ qemudDomainInterfaceStats (virDomainPtr dom,
}
qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- "invalid path, '%s' is not a known interface", path);
+ _("invalid path, '%s' is not a known interface"), path);
return -1;
ok:
@@ -2638,7 +2638,7 @@ 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, _("no network with matching uuid"));
return NULL;
}
@@ -2652,7 +2652,7 @@ 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, _("no network with matching name"));
return NULL;
}
@@ -2781,7 +2781,7 @@ 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, _("no network with matching uuid"));
return -1;
}
@@ -2806,7 +2806,7 @@ static int qemudNetworkStart(virNetworkPtr net) {
if (!network) {
qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK,
- "no network with matching uuid");
+ _("no network with matching uuid"));
return -1;
}
@@ -2820,7 +2820,7 @@ static int qemudNetworkDestroy(virNetworkPtr net) {
if (!network) {
qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK,
- "no network with matching uuid");
+ _("no network with matching uuid"));
return -1;
}
@@ -2835,7 +2835,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");
+ _("no network with matching uuid"));
return NULL;
}
@@ -2865,7 +2865,7 @@ 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, _("no network with matching uuid"));
return -1;
}
@@ -2880,7 +2880,7 @@ 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, _("no network with matching uuid"));
return -1;
}
@@ -2894,21 +2894,21 @@ static int qemudNetworkSetAutostart(virNetworkPtr net,
if ((err = virFileMakePath(driver->networkAutostartDir))) {
qemudReportError(net->conn, NULL, net, VIR_ERR_INTERNAL_ERROR,
- "cannot create autostart directory %s: %s",
+ _("cannot create autostart directory %s: %s"),
driver->networkAutostartDir, strerror(err));
return -1;
}
if (symlink(network->configFile, network->autostartLink) < 0) {
qemudReportError(net->conn, NULL, net, VIR_ERR_INTERNAL_ERROR,
- "Failed to create symlink '%s' to '%s': %s",
+ _("Failed to create symlink '%s' to '%s': %s"),
network->autostartLink, network->configFile, strerror(errno));
return -1;
}
} else {
if (unlink(network->autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR) {
qemudReportError(net->conn, NULL, net, VIR_ERR_INTERNAL_ERROR,
- "Failed to delete symlink '%s': %s",
+ _("Failed to delete symlink '%s': %s"),
network->autostartLink, strerror(errno));
return -1;
}
--
1.5.4.3
16 years, 9 months
[Libvir] [PATCH]: Make the iscsi backend work with updated iscsiadm tools
by Chris Lalancette
All,
Updated versions of the iscsi-initiator-utils changed the output structure
from the "iscsiadm -m session -P 3" command, which is being used in
storage_backend_iscsi.c to gather the scsi devices available in a pool and
present them as volumes. Consequently, when starting an iSCSI pool on a machine
with a newer version of the iscsi tools, you can successfully define the pool,
but will fail to find any LUNs on it.
The attached patch lessens our dependency on this command by groping around
sysfs for the information, instead of parsing it from the iscsiadm command. We
still parse the command to get target, channel, id, and lun numbers, but then we
cruise through sysfs looking for the corresponding /dev/sd? devices ourselves.
This makes the libvirt iSCSI backend work for both older iscsiadm and newer
iscsiadm.
After much wrangling with iscsiadm and friends, I came to the conclusion that
this is the best we can do with the current state of the iscsi tools; from what
I can tell, there is no (simple) way to get away from parsing the iscsiadm output.
This is a repost of a patch I had originally posted on 2/21; this patch
incorporates Jim's comments at that time, and also adds better error checking
and error strings. Please review and commit as appropriate.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
16 years, 9 months
[Libvir] error : could not connect to xen:///; error: failed to connect to the hypervisor
by Felix Krohn
I can't find the reason for the following error:
# virsh
libvir: error : could not connect to xen:///
error: failed to connect to the hypervisor
# virsh -c ///var/lib/xend/xend-socket
libvir: error : could not connect to ///var/lib/xend/xend-socket
error: failed to connect to the hypervisor
# lsof|grep xend-socket
python 3655 root 18u unix 0xffff88001edce340 11774 /var/lib/xend/xend-socket
system:
Debian etch on amd64
Xen version 3.2.0 (compiled from sources)
Linux 2.6.21 (patched Sources from redhat git)
libvirtd and xend are running, `xm list` etc works fine
# virsh -v
0.4.0
(installed from etch-backports)
Output from `strace -s 1024 -f virsh list --all` is here:
http://krohnjob.de/files/virsh.strace
Can't see the reason for the above mentioned error in there...
Kind regards,
Felix Krohn
--
Felix Krohn / After silence, that which comes ]
|-> smtp, xmpp: felix(a)kro.hn / nearest to expressing the inexpres-]
|-> gpg: 0x1C246E3B / sible is music. [Aldous Huxley]
|-> https://kro.hn / http://www.flickr.com/kro_royal ]
16 years, 9 months