root = xmlDocGetRootElement(xml);
if ((root == NULL) || (!xmlStrEqual(root->name, BAD_CAST "domain"))) {
- error(conn, VIR_ERR_INTERNAL_ERROR, "incorrect root element");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("incorrect root element"));
goto bail_out;
}
/* Find out what type of OPENVZ virtualization to use */
if (!(prop = xmlGetProp(root, BAD_CAST "type"))) {
- error(conn, VIR_ERR_INTERNAL_ERROR, "missing domain type attribute");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("missing domain type attribute"));
goto bail_out;
}
if (strcmp((char *)prop, "openvz")){
- error(conn, VIR_ERR_INTERNAL_ERROR, "invalid domain type attribute");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("invalid domain type attribute"_));
goto bail_out;
}
free(prop);
obj = xmlXPathEval(BAD_CAST "string(/domain/name[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING) ||
(obj->stringval == NULL) || (obj->stringval[0] == 0)) {
- error(conn, VIR_ERR_INTERNAL_ERROR,"invalid domain name");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("invalid domain name"));
goto bail_out;
}
/* rejecting VPS ID <= OPENVZ_RSRV_VM_LIMIT for they are reserved */
if (strtoI((const char *) obj->stringval) <= OPENVZ_RSRV_VM_LIMIT) {
error(conn, VIR_ERR_INTERNAL_ERROR,
- "VPS ID Error (must be an integer greater than 100");
+ _("VPS ID Error (must be an integer greater than 100"));
goto bail_out;
}
strncpy(def->name, (const char *) obj->stringval, OPENVZ_NAME_MAX);
int err;
if ((err = virUUIDGenerate(def->uuid))) {
- error(conn, VIR_ERR_INTERNAL_ERROR, "Failed to generate UUID");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("Failed to generate UUID"));
goto bail_out;
}
} else if (virUUIDParse((const char *)obj->stringval, def->uuid) < 0) {
- error(conn, VIR_ERR_INTERNAL_ERROR, "malformed uuid element");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("malformed uuid element"));
goto bail_out;
}
xmlXPathFreeObject(obj);
if (xmlStrlen(obj->stringval) >= (OPENVZ_IP_MAX)) {
char errorMessage[OPENVZ_MAX_ERROR_LEN];
- snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "ipaddress length too long");
+ snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s",
+ _("ipaddress length too long"));
error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
goto bail_out;
}
if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
char errorMessage[OPENVZ_MAX_ERROR_LEN];
- snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "netmask length too long");
+ snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s",
+ _("netmask length too long"));
error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
goto bail_out;
}
if (strlen((const char *) obj->stringval) >= (OPENVZ_HOSTNAME_MAX - 1)) {
char errorMessage[OPENVZ_MAX_ERROR_LEN];
- snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "hostname length too long");
+ snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1,
+ "%s", _("hostname length too long"));
error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
goto bail_out;
}
if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
char errorMessage[OPENVZ_MAX_ERROR_LEN];
- snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "gateway length too long");
+ snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1,
+ "%s", _("gateway length too long"));
error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
goto bail_out;
}
if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
char errorMessage[OPENVZ_MAX_ERROR_LEN];
- snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "nameserver length too long");
+ snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1,
+ "%s", _("nameserver length too long"));
error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
goto bail_out;
}
if (strlen((const char *) obj->stringval) >= (OPENVZ_PROFILE_MAX - 1)) {
char errorMessage[OPENVZ_MAX_ERROR_LEN];
- snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "profile length too long");
+ snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1,
+ "%s", _("profile length too long"));
error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
goto bail_out;
}
driver->num_inactive = 0;
if((fp = popen(VZLIST " -a -ovpsid,status -H 2>/dev/null", "r")) == NULL) {
- error(conn, VIR_ERR_INTERNAL_ERROR, "popen failed");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("popen failed"));
return NULL;
}
pnext = &vm;
while(!feof(fp)) {
*pnext = calloc(1, sizeof(**pnext));
if(!*pnext) {
- error(conn, VIR_ERR_INTERNAL_ERROR, "calloc failed");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("calloc failed"));
goto error;
}
if (fscanf(fp, "%d %s\n", &veid, status) != 2) {
error(conn, VIR_ERR_INTERNAL_ERROR,
- "Failed to parse vzlist output");
+ _("Failed to parse vzlist output"));
goto error;
}
if(strcmp(status, "stopped")) {
vmdef = calloc(1, sizeof(*vmdef));
if(!vmdef) {
- error(conn, VIR_ERR_INTERNAL_ERROR, "calloc failed");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("calloc failed"));
goto error;
}
if(ret == -1) {
error(conn, VIR_ERR_INTERNAL_ERROR,
- "UUID in config file malformed");
+ _("UUID in config file malformed"));
free(vmdef);
goto error;
}
if (stat(file, &sb) < 0) {
__virRaiseError (conn, NULL, NULL, VIR_FROM_REMOTE, VIR_ERR_RPC,
VIR_ERR_ERROR, LIBVIRT_CACERT, NULL, NULL, 0, 0,
- "Cannot access %s '%s': %s (%d)",
+ _("Cannot access %s '%s': %s (%d)"),
type, file, strerror(errno), errno);
return -1;
}
}
if (len != 1 || buf[0] != '\1') {
error (conn, VIR_ERR_RPC,
- "server verification (of our certificate or IP address) failed\n");
+ _("server verification (of our certificate or IP address) failed\n"));
return NULL;
}
VIR_FROM_REMOTE, VIR_ERR_RPC,
VIR_ERR_ERROR, priv->hostname, NULL, NULL,
0, 0,
- "Certificate's owner does not match the hostname (%s)",
+ _("Certificate's owner does not match the hostname (%s)"),
priv->hostname);
gnutls_x509_crt_deinit (cert);
return -1;
want = REMOTE_AUTH_POLKIT;
} else {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "unknown authentication type %s", authtype);
+ VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
+ NULL, NULL, NULL, 0, 0,
+ _("unknown authentication type %s"), authtype);
return -1;
}
for (i = 0 ; i < ret.types.types_len ; i++) {
if (type == REMOTE_AUTH_NONE) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "requested authentication type %s rejected", authtype);
+ _("requested authentication type %s rejected"),
+ authtype);
return -1;
}
} else {
default:
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "unsupported authentication type %d", ret.types.types_val[0]);
+ VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
+ NULL, NULL, NULL, 0, 0,
+ _("unsupported authentication type %d"),
+ ret.types.types_val[0]);
free(ret.types.types_val);
return -1;
}
port, sizeof(port),
NI_NUMERICHOST | NI_NUMERICSERV)) != 0) {
__virRaiseError (NULL, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_NO_MEMORY, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "Cannot resolve address %d: %s", err, gai_strerror(err));
+ VIR_ERR_NO_MEMORY, VIR_ERR_ERROR,
+ NULL, NULL, NULL, 0, 0,
+ _("Cannot resolve address %d: %s"),
+ err, gai_strerror(err));
return NULL;
}
addr = malloc(strlen(host) + 1 + strlen(port) + 1);
if (!addr) {
__virRaiseError (NULL, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_NO_MEMORY, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
+ VIR_ERR_NO_MEMORY, VIR_ERR_ERROR,
+ NULL, NULL, NULL, 0, 0,
"address");
return NULL;
}
if (err != SASL_OK) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "failed to initialize SASL library: %d (%s)",
+ _("failed to initialize SASL library: %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
goto cleanup;
}
if (getsockname(priv->sock, (struct sockaddr*)&sa, &salen) < 0) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "failed to get sock address %d (%s)",
+ _("failed to get sock address %d (%s)"),
socket_errno (), strerror(socket_errno ()));
goto cleanup;
}
if (getpeername(priv->sock, (struct sockaddr*)&sa, &salen) < 0) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "failed to get peer address %d (%s)",
+ _("failed to get peer address %d (%s)"),
socket_errno (), strerror(socket_errno ()));
goto cleanup;
}
if (err != SASL_OK) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "Failed to create SASL client context: %d (%s)",
+ _("Failed to create SASL client context: %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
goto cleanup;
}
if (!(ssf = (sasl_ssf_t)gnutls_cipher_get_key_size(cipher))) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "invalid cipher size for TLS session");
+ "%s", _("invalid cipher size for TLS session"));
goto cleanup;
}
ssf *= 8; /* key size is bytes, sasl wants bits */
if (err != SASL_OK) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "cannot set external SSF %d (%s)",
+ _("cannot set external SSF %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
goto cleanup;
}
if (err != SASL_OK) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "cannot set security props %d (%s)",
+ _("cannot set security props %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
goto cleanup;
}
if (wantmech) {
if (strstr(mechlist, wantmech) == NULL) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "SASL mechanism %s not supported by server", wantmech);
+ VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
+ NULL, NULL, NULL, 0, 0,
+ _("SASL mechanism %s not supported by server"),
+ wantmech);
free(iret.mechlist);
goto cleanup;
}
if (err != SASL_OK && err != SASL_CONTINUE && err != SASL_INTERACT) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "Failed to start SASL negotiation: %d (%s)",
+ _("Failed to start SASL negotiation: %d (%s)"),
err, sasl_errdetail(saslconn));
free(iret.mechlist);
goto cleanup;
if ((ncred =
remoteAuthMakeCredentials(interact, &cred)) < 0) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "Failed to make auth credentials");
+ VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
+ NULL, NULL, NULL, 0, 0,
+ "%s", _("Failed to make auth credentials"));
free(iret.mechlist);
goto cleanup;
}
if (clientoutlen > REMOTE_AUTH_SASL_DATA_MAX) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "SASL negotiation data too long: %d bytes", clientoutlen);
+ _("SASL negotiation data too long: %d bytes"),
+ clientoutlen);
goto cleanup;
}
/* NB, distinction of NULL vs "" is *critical* in SASL */
if (err != SASL_OK && err != SASL_CONTINUE && err != SASL_INTERACT) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "Failed SASL step: %d (%s)",
+ _("Failed SASL step: %d (%s)"),
err, sasl_errdetail(saslconn));
goto cleanup;
}
if ((ncred = remoteAuthMakeCredentials(interact, &cred)) < 0) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "Failed to make auth credentials");
+ "%s", _("Failed to make auth credentials"));
goto cleanup;
}
/* Run the authentication callback */
if (err != SASL_OK) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "cannot query SASL ssf on connection %d (%s)",
+ _("cannot query SASL ssf on connection %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
goto cleanup;
}
if (ssf < 56) { /* 56 == DES level, good for Kerberos */
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "negotiation SSF %d was not strong enough", ssf);
+ _("negotiation SSF %d was not strong enough"), ssf);
goto cleanup;
}
}
if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "Failed to collect auth credentials");
+ _("Failed to collect auth credentials"));
return -1;
}
} else {
xdrmem_create (&xdr, buffer, sizeof buffer, XDR_ENCODE);
if (!xdr_remote_message_header (&xdr, &hdr)) {
error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
- VIR_ERR_RPC, "xdr_remote_message_header");
+ VIR_ERR_RPC, _("xdr_remote_message_header failed"));
return -1;
}
/* Encode the length word. */
xdrmem_create (&xdr, buffer2, sizeof buffer2, XDR_ENCODE);
if (!xdr_int (&xdr, &len)) {
- error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, VIR_ERR_RPC, _("xdr_int (length word)"));
+ error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, VIR_ERR_RPC,
+ _("xdr_int (length word)"));
return -1;
}
xdr_destroy (&xdr);
xdrmem_create (&xdr, buffer2, sizeof buffer2, XDR_DECODE);
if (!xdr_int (&xdr, &len)) {
error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
- VIR_ERR_RPC, "xdr_int (length word, reply)");
+ VIR_ERR_RPC, _("xdr_int (length word, reply)"));
return -1;
}
xdr_destroy (&xdr);
if (len < 0 || len > REMOTE_MESSAGE_MAX) {
error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
- VIR_ERR_RPC, "packet received from server too large");
+ VIR_ERR_RPC, _("packet received from server too large"));
return -1;
}
xdrmem_create (&xdr, buffer, len, XDR_DECODE);
if (!xdr_remote_message_header (&xdr, &hdr)) {
error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
- VIR_ERR_RPC, "xdr_remote_message_header (reply)");
+ VIR_ERR_RPC, _("invalid header in reply"));
return -1;
}
/* Check program, version, etc. are what we expect. */
if (hdr.prog != REMOTE_PROGRAM) {
- __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
+ __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
+ NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "unknown program (received %x, expected %x)",
+ _("unknown program (received %x, expected %x)"),
hdr.prog, REMOTE_PROGRAM);
return -1;
}
if (hdr.vers != REMOTE_PROTOCOL_VERSION) {
- __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
+ __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
+ NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "unknown protocol version (received %x, expected %x)",
+ _("unknown protocol version (received %x, expected %x)"),
hdr.vers, REMOTE_PROTOCOL_VERSION);
return -1;
}
* message being received at this point.
*/
if (hdr.proc != proc_nr) {
- __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
+ __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
+ NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "unknown procedure (received %x, expected %x)",
+ _("unknown procedure (received %x, expected %x)"),
hdr.proc, proc_nr);
return -1;
}
if (hdr.direction != REMOTE_REPLY) {
- __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
+ __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
+ NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "unknown direction (received %x, expected %x)",
+ _("unknown direction (received %x, expected %x)"),
hdr.direction, REMOTE_REPLY);
return -1;
}
if (hdr.serial != serial) {
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "unknown serial (received %x, expected %x)",
+ _("unknown serial (received %x, expected %x)"),
hdr.serial, serial);
return -1;
}
default:
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "unknown status (received %x)",
+ _("unknown status (received %x)"),
hdr.status);
xdr_destroy (&xdr);
return -1;
}
if (err == 0) {
error (in_open ? NULL : conn,
- VIR_ERR_RPC, "socket closed unexpectedly");
+ VIR_ERR_RPC, _("socket closed unexpectedly"));
return -1;
}
return err;
}
if (err == 0) {
error (in_open ? NULL : conn,
- VIR_ERR_RPC, "socket closed unexpectedly");
+ VIR_ERR_RPC, _("socket closed unexpectedly"));
return -1;
}
return err;