msg_gen_function += DISABLE_fprintf
msg_gen_function += ERROR
msg_gen_function += ERROR0
+msg_gen_function += ESX_ERROR
+msg_gen_function += ESX_VI_ERROR
msg_gen_function += REMOTE_DEBUG
msg_gen_function += ReportError
msg_gen_function += VIR_FREE
src/cpu/cpu_map.c
src/cpu/cpu_x86.c
src/datatypes.c
+src/esx/esx_driver.c
+src/esx/esx_util.c
+src/esx/esx_vi.c
+src/esx/esx_vi_methods.c
+src/esx/esx_vi_types.c
+src/esx/esx_vmx.c
src/interface/netcf_driver.c
src/libvirt.c
src/lxc/lxc_container.c
#include <config.h>
#include "internal.h"
-#include "virterror_internal.h"
#include "util.h"
#include "memory.h"
#include "logging.h"
#define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_ERROR(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
- __LINE__, __VA_ARGS__)
-
static virDrvOpenStatus
#include <netdb.h>
#include "internal.h"
-#include "virterror_internal.h"
#include "domain_conf.h"
#include "authhelper.h"
#include "util.h"
#define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_ERROR(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
- __LINE__, __VA_ARGS__)
-
static int esxDomainGetMaxVcpus(virDomainPtr domain);
}
if (hostSystem == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve the HostSystem object");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the HostSystem object"));
goto failure;
}
"%*c%*c%c%*c:"_SKIP12":"_SKIP12":%*c%*c%*c%c",
&edxLongModeBit, &edxFirstBit) != 2) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "HostSystem property 'hardware.cpuFeature[].edx' "
- "with value '%s' doesn't have expected format "
- "'----:----:----:----:----:----:----:----'",
+ _("HostSystem property 'hardware.cpuFeature[].edx' "
+ "with value '%s' doesn't have expected format "
+ "'----:----:----:----:----:----:----:----'"),
hostCpuIdInfo->edx);
goto failure;
}
priv->supportsLongMode = esxVI_Boolean_False;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Bit 29 (Long Mode) of HostSystem property "
- "'hardware.cpuFeature[].edx' with value '%s' "
- "has unexpected value '%c', expecting '0' "
- "or '1'", hostCpuIdInfo->edx, edxLongModeBit);
+ _("Bit 29 (Long Mode) of HostSystem property "
+ "'hardware.cpuFeature[].edx' with value '%s' "
+ "has unexpected value '%c', expecting '0' "
+ "or '1'"), hostCpuIdInfo->edx, edxLongModeBit);
goto failure;
}
username = virRequestUsername(auth, "root", conn->uri->server);
if (username == NULL) {
- ESX_ERROR(VIR_ERR_AUTH_FAILED, "Username request failed");
+ ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed"));
goto failure;
}
}
password = virRequestPassword(auth, username, conn->uri->server);
if (password == NULL) {
- ESX_ERROR(VIR_ERR_AUTH_FAILED, "Password request failed");
+ ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed"));
goto failure;
}
if (priv->host->productVersion != esxVI_ProductVersion_ESX35 &&
priv->host->productVersion != esxVI_ProductVersion_ESX40) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "%s is neither an ESX 3.5 host nor an ESX 4.0 host",
+ _("%s is neither an ESX 3.5 host nor an ESX 4.0 host"),
conn->uri->server);
goto failure;
}
} else { /* GSX */
if (priv->host->productVersion != esxVI_ProductVersion_GSX20) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "%s isn't a GSX 2.0 host", conn->uri->server);
+ _("%s isn't a GSX 2.0 host"), conn->uri->server);
goto failure;
}
}
if (virStrcpyStatic(vCenterIpAddress,
dynamicProperty->val->string) == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "vCenter IP address %s too big for "
- "destination", dynamicProperty->val->string);
+ _("vCenter IP address %s too big for "
+ "destination"),
+ dynamicProperty->val->string);
goto failure;
}
} else if (STRNEQ(vCenterIpAddress,
dynamicProperty->val->string)) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "This host is managed by a vCenter with IP "
- "address %s, but a mismachting vCenter '%s' "
- "(%s) has been specified",
+ _("This host is managed by a vCenter with IP "
+ "address %s, but a mismachting vCenter '%s' "
+ "(%s) has been specified"),
dynamicProperty->val->string, vCenter,
vCenterIpAddress);
goto failure;
}
if (STREQ(vCenter, "*")) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "This host is not managed by a vCenter");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("This host is not managed by a vCenter"));
goto failure;
}
username = virRequestUsername(auth, "administrator", vCenter);
if (username == NULL) {
- ESX_ERROR(VIR_ERR_AUTH_FAILED, "Username request failed");
+ ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed"));
goto failure;
}
password = virRequestPassword(auth, username, vCenter);
if (password == NULL) {
- ESX_ERROR(VIR_ERR_AUTH_FAILED, "Password request failed");
+ ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed"));
goto failure;
}
if (priv->vCenter->productVersion != esxVI_ProductVersion_VPX25 &&
priv->vCenter->productVersion != esxVI_ProductVersion_VPX40) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "%s is neither a vCenter 2.5 server nor a vCenter "
- "4.0 server", conn->uri->server);
+ _("%s is neither a vCenter 2.5 server nor a vCenter "
+ "4.0 server"), conn->uri->server);
goto failure;
}
}
}
if (hostSystem == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve the HostSystem object");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the HostSystem object"));
goto failure;
}
if (virParseVersionString(priv->host->service->about->version,
version) < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not parse version number from '%s'",
+ _("Could not parse version number from '%s'"),
priv->host->service->about->version);
return -1;
}
if (hostSystem == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve the HostSystem object");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the HostSystem object"));
goto failure;
}
}
if (hostName == NULL || strlen(hostName) < 1) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing or empty 'hostName' property");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Missing or empty 'hostName' property"));
goto failure;
}
}
if (hostSystem == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve the HostSystem object");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the HostSystem object"));
goto failure;
}
sizeof(nodeinfo->model) - 1,
sizeof(nodeinfo->model)) == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "CPU Model %s too long for destination",
+ _("CPU Model %s too long for destination"),
dynamicProperty->val->string);
goto failure;
}
&ids[count]) < 0 ||
ids[count] <= 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Failed to parse positive integer from '%s'",
+ _("Failed to parse positive integer from '%s'"),
virtualMachine->obj->value);
goto failure;
}
}
if (domain == NULL) {
- ESX_ERROR(VIR_ERR_NO_DOMAIN, "No domain with ID %d", id);
+ ESX_ERROR(VIR_ERR_NO_DOMAIN, _("No domain with ID %d"), id);
}
cleanup:
}
if (virtualMachine == NULL) {
- ESX_ERROR(VIR_ERR_NO_DOMAIN, "No domain with name '%s'", name);
+ ESX_ERROR(VIR_ERR_NO_DOMAIN, _("No domain with name '%s'"), name);
goto failure;
}
}
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered on");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not powered on"));
goto failure;
}
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not suspend domain");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not suspend domain"));
goto failure;
}
}
if (powerState != esxVI_VirtualMachinePowerState_Suspended) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not suspended");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not suspended"));
goto failure;
}
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not resume domain");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not resume domain"));
goto failure;
}
}
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered on");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not powered on"));
goto failure;
}
}
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered on");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not powered on"));
goto failure;
}
}
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered on");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not powered on"));
goto failure;
}
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not destroy domain");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not destroy domain"));
goto failure;
}
}
if (dynamicProperty->val->int32 < 0) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Got invalid memory size %d",
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
+ _("Got invalid memory size %d"),
dynamicProperty->val->int32);
} else {
memoryMB = dynamicProperty->val->int32;
if (taskInfoState != esxVI_TaskInfoState_Success) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not set max-memory to %lu kilobytes", memory);
+ _("Could not set max-memory to %lu kilobytes"), memory);
goto failure;
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not set memory to %lu kilobytes", memory);
+ _("Could not set memory to %lu kilobytes"), memory);
goto failure;
}
esxVI_TaskInfoState taskInfoState;
if (nvcpus < 1) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Requested number of virtual CPUs must at least be 1");
+ ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
+ _("Requested number of virtual CPUs must at least be 1"));
goto failure;
}
if (nvcpus > maxVcpus) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Requested number of virtual CPUs is greater than max "
- "allowable number of virtual CPUs for the domain: %d > %d",
+ _("Requested number of virtual CPUs is greater than max "
+ "allowable number of virtual CPUs for the domain: %d > %d"),
nvcpus, maxVcpus);
goto failure;
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not set number of virtual CPUs to %d", nvcpus);
+ _("Could not set number of virtual CPUs to %d"), nvcpus);
goto failure;
}
}
if (hostSystem == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve the HostSystem object");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the HostSystem object"));
goto failure;
}
if (STRNEQ(nativeFormat, "vmware-vmx")) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Unsupported config format '%s'", nativeFormat);
+ _("Unsupported config format '%s'"), nativeFormat);
return NULL;
}
if (STRNEQ(nativeFormat, "vmware-vmx")) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Unsupported config format '%s'", nativeFormat);
+ _("Unsupported config format '%s'"), nativeFormat);
return NULL;
}
}
if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered off");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not powered off"));
goto failure;
}
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not start domain");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not start domain"));
goto failure;
}
if (virtualMachine != NULL) {
/* FIXME */
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Domain already exists, editing existing domains is not "
- "supported yet");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Domain already exists, editing existing domains is not "
+ "supported yet"));
goto failure;
}
* datastore isn't perfect but should work in the majority of cases.
*/
if (def->ndisks < 1) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Domain XML doesn't contain any disks, cannot deduce "
- "datastore and path for VMX file");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Domain XML doesn't contain any disks, cannot deduce "
+ "datastore and path for VMX file"));
goto failure;
}
}
if (disk == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Domain XML doesn't contain any file-based harddisks, "
- "cannot deduce datastore and path for VMX file");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Domain XML doesn't contain any file-based harddisks, "
+ "cannot deduce datastore and path for VMX file"));
goto failure;
}
if (disk->src == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "First file-based harddisk has no source, cannot deduce "
- "datastore and path for VMX file");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("First file-based harddisk has no source, cannot deduce "
+ "datastore and path for VMX file"));
goto failure;
}
if (! virFileHasSuffix(fileName, ".vmdk")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting source '%s' of first file-based harddisk to be a "
- "VMDK image", disk->src);
+ _("Expecting source '%s' of first file-based harddisk to "
+ "be a VMDK image"), disk->src);
goto failure;
}
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not define domain");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not define domain"));
goto failure;
}
if (powerState != esxVI_VirtualMachinePowerState_Suspended &&
powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID,
- "Domain is not suspended or powered off");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not suspended or powered off"));
goto failure;
}
int i = 0;
if (*nparams < 3) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Parameter array must have space for 3 items");
+ ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
+ _("Parameter array must have space for 3 items"));
goto failure;
}
default:
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Shares level has unknown value %d",
+ _("Shares level has unknown value %d"),
(int)sharesInfo->level);
goto failure;
}
if (params[i].value.l < 0) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Could not set reservation to %lld MHz, expecting "
- "positive value", params[i].value.l);
+ _("Could not set reservation to %lld MHz, expecting "
+ "positive value"), params[i].value.l);
goto failure;
}
if (params[i].value.l < -1) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Could not set limit to %lld MHz, expecting "
- "positive value or -1 (unlimited)",
+ _("Could not set limit to %lld MHz, expecting "
+ "positive value or -1 (unlimited)"),
params[i].value.l);
goto failure;
}
default:
ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Could not set shares to %d, expecting positive "
- "value or -1 (low), -2 (normal) or -3 (high)",
+ _("Could not set shares to %d, expecting positive "
+ "value or -1 (low), -2 (normal) or -3 (high)"),
params[i].value.i);
goto failure;
}
}
} else {
- ESX_ERROR(VIR_ERR_INVALID_ARG, "Unknown field '%s'",
+ ESX_ERROR(VIR_ERR_INVALID_ARG, _("Unknown field '%s'"),
params[i].field);
goto failure;
}
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not change scheduler parameters");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not change scheduler parameters"));
goto failure;
}
esxVI_TaskInfoState taskInfoState;
if (priv->vCenter == NULL) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Migration not possible without a vCenter");
+ ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
+ _("Migration not possible without a vCenter"));
goto failure;
}
if (dname != NULL) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Renaming domains on migration not supported");
+ ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
+ _("Renaming domains on migration not supported"));
goto failure;
}
*/
if (eventList->fullFormattedMessage != NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not migrate domain, validation reported a "
- "problem: %s", eventList->fullFormattedMessage);
+ _("Could not migrate domain, validation reported a "
+ "problem: %s"), eventList->fullFormattedMessage);
} else {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not migrate domain, validation reported a "
- "problem");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not migrate domain, validation reported a "
+ "problem"));
}
goto failure;
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not migrate domain, migration task finished with "
- "an error");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not migrate domain, migration task finished with "
+ "an error"));
goto failure;
}
}
if (resourcePoolResourceUsage == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve memory usage of resource pool");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve memory usage of resource pool"));
goto failure;
}
#include <config.h>
#include "internal.h"
-#include "virterror_internal.h"
#include "util.h"
#include "memory.h"
#include "logging.h"
#define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_ERROR(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
- __LINE__, __VA_ARGS__)
-
static virDrvOpenStatus
#include <config.h>
#include "internal.h"
-#include "virterror_internal.h"
#include "util.h"
#include "memory.h"
#include "logging.h"
#define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_ERROR(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
- __LINE__, __VA_ARGS__)
-
static virDrvOpenStatus
# define __ESX_PRIVATE_H__
# include "internal.h"
+# include "virterror_internal.h"
# include "capabilities.h"
# include "esx_vi.h"
+# define ESX_ERROR(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+ __LINE__, __VA_ARGS__)
+
typedef struct _esxPrivate {
esxVI_Context *host;
esxVI_Context *vCenter;
#include <config.h>
#include "internal.h"
-#include "virterror_internal.h"
#include "util.h"
#include "memory.h"
#include "logging.h"
#define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_ERROR(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
- __LINE__, __VA_ARGS__)
-
static virDrvOpenStatus
#include <config.h>
#include "internal.h"
-#include "virterror_internal.h"
#include "util.h"
#include "memory.h"
#include "logging.h"
#define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_ERROR(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
- __LINE__, __VA_ARGS__)
-
static virDrvOpenStatus
#include <netdb.h>
#include "internal.h"
-#include "virterror_internal.h"
#include "datatypes.h"
#include "qparams.h"
#include "util.h"
#include "memory.h"
#include "logging.h"
#include "uuid.h"
+#include "esx_private.h"
#include "esx_util.h"
#define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_ERROR(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
- __LINE__, __VA_ARGS__)
-
/* AI_ADDRCONFIG is missing on some systems. */
#ifndef AI_ADDRCONFIG
# define AI_ADDRCONFIG 0
if (STRNEQ(*transport, "http") && STRNEQ(*transport, "https")) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Query parameter 'transport' has unexpected value "
- "'%s' (should be http|https)", *transport);
+ _("Query parameter 'transport' has unexpected value "
+ "'%s' (should be http|https)"), *transport);
goto failure;
}
} else if (STRCASEEQ(queryParam->name, "vcenter")) {
if (virStrToLong_i(queryParam->value, NULL, 10, noVerify) < 0 ||
(*noVerify != 0 && *noVerify != 1)) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Query parameter 'no_verify' has unexpected value "
- "'%s' (should be 0 or 1)", queryParam->value);
+ _("Query parameter 'no_verify' has unexpected value "
+ "'%s' (should be 0 or 1)"), queryParam->value);
goto failure;
}
} else if (STRCASEEQ(queryParam->name, "auto_answer")) {
if (virStrToLong_i(queryParam->value, NULL, 10, autoAnswer) < 0 ||
(*autoAnswer != 0 && *autoAnswer != 1)) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
- "Query parameter 'auto_answer' has unexpected value "
- "'%s' (should be 0 or 1)", queryParam->value);
+ _("Query parameter 'auto_answer' has unexpected "
+ "value '%s' (should be 0 or 1)"), queryParam->value);
goto failure;
}
} else {
if (datastoreName == NULL || *datastoreName != NULL ||
directoryName == NULL || *directoryName != NULL ||
fileName == NULL || *fileName != NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
if (sscanf(datastoreRelatedPath, "[%a[^]%]] %a[^\n]", datastoreName,
&directoryAndFileName) != 2) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Datastore related path '%s' doesn't have expected format "
- "'[<datastore>] <path>'", datastoreRelatedPath);
+ _("Datastore related path '%s' doesn't have expected format "
+ "'[<datastore>] <path>'"), datastoreRelatedPath);
goto failure;
}
if (*separator == '\0') {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Datastore related path '%s' doesn't reference a file",
+ _("Datastore related path '%s' doesn't reference a file"),
datastoreRelatedPath);
goto failure;
}
if (errcode != 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "IP address lookup for host '%s' failed: %s", hostname,
+ _("IP address lookup for host '%s' failed: %s"), hostname,
gai_strerror(errcode));
return -1;
}
if (result == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "No IP address for host '%s' found: %s", hostname,
+ _("No IP address for host '%s' found: %s"), hostname,
gai_strerror(errcode));
return -1;
}
if (errcode != 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Formating IP address for host '%s' failed: %s", hostname,
+ _("Formating IP address for host '%s' failed: %s"), hostname,
gai_strerror(errcode));
freeaddrinfo(result);
return -1;
}
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing essential config entry '%s'", name);
+ _("Missing essential config entry '%s'"), name);
return -1;
}
if (value->type != VIR_CONF_STRING) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Config entry '%s' must be a string", name);
+ _("Config entry '%s' must be a string"), name);
return -1;
}
}
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing essential config entry '%s'", name);
+ _("Missing essential config entry '%s'"), name);
return -1;
}
return 0;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing essential config entry '%s'", name);
+ _("Missing essential config entry '%s'"), name);
return -1;
}
}
if (value->type != VIR_CONF_STRING) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Config entry '%s' must be a string", name);
+ _("Config entry '%s' must be a string"), name);
return -1;
}
return 0;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing essential config entry '%s'", name);
+ _("Missing essential config entry '%s'"), name);
return -1;
}
}
if (virUUIDParse(value->str, uuid) < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not parse UUID from string '%s'", value->str);
+ _("Could not parse UUID from string '%s'"), value->str);
return -1;
}
return 0;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing essential config entry '%s'", name);
+ _("Missing essential config entry '%s'"), name);
return -1;
}
}
return 0;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing essential config entry '%s'", name);
+ _("Missing essential config entry '%s'"), name);
return -1;
}
}
*number = -1;
} else if (virStrToLong_ll(value->str, NULL, 10, number) < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Config entry '%s' must represent an integer value",
+ _("Config entry '%s' must represent an integer value"),
name);
return -1;
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Config entry '%s' must be a string", name);
+ _("Config entry '%s' must be a string"), name);
return -1;
}
return 0;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing essential config entry '%s'", name);
+ _("Missing essential config entry '%s'"), name);
return -1;
}
}
return 0;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing essential config entry '%s'", name);
+ _("Missing essential config entry '%s'"), name);
return -1;
}
}
*boolean_ = 0;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Config entry '%s' must represent a boolean value "
- "(true|false)", name);
+ _("Config entry '%s' must represent a boolean value "
+ "(true|false)"), name);
return -1;
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Config entry '%s' must be a string", name);
+ _("Config entry '%s' must be a string"), name);
return -1;
}
#include "logging.h"
#include "util.h"
#include "uuid.h"
-#include "virterror_internal.h"
#include "xml.h"
#include "esx_vi.h"
#include "esx_vi_methods.h"
#define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_VI_ERROR(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
- __LINE__, __VA_ARGS__)
-
#define ESX_VI__SOAP__REQUEST_HEADER \
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
"<soapenv:Envelope " \
if (errorCode != CURLE_OK) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "curl_easy_perform() returned an error: %s (%d) : %s",
+ _("curl_easy_perform() returned an error: %s (%d) : %s"),
curl_easy_strerror(errorCode), errorCode, ctx->curl_error);
return -1;
}
if (errorCode != CURLE_OK) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned an "
- "error: %s (%d) : %s", curl_easy_strerror(errorCode),
+ _("curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned an "
+ "error: %s (%d) : %s"), curl_easy_strerror(errorCode),
errorCode, ctx->curl_error);
return -1;
}
if (responseCode < 0) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned a "
- "negative response code");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned a "
+ "negative response code"));
return -1;
}
if (errorCode != CURLE_OK) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "curl_easy_getinfo(CURLINFO_REDIRECT_URL) returned "
- "an error: %s (%d) : %s", curl_easy_strerror(errorCode),
+ _("curl_easy_getinfo(CURLINFO_REDIRECT_URL) returned "
+ "an error: %s (%d) : %s"),
+ curl_easy_strerror(errorCode),
errorCode, ctx->curl_error);
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "The server redirects from '%s' to '%s'", url,
+ _("The server redirects from '%s' to '%s'"), url,
redirectUrl);
}
#else
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "The server redirects from '%s'", url);
+ _("The server redirects from '%s'"), url);
#endif
return -1;
if (ctx == NULL || url == NULL || ipAddress == NULL || username == NULL ||
password == NULL || ctx->url != NULL || ctx->service != NULL ||
ctx->curl_handle != NULL || ctx->curl_headers != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
goto failure;
}
ctx->curl_handle = curl_easy_init();
if (ctx->curl_handle == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not initialize CURL");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not initialize CURL"));
goto failure;
}
"Expect: nothing");
if (ctx->curl_headers == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not build CURL header list");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not build CURL header list"));
goto failure;
}
#endif
if (virMutexInit(&ctx->curl_lock) < 0) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not initialize CURL mutex");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not initialize CURL mutex"));
goto failure;
}
ctx->apiVersion = esxVI_APIVersion_40;
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VI API major/minor version '2.5' or '4.0' "
- "but found '%s'", ctx->service->about->apiVersion);
+ _("Expecting VI API major/minor version '2.5' or '4.0' "
+ "but found '%s'"), ctx->service->about->apiVersion);
goto failure;
}
ctx->productVersion = esxVI_ProductVersion_GSX20;
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting GSX major/minor version '2.0' but "
- "found '%s'", ctx->service->about->version);
+ _("Expecting GSX major/minor version '2.0' but "
+ "found '%s'"), ctx->service->about->version);
goto failure;
}
} else if (STREQ(ctx->service->about->productLineId, "esx") ||
ctx->productVersion = esxVI_ProductVersion_ESX40;
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting ESX major/minor version '3.5' or "
- "'4.0' but found '%s'",
+ _("Expecting ESX major/minor version '3.5' or "
+ "'4.0' but found '%s'"),
ctx->service->about->version);
goto failure;
}
ctx->productVersion = esxVI_ProductVersion_VPX40;
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VPX major/minor version '2.5' or '4.0' "
- "but found '%s'", ctx->service->about->version);
+ _("Expecting VPX major/minor version '2.5' or '4.0' "
+ "but found '%s'"), ctx->service->about->version);
goto failure;
}
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting product 'gsx' or 'esx' or 'embeddedEsx' "
- "or 'vpx' but found '%s'",
+ _("Expecting product 'gsx' or 'esx' or 'embeddedEsx' "
+ "or 'vpx' but found '%s'"),
ctx->service->about->productLineId);
goto failure;
}
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VI API type 'HostAgent' or 'VirtualCenter' "
- "but found '%s'", ctx->service->about->apiType);
+ _("Expecting VI API type 'HostAgent' or 'VirtualCenter' "
+ "but found '%s'"), ctx->service->about->apiType);
goto failure;
}
}
if (datacenterList == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve the 'datacenter' object from the VI "
- "host/center");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the 'datacenter' object from the "
+ "VI host/center"));
goto failure;
}
}
if (ctx->vmFolder == NULL || ctx->hostFolder == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "The 'datacenter' object is missing the "
- "'vmFolder'/'hostFolder' property");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("The 'datacenter' object is missing the "
+ "'vmFolder'/'hostFolder' property"));
goto failure;
}
int responseCode = 0;
if (content == NULL || *content != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
goto failure;
}
goto failure;
} else if (responseCode != 200) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "HTTP response code %d for download from '%s'",
+ _("HTTP response code %d for download from '%s'"),
responseCode, url);
goto failure;
}
int responseCode = 0;
if (content == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
return -1;
} else if (responseCode != 200 && responseCode != 201) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "HTTP response code %d for upload to '%s'",
+ _("HTTP response code %d for upload to '%s'"),
responseCode, url);
return -1;
}
xmlNodePtr responseNode = NULL;
if (request == NULL || response == NULL || *response != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
goto failure;
}
if ((*response)->document == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Response for call to '%s' could not be parsed",
+ _("Response for call to '%s' could not be parsed"),
methodName);
goto failure;
}
if (xmlDocGetRootElement((*response)->document) == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Response for call to '%s' is an empty XML document",
+ _("Response for call to '%s' is an empty XML document"),
methodName);
goto failure;
}
xpathContext = xmlXPathNewContext((*response)->document);
if (xpathContext == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not create XPath context");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not create XPath context"));
goto failure;
}
if ((*response)->node == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "HTTP response code %d for call to '%s'. "
- "Fault is unknown, XPath evaluation failed",
+ _("HTTP response code %d for call to '%s'. "
+ "Fault is unknown, XPath evaluation failed"),
(*response)->responseCode, methodName);
goto failure;
}
if (esxVI_Fault_Deserialize((*response)->node, &fault) < 0) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "HTTP response code %d for call to '%s'. "
- "Fault is unknown, deserialization failed",
+ _("HTTP response code %d for call to '%s'. "
+ "Fault is unknown, deserialization failed"),
(*response)->responseCode, methodName);
goto failure;
}
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "HTTP response code %d for call to '%s'. "
- "Fault: %s - %s", (*response)->responseCode,
+ _("HTTP response code %d for call to '%s'. "
+ "Fault: %s - %s"), (*response)->responseCode,
methodName, fault->faultcode, fault->faultstring);
/* FIXME: Dump raw response until detail part gets deserialized */
if (responseNode == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "XPath evaluation of response for call to '%s' "
- "failed", methodName);
+ _("XPath evaluation of response for call to '%s' "
+ "failed"), methodName);
goto failure;
}
case esxVI_Occurrence_RequiredItem:
if ((*response)->node == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Call to '%s' returned an empty result, "
- "expecting a non-empty result", methodName);
+ _("Call to '%s' returned an empty result, "
+ "expecting a non-empty result"), methodName);
goto failure;
} else if ((*response)->node->next != NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Call to '%s' returned a list, expecting "
- "exactly one item", methodName);
+ _("Call to '%s' returned a list, expecting "
+ "exactly one item"), methodName);
goto failure;
}
case esxVI_Occurrence_RequiredList:
if ((*response)->node == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Call to '%s' returned an empty result, "
- "expecting a non-empty result", methodName);
+ _("Call to '%s' returned an empty result, "
+ "expecting a non-empty result"), methodName);
goto failure;
}
if ((*response)->node != NULL &&
(*response)->node->next != NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Call to '%s' returned a list, expecting "
- "exactly one item", methodName);
+ _("Call to '%s' returned a list, expecting "
+ "exactly one item"), methodName);
goto failure;
}
case esxVI_Occurrence_None:
if ((*response)->node != NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Call to '%s' returned something, expecting "
- "an empty result", methodName);
+ _("Call to '%s' returned something, expecting "
+ "an empty result"), methodName);
goto failure;
}
break;
default:
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Invalid argument (occurrence)");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Invalid argument (occurrence)"));
goto failure;
}
}
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "HTTP response code %d for call to '%s'",
+ _("HTTP response code %d for call to '%s'"),
(*response)->responseCode, methodName);
goto failure;
}
int i;
if (anyType == NULL || value == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
if (anyType->type != enumeration->type) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting type '%s' but found '%s'",
+ _("Expecting type '%s' but found '%s'"),
esxVI_Type_ToString(enumeration->type),
esxVI_Type_ToString(anyType->type));
return -1;
}
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unknown value '%s' for %s", anyType->value,
+ _("Unknown value '%s' for %s"), anyType->value,
esxVI_Type_ToString(enumeration->type));
return -1;
const char *name = NULL;
if (element == NULL || output == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
}
if (name == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
char *name = NULL;
if (value == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
goto failure;
}
}
}
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Unknown value '%s' for %s",
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, _("Unknown value '%s' for %s"),
name, esxVI_Type_ToString(enumeration->type));
cleanup:
esxVI_List *next = NULL;
if (list == NULL || item == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
esxVI_List *src = NULL;
if (destList == NULL || *destList != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
goto failure;
}
if (list == NULL || *list != NULL ||
castFromAnyTypeFunc == NULL || freeFunc == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
if (! STRPREFIX(anyType->other, "ArrayOf")) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting type to begin with 'ArrayOf' but found '%s'",
+ _("Expecting type to begin with 'ArrayOf' but found '%s'"),
anyType->other);
return -1;
}
childNode = childNode->next) {
if (childNode->type != XML_ELEMENT_NODE) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Wrong XML element type %d", childNode->type);
+ _("Wrong XML element type %d"), childNode->type);
goto failure;
}
esxVI_List *item = NULL;
if (element == NULL || output == NULL || serializeFunc == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
if (list == NULL || *list != NULL ||
deserializeFunc == NULL || freeFunc == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
for (; node != NULL; node = node->next) {
if (node->type != XML_ELEMENT_NODE) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Wrong XML element type %d", node->type);
+ _("Wrong XML element type %d"), node->type);
goto failure;
}
esxVI_Alloc(void **ptrptr, size_t size)
{
if (ptrptr == NULL || *ptrptr != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
const char *currentSelectSetName = NULL;
if (fullTraversalSpecList == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
esxVI_BuildFullTraversalSpecList(esxVI_SelectionSpec **fullTraversalSpecList)
{
if (fullTraversalSpecList == NULL || *fullTraversalSpecList != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
#endif
if (ctx->session == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call"));
return -1;
}
goto failure;
}
} else if (STRNEQ(ctx->session->key, currentSession->key)) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Key of the current session differs from the key at "
- "last login");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Key of the current session differs from the key at "
+ "last login"));
goto failure;
}
esxVI_PropertyFilterSpec *propertyFilterSpec = NULL;
if (ctx->fullTraversalSpecList == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call"));
return -1;
}
}
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing '%s' property while looking for ManagedEntityStatus",
- propertyName);
+ _("Missing '%s' property while looking for "
+ "ManagedEntityStatus"), propertyName);
return -1;
}
}
}
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Missing 'runtime.powerState' property");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Missing 'runtime.powerState' property"));
return -1;
}
esxVI_DynamicProperty *dynamicProperty;
if (questionInfo == NULL || *questionInfo != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
esxVI_ManagedEntityStatus configStatus = esxVI_ManagedEntityStatus_Undefined;
if (STRNEQ(virtualMachine->obj->type, "VirtualMachine")) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "ObjectContent does not reference a virtual machine");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("ObjectContent does not reference a virtual machine"));
return -1;
}
if (esxUtil_ParseVirtualMachineIDString
(virtualMachine->obj->value, id) < 0 || *id <= 0) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not parse positive integer from '%s'",
+ _("Could not parse positive integer from '%s'"),
virtualMachine->obj->value);
goto failure;
}
if (name != NULL) {
if (*name != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
goto failure;
}
}
if (*name == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not get name of virtual machine");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not get name of virtual machine"));
goto failure;
}
}
}
if (uuid_string == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not get UUID of virtual machine");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not get UUID of virtual machine"));
goto failure;
}
if (virUUIDParse(uuid_string, uuid) < 0) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not parse UUID from string '%s'",
+ _("Could not parse UUID from string '%s'"),
uuid_string);
goto failure;
}
esxVI_ObjectContent *computeResource = NULL;
if (resourcePool == NULL || *resourcePool != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
}
if (managedObjectReference == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve compute resource of host system");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve compute resource of host system"));
goto failure;
}
}
if (computeResource == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve compute resource of host system");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve compute resource of host system"));
goto failure;
}
}
if ((*resourcePool) == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not retrieve resource pool of compute resource");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve resource pool of compute resource"));
goto failure;
}
esxVI_ManagedObjectReference *managedObjectReference = NULL;
if (hostSystem == NULL || *hostSystem != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
char uuid_string[VIR_UUID_STRING_BUFLEN] = "";
if (virtualMachine == NULL || *virtualMachine != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
return 0;
} else {
ESX_VI_ERROR(VIR_ERR_NO_DOMAIN,
- "Could not find domain with UUID '%s'", uuid_string);
+ _("Could not find domain with UUID '%s'"),
+ uuid_string);
goto failure;
}
}
char *name_candidate = NULL;
if (virtualMachine == NULL || *virtualMachine != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
return 0;
} else {
ESX_VI_ERROR(VIR_ERR_NO_DOMAIN,
- "Could not find domain with name '%s'", name);
+ _("Could not find domain with name '%s'"), name);
goto failure;
}
}
}
if (pendingTaskInfoList != NULL) {
- ESX_VI_ERROR(VIR_ERR_OPERATION_INVALID,
- "Other tasks are pending for this domain");
+ ESX_VI_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Other tasks are pending for this domain"));
goto failure;
}
int numInaccessibleDatastores = 0;
if (datastore == NULL || *datastore != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
if (occurrence == esxVI_Occurrence_OptionalItem) {
goto cleanup;
} else {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "No datastores available");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("No datastores available"));
goto failure;
}
}
}
if (accessible == esxVI_Boolean_Undefined) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Got incomplete response while querying for the "
- "datastore 'summary.accessible' property");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Got incomplete response while querying for the "
+ "datastore 'summary.accessible' property"));
goto failure;
}
if (! STRPREFIX(dynamicProperty->val->string,
"/vmfs/volumes/")) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Datastore URL '%s' has unexpected prefix, "
- "expecting '/vmfs/volumes/' prefix",
+ _("Datastore URL '%s' has unexpected prefix, "
+ "expecting '/vmfs/volumes/' prefix"),
dynamicProperty->val->string);
goto failure;
}
if (occurrence != esxVI_Occurrence_OptionalItem) {
if (numInaccessibleDatastores > 0) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not find datastore '%s', maybe it's "
- "inaccessible", name);
+ _("Could not find datastore '%s', maybe it's "
+ "inaccessible"), name);
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not find datastore '%s'", name);
+ _("Could not find datastore '%s'"), name);
}
goto failure;
esxVI_DynamicProperty *dynamicProperty = NULL;
if (taskInfo == NULL || *taskInfo != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
esxVI_TaskInfo *taskInfo = NULL;
if (pendingTaskInfoList == NULL || *pendingTaskInfoList != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
if (autoAnswer == esxVI_Boolean_True) {
if (possibleAnswers == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Pending question blocks virtual machine execution, "
- "question is '%s', no possible answers",
+ _("Pending question blocks virtual machine execution, "
+ "question is '%s', no possible answers"),
questionInfo->text);
goto failure;
} else if (answerChoice == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Pending question blocks virtual machine execution, "
- "question is '%s', possible answers are %s, but no "
- "default answer is specified", questionInfo->text,
+ _("Pending question blocks virtual machine execution, "
+ "question is '%s', possible answers are %s, but no "
+ "default answer is specified"), questionInfo->text,
possibleAnswers);
goto failure;
}
} else {
if (possibleAnswers != NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Pending question blocks virtual machine execution, "
- "question is '%s', possible answers are %s",
+ _("Pending question blocks virtual machine execution, "
+ "question is '%s', possible answers are %s"),
questionInfo->text, possibleAnswers);
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Pending question blocks virtual machine execution, "
- "question is '%s', no possible answers",
+ _("Pending question blocks virtual machine execution, "
+ "question is '%s', no possible answers"),
questionInfo->text);
}
# include <curl/curl.h>
# include "internal.h"
+# include "virterror_internal.h"
# include "datatypes.h"
# include "esx_vi_types.h"
+
+
+# define ESX_VI_ERROR(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+ __LINE__, __VA_ARGS__)
+
+
+
typedef enum _esxVI_APIVersion esxVI_APIVersion;
typedef enum _esxVI_ProductVersion esxVI_ProductVersion;
typedef enum _esxVI_Occurrence esxVI_Occurrence;
#include "memory.h"
#include "logging.h"
#include "uuid.h"
-#include "virterror_internal.h"
#include "esx_vi_methods.h"
#include "esx_util.h"
#define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_VI_ERROR(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
- __LINE__, __VA_ARGS__)
+
#define ESX_VI__SOAP__REQUEST_HEADER \
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" \
"<soapenv:Body>"
+
+
#define ESX_VI__SOAP__REQUEST_FOOTER \
"</soapenv:Body>" \
"</soapenv:Envelope>"
#define ESX_VI__METHOD__CHECK_SERVICE() \
if (ctx->service == NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call")); \
return -1; \
}
#define ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(_name) \
if (_name == NULL || *_name != NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); \
return -1; \
}
esxVI_Response *response = NULL;
if (serviceContent == NULL || *serviceContent != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
ESX_VI__METHOD__CHECK_SERVICE()
if (active == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
},
#include "memory.h"
#include "logging.h"
#include "util.h"
-#include "virterror_internal.h"
#include "esx_vi.h"
#include "esx_vi_types.h"
#define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_VI_ERROR(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
- __LINE__, __VA_ARGS__)
-
#define ESV_VI__XML_TAG__OPEN(_buffer, _element, _type) \
esxVI_##_type##_DeepCopy(esxVI_##_type **dest, esxVI_##_type *src) \
{ \
if (dest == NULL || *dest != NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \
+ _("Invalid argument")); \
return -1; \
} \
\
esxVI_##_type **ptrptr) \
{ \
if (anyType == NULL || ptrptr == NULL || *ptrptr != NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \
+ _("Invalid argument")); \
return -1; \
} \
\
const char *element, virBufferPtr output) \
{ \
if (element == NULL || output == NULL ) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \
+ _("Invalid argument")); \
return -1; \
} \
\
xmlNodePtr childNode = NULL; \
\
if (ptrptr == NULL || *ptrptr != NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \
+ _("Invalid argument")); \
return -1; \
} \
\
long long value; \
\
if (number == NULL || *number != NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \
+ _("Invalid argument")); \
return -1; \
} \
\
esxVI_##__type##_DynamicCast(void *item) \
{ \
if (item == NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \
+ _("Invalid argument")); \
return NULL; \
} \
\
{
if (anyType->type != type) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting type '%s' but found '%s'",
+ _("Expecting type '%s' but found '%s'"),
esxVI_Type_ToString(type),
anyType->type != esxVI_Type_Other
? esxVI_Type_ToString(anyType->type)
esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
{
if (dest == NULL || *dest != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
(*dest)->node = xmlCopyNode(src->node, 1);
if ((*dest)->node == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not copy an XML node");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not copy an XML node"));
goto failure;
}
long long int number;
if (anyType == NULL || *anyType != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
(*anyType)->node = xmlCopyNode(node, 1);
if ((*anyType)->node == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not copy an XML node");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not copy an XML node"));
goto failure;
}
BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");
if ((*anyType)->other == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "AnyType is missing 'type' property");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("AnyType is missing 'type' property"));
goto failure;
}
if ((*anyType)->type == esxVI_Type_Undefined) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unknown value '%s' for AnyType 'type' property",
+ _("Unknown value '%s' for AnyType 'type' property"),
(*anyType)->other);
goto failure;
}
}
}
-#define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max) \
+#define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max) \
do { \
if (virStrToLong_ll((*anyType)->value, NULL, 10, &number) < 0) { \
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- "Unknown value '%s' for "_xsdType, \
- (*anyType)->value); \
+ _("Unknown value '%s' for %s"), \
+ (*anyType)->value, _xsdType); \
goto failure; \
} \
\
if (number < (_min) || number > (_max)) { \
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- "Value '%s' is out of "_xsdType" range", \
- (*anyType)->value); \
+ _("Value '%s' is out of %s range"), \
+ (*anyType)->value, _xsdType); \
goto failure; \
} \
\
(*anyType)->boolean = esxVI_Boolean_False;
} else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unknown value '%s' for xsd:boolean",
+ _("Unknown value '%s' for xsd:boolean"),
(*anyType)->value);
goto failure;
}
esxVI_String_DeepCopyValue(char **dest, const char *src)
{
if (dest == NULL || *dest != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
virBufferPtr output)
{
if (element == NULL || output == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
esxVI_String_DeserializeValue(xmlNodePtr node, char **value)
{
if (value == NULL || *value != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime)
{
if (dateTime == NULL || *dateTime != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
(char *)xmlNodeListGetString(node->doc, node->children, 1);
if ((*dateTime)->value == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "XML node doesn't contain text, expecting an "
- "xsd:dateTime value");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("XML node doesn't contain text, expecting an "
+ "xsd:dateTime value"));
goto failure;
}
const char *element, virBufferPtr output)
{
if (element == NULL || output == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
(xmlNodePtr node, esxVI_ManagedObjectReference **managedObjectReference)
{
if (managedObjectReference == NULL || *managedObjectReference != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
(char *)xmlGetNoNsProp(node, BAD_CAST "type");
if ((*managedObjectReference)->type == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "ManagedObjectReference is missing 'type' property");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("ManagedObjectReference is missing 'type' property"));
goto failure;
}
#include "virterror_internal.h"
#include "memory.h"
#include "logging.h"
+#include "esx_private.h"
#include "esx_util.h"
#include "esx_vmx.h"
#define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_ERROR(code, ...) \
- virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
- __LINE__, __VA_ARGS__)
-
-
-
#define ESX_BUILD_VMX_NAME(_suffix) \
snprintf(_suffix##_name, sizeof(_suffix##_name), "%s."#_suffix, prefix);
int idx;
if (! STRPREFIX(name, "sd")) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML attribute 'dev' of entry "
- "'devices/disk/target' to start with 'sd'");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Expecting domain XML attribute 'dev' of entry "
+ "'devices/disk/target' to start with 'sd'"));
return -1;
}
if (idx < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not parse valid disk index from '%s'", name);
+ _("Could not parse valid disk index from '%s'"), name);
return -1;
}
/* Each of the 4 SCSI controllers offers 15 IDs for devices */
if (idx >= (4 * 15)) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "SCSI disk index (parsed from '%s') is too large", name);
+ _("SCSI disk index (parsed from '%s') is too large"), name);
return -1;
}
int idx;
if (! STRPREFIX(name, "hd")) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML attribute 'dev' of entry "
- "'devices/disk/target' to start with 'hd'");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Expecting domain XML attribute 'dev' of entry "
+ "'devices/disk/target' to start with 'hd'"));
return -1;
}
if (idx < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not parse valid disk index from '%s'", name);
+ _("Could not parse valid disk index from '%s'"), name);
return -1;
}
/* Each of the 2 IDE controllers offers 2 IDs for devices */
if (idx >= (2 * 2)) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "IDE disk index (parsed from '%s') is too large", name);
+ _("IDE disk index (parsed from '%s') is too large"), name);
return -1;
}
int idx;
if (! STRPREFIX(name, "fd")) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML attribute 'dev' of entry "
- "'devices/disk/target' to start with 'fd'");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Expecting domain XML attribute 'dev' of entry "
+ "'devices/disk/target' to start with 'fd'"));
return -1;
}
if (idx < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Could not parse valid disk index from '%s'", name);
+ _("Could not parse valid disk index from '%s'"), name);
return -1;
}
if (idx >= 2) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Floppy disk index (parsed from '%s') is too large", name);
+ _("Floppy disk index (parsed from '%s') is too large"), name);
return -1;
}
STRCASENEQ(disk->driverName, "buslogic") &&
STRCASENEQ(disk->driverName, "lsilogic")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML entry 'devices/disk/target' to be "
- "'buslogic' or 'lsilogic' but found '%s'",
+ _("Expecting domain XML entry 'devices/disk/target' to "
+ "be 'buslogic' or 'lsilogic' but found '%s'"),
disk->driverName);
return -1;
}
virtualDev[controller] = disk->driverName;
} else if (STRCASENEQ(virtualDev[controller], disk->driverName)) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Inconsistent driver usage ('%s' is not '%s') on SCSI "
- "controller index %d", virtualDev[controller],
+ _("Inconsistent driver usage ('%s' is not '%s') on SCSI "
+ "controller index %d"), virtualDev[controller],
disk->driverName, controller);
return -1;
}
if (sscanf(absolutePath, "/vmfs/volumes/%a[^/]/%a[^\n]",
&preliminaryDatastoreName, &directoryAndFileName) != 2) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Absolute path '%s' doesn't have expected format "
- "'/vmfs/volumes/<datastore>/<path>'", absolutePath);
+ _("Absolute path '%s' doesn't have expected format "
+ "'/vmfs/volumes/<datastore>/<path>'"), absolutePath);
goto failure;
}
} else if (strchr(fileName, '/') != NULL) {
/* Found relative path, this is not supported */
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Found relative path '%s' in VMX file, this is not "
- "supported", fileName);
+ _("Found relative path '%s' in VMX file, this is not "
+ "supported"), fileName);
return NULL;
} else {
/* Found single file name referencing a file inside a datastore */
if (config_version != 8) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry 'config.version' to be 8 but found "
- "%lld", config_version);
+ _("Expecting VMX entry 'config.version' to be 8 but found "
+ "%lld"), config_version);
goto failure;
}
case esxVI_APIVersion_25:
if (virtualHW_version != 4) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry 'virtualHW.version' to be 4 for "
- "VI API version 2.5 but found %lld", virtualHW_version);
+ _("Expecting VMX entry 'virtualHW.version' to be 4 for "
+ "VI API version 2.5 but found %lld"),
+ virtualHW_version);
goto failure;
}
case esxVI_APIVersion_40:
if (virtualHW_version != 4 && virtualHW_version != 7) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry 'virtualHW.version' to be 4 or 7 for "
- "VI API version 4.0 but found %lld", virtualHW_version);
+ _("Expecting VMX entry 'virtualHW.version' to be 4 or 7 "
+ "for VI API version 4.0 but found %lld"),
+ virtualHW_version);
goto failure;
}
case esxVI_APIVersion_Unknown:
if (virtualHW_version != 4 && virtualHW_version != 7) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry 'virtualHW.version' to be 4 or 7 "
- "but found %lld", virtualHW_version);
+ _("Expecting VMX entry 'virtualHW.version' to be 4 or 7 "
+ "but found %lld"), virtualHW_version);
goto failure;
}
break;
default:
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VI API version 2.5 or 4.0");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Expecting VI API version 2.5 or 4.0"));
goto failure;
}
if (memsize <= 0 || memsize % 4 != 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry 'memsize' to be an unsigned "
- "integer (multiple of 4) but found %lld", memsize);
+ _("Expecting VMX entry 'memsize' to be an unsigned "
+ "integer (multiple of 4) but found %lld"), memsize);
goto failure;
}
if (numvcpus <= 0 || (numvcpus % 2 != 0 && numvcpus != 1)) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry 'numvcpus' to be an unsigned "
- "integer (1 or a multiple of 2) but found %lld", numvcpus);
+ _("Expecting VMX entry 'numvcpus' to be an unsigned "
+ "integer (1 or a multiple of 2) but found %lld"), numvcpus);
goto failure;
}
if (number < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry 'sched.cpu.affinity' to be "
- "a comma separated list of unsigned integers but "
- "found '%s'", sched_cpu_affinity);
+ _("Expecting VMX entry 'sched.cpu.affinity' to be "
+ "a comma separated list of unsigned integers but "
+ "found '%s'"), sched_cpu_affinity);
goto failure;
}
if (number >= VIR_DOMAIN_CPUMASK_LEN) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "VMX entry 'sched.cpu.affinity' contains a %d, this "
- "value is too large", number);
+ _("VMX entry 'sched.cpu.affinity' contains a %d, "
+ "this value is too large"), number);
goto failure;
}
break;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry 'sched.cpu.affinity' to be "
- "a comma separated list of unsigned integers but "
- "found '%s'", sched_cpu_affinity);
+ _("Expecting VMX entry 'sched.cpu.affinity' to be "
+ "a comma separated list of unsigned integers but "
+ "found '%s'"), sched_cpu_affinity);
goto failure;
}
if (count < numvcpus) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry 'sched.cpu.affinity' to contain "
- "at least as many values as 'numvcpus' (%lld) but "
- "found only %d value(s)", numvcpus, count);
+ _("Expecting VMX entry 'sched.cpu.affinity' to contain "
+ "at least as many values as 'numvcpus' (%lld) but "
+ "found only %d value(s)"), numvcpus, count);
goto failure;
}
}
long long port = 0;
if (def == NULL || *def != NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
char virtualDev_name[32];
if (virtualDev == NULL || *virtualDev != NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
if (controller < 0 || controller > 3) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "SCSI controller index %d out of [0..3] range",
+ _("SCSI controller index %d out of [0..3] range"),
controller);
return -1;
}
STRCASENEQ(*virtualDev, "buslogic") &&
STRCASENEQ(*virtualDev, "lsilogic")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be 'buslogic' or 'lsilogic' "
- "but found '%s'", virtualDev_name, *virtualDev);
+ _("Expecting VMX entry '%s' to be 'buslogic' or 'lsilogic' "
+ "but found '%s'"), virtualDev_name, *virtualDev);
goto failure;
}
int writeThrough = 0;
if (def == NULL || *def != NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
if (bus == VIR_DOMAIN_DISK_BUS_SCSI) {
if (controller < 0 || controller > 3) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "SCSI controller index %d out of [0..3] range",
+ _("SCSI controller index %d out of [0..3] range"),
controller);
goto failure;
}
if (id < 0 || id > 15 || id == 7) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "SCSI ID %d out of [0..6,8..15] range", id);
+ _("SCSI ID %d out of [0..6,8..15] range"), id);
goto failure;
}
} else if (bus == VIR_DOMAIN_DISK_BUS_IDE) {
if (controller < 0 || controller > 1) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "IDE controller index %d out of [0..1] range",
+ _("IDE controller index %d out of [0..1] range"),
controller);
goto failure;
}
if (id < 0 || id > 1) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "IDE ID %d out of [0..1] range", id);
+ _("IDE ID %d out of [0..1] range"), id);
goto failure;
}
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unsupported bus type '%s' for device type '%s'",
+ _("Unsupported bus type '%s' for device type '%s'"),
virDomainDiskBusTypeToString(bus),
virDomainDiskDeviceTypeToString(device));
goto failure;
if (bus == VIR_DOMAIN_DISK_BUS_FDC) {
if (controller < 0 || controller > 1) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Floppy controller index %d out of [0..1] range",
+ _("Floppy controller index %d out of [0..1] range"),
controller);
goto failure;
}
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unsupported bus type '%s' for device type '%s'",
+ _("Unsupported bus type '%s' for device type '%s'"),
virDomainDiskBusTypeToString(bus),
virDomainDiskDeviceTypeToString(device));
goto failure;
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unsupported device type '%s'",
+ _("Unsupported device type '%s'"),
virDomainDiskDeviceTypeToString(device));
goto failure;
}
if (bus == VIR_DOMAIN_DISK_BUS_SCSI &&
STRCASENEQ(deviceType, "scsi-hardDisk")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be 'scsi-hardDisk' "
- "but found '%s'", deviceType_name, deviceType);
+ _("Expecting VMX entry '%s' to be 'scsi-hardDisk' "
+ "but found '%s'"), deviceType_name, deviceType);
goto failure;
} else if (bus == VIR_DOMAIN_DISK_BUS_IDE &&
STRCASENEQ(deviceType, "ata-hardDisk")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be 'ata-hardDisk' "
- "but found '%s'", deviceType_name, deviceType);
+ _("Expecting VMX entry '%s' to be 'ata-hardDisk' "
+ "but found '%s'"), deviceType_name, deviceType);
goto failure;
}
}
goto ignore;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Invalid or not yet handled value '%s' for VMX entry "
- "'%s'", fileName, fileName_name);
+ _("Invalid or not yet handled value '%s' for VMX entry "
+ "'%s'"), fileName, fileName_name);
goto failure;
}
} else if (device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
if (deviceType != NULL) {
if (STRCASENEQ(deviceType, "cdrom-image")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be 'cdrom-image' "
- "but found '%s'", deviceType_name, deviceType);
+ _("Expecting VMX entry '%s' to be 'cdrom-image' "
+ "but found '%s'"), deviceType_name, deviceType);
goto failure;
}
}
fileName = NULL;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Invalid or not yet handled value '%s' for VMX entry "
- "'%s'", fileName, fileName_name);
+ _("Invalid or not yet handled value '%s' for VMX entry "
+ "'%s'"), fileName, fileName_name);
goto failure;
}
} else if (device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
if (fileType != NULL) {
if (STRCASENEQ(fileType, "file")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be 'file' but "
- "found '%s'", fileType_name, fileType);
+ _("Expecting VMX entry '%s' to be 'file' but "
+ "found '%s'"), fileType_name, fileType);
goto failure;
}
}
fileName = NULL;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Invalid or not yet handled value '%s' for VMX entry "
- "'%s'", fileName, fileName_name);
+ _("Invalid or not yet handled value '%s' for VMX entry "
+ "'%s'"), fileName, fileName_name);
goto failure;
}
} else {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Unsupported device type '%s'",
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Unsupported device type '%s'"),
virDomainDiskDeviceTypeToString(device));
goto failure;
}
char *networkName = NULL;
if (def == NULL || *def != NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
if (controller < 0 || controller > 3) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Ethernet controller index %d out of [0..3] range",
+ _("Ethernet controller index %d out of [0..3] range"),
controller);
return -1;
}
if (generatedAddress != NULL) {
if (virParseMacAddr(generatedAddress, (*def)->mac) < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be MAC address but "
- "found '%s'", generatedAddress_name,
+ _("Expecting VMX entry '%s' to be MAC address but "
+ "found '%s'"), generatedAddress_name,
generatedAddress);
goto failure;
}
if (address != NULL) {
if (virParseMacAddr(address, (*def)->mac) < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be MAC address but "
- "found '%s'", address_name, address);
+ _("Expecting VMX entry '%s' to be MAC address but "
+ "found '%s'"), address_name, address);
goto failure;
}
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be 'generated' or 'static' or "
- "'vpx' but found '%s'", addressType_name, addressType);
+ _("Expecting VMX entry '%s' to be 'generated' or 'static' or "
+ "'vpx' but found '%s'"), addressType_name, addressType);
goto failure;
}
STRCASENEQ(virtualDev, "vmxnet3") &&
STRCASENEQ(virtualDev, "e1000")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be 'vlance' or 'vmxnet' or "
- "'vmxnet3' or 'e1000' but found '%s'", virtualDev_name,
+ _("Expecting VMX entry '%s' to be 'vlance' or 'vmxnet' or "
+ "'vmxnet3' or 'e1000' but found '%s'"), virtualDev_name,
virtualDev);
goto failure;
}
} else if (STRCASEEQ(connectionType, "hostonly")) {
/* FIXME */
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "No yet handled value '%s' for VMX entry '%s'",
+ _("No yet handled value '%s' for VMX entry '%s'"),
connectionType, connectionType_name);
goto failure;
} else if (STRCASEEQ(connectionType, "nat")) {
/* FIXME */
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "No yet handled value '%s' for VMX entry '%s'",
+ _("No yet handled value '%s' for VMX entry '%s'"),
connectionType, connectionType_name);
goto failure;
} else if (STRCASEEQ(connectionType, "custom")) {
vnet = NULL;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Invalid value '%s' for VMX entry '%s'", connectionType,
+ _("Invalid value '%s' for VMX entry '%s'"), connectionType,
connectionType_name);
goto failure;
}
char *fileName = NULL;
if (def == NULL || *def != NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
if (port < 0 || port > 3) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Serial port index %d out of [0..3] range", port);
+ _("Serial port index %d out of [0..3] range"), port);
return -1;
}
fileName = NULL;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be 'device', 'file' or 'pipe' "
- "but found '%s'", fileType_name, fileType);
+ _("Expecting VMX entry '%s' to be 'device', 'file' or 'pipe' "
+ "but found '%s'"), fileType_name, fileType);
goto failure;
}
char *fileName = NULL;
if (def == NULL || *def != NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
if (port < 0 || port > 2) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Parallel port index %d out of [0..2] range", port);
+ _("Parallel port index %d out of [0..2] range"), port);
return -1;
}
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VMX entry '%s' to be 'device' or 'file' but "
- "found '%s'", fileType_name, fileType);
+ _("Expecting VMX entry '%s' to be 'device' or 'file' but "
+ "found '%s'"), fileType_name, fileType);
goto failure;
}
} else {
/* Found relative path, this is not supported */
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Found relative path '%s' in domain XML, this is not "
- "supported", src);
+ _("Found relative path '%s' in domain XML, this is not "
+ "supported"), src);
goto failure;
}
if (def->virtType != VIR_DOMAIN_VIRT_VMWARE) { /* FIXME: maybe add VIR_DOMAIN_VIRT_ESX ? */
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting virt type to be '%s' but found '%s'",
+ _("Expecting virt type to be '%s' but found '%s'"),
virDomainVirtTypeToString(VIR_DOMAIN_VIRT_VMWARE),
virDomainVirtTypeToString(def->virtType));
return NULL;
break;
default:
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting VI API version 2.5 or 4.0");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Expecting VI API version 2.5 or 4.0"));
goto failure;
}
virBufferAddLit(&buffer, "guestOS = \"other-64\"\n");
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML attribute 'arch' of entry 'os/type' "
- "to be 'i686' or 'x86_64' but found '%s'", def->os.arch);
+ _("Expecting domain XML attribute 'arch' of entry 'os/type' "
+ "to be 'i686' or 'x86_64' but found '%s'"), def->os.arch);
goto failure;
}
/* def:maxmem -> vmx:memsize */
if (def->maxmem <= 0 || def->maxmem % 4096 != 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML entry 'memory' to be an unsigned "
- "integer (multiple of 4096) but found %lld",
+ _("Expecting domain XML entry 'memory' to be an unsigned "
+ "integer (multiple of 4096) but found %lld"),
(unsigned long long)def->maxmem);
goto failure;
}
if (def->memory < def->maxmem) {
if (def->memory <= 0 || def->memory % 1024 != 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML entry 'currentMemory' to be an "
- "unsigned integer (multiple of 1024) but found %lld",
+ _("Expecting domain XML entry 'currentMemory' to be an "
+ "unsigned integer (multiple of 1024) but found %lld"),
(unsigned long long)def->memory);
goto failure;
}
/* def:vcpus -> vmx:numvcpus */
if (def->vcpus <= 0 || (def->vcpus % 2 != 0 && def->vcpus != 1)) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML entry 'vcpu' to be an unsigned "
- "integer (1 or a multiple of 2) but found %d",
+ _("Expecting domain XML entry 'vcpu' to be an unsigned "
+ "integer (1 or a multiple of 2) but found %d"),
(int)def->vcpus);
goto failure;
}
if (sched_cpu_affinity_length < def->vcpus) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML attribute 'cpuset' of entry "
- "'vcpu' to contains at least %d CPU(s)",
+ _("Expecting domain XML attribute 'cpuset' of entry "
+ "'vcpu' to contains at least %d CPU(s)"),
(int)def->vcpus);
goto failure;
}
default:
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unsupported graphics type '%s'",
+ _("Unsupported graphics type '%s'"),
virDomainGraphicsTypeToString(def->graphics[i]->type));
goto failure;
}
default:
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unsupported disk device type '%s'",
+ _("Unsupported disk device type '%s'"),
virDomainDiskDeviceTypeToString(def->disks[i]->device));
goto failure;
}
esxVMX_FormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer)
{
if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
char *fileName = NULL;
if (def->device != VIR_DOMAIN_DISK_DEVICE_DISK) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unsupported bus type '%s' for harddisk",
+ _("Unsupported bus type '%s' for harddisk"),
virDomainDiskBusTypeToString(def->bus));
return -1;
}
if (def->type != VIR_DOMAIN_DISK_TYPE_FILE) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "%s harddisk '%s' has unsupported type '%s', expecting '%s'",
+ _("%s harddisk '%s' has unsupported type '%s', expecting '%s'"),
busName, def->dst, virDomainDiskTypeToString(def->type),
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE));
return -1;
if (def->src != NULL) {
if (! virFileHasSuffix(def->src, ".vmdk")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Image file for %s harddisk '%s' has unsupported suffix, "
- "expecting '.vmdk'", busName, def->dst);
+ _("Image file for %s harddisk '%s' has unsupported suffix, "
+ "expecting '.vmdk'"), busName, def->dst);
return -1;
}
entryPrefix, controller, id);
} else if (def->cachemode != VIR_DOMAIN_DISK_CACHE_DEFAULT) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "%s harddisk '%s' has unsupported cache mode '%s'",
+ _("%s harddisk '%s' has unsupported cache mode '%s'"),
busName, def->dst,
virDomainDiskCacheTypeToString(def->cachemode));
return -1;
char *fileName = NULL;
if (def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
return -1;
}
} else {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Unsupported bus type '%s' for cdrom",
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
+ _("Unsupported bus type '%s' for cdrom"),
virDomainDiskBusTypeToString(def->bus));
return -1;
}
if (def->src != NULL) {
if (! virFileHasSuffix(def->src, ".iso")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Image file for %s cdrom '%s' has unsupported "
- "suffix, expecting '.iso'", busName, def->dst);
+ _("Image file for %s cdrom '%s' has unsupported "
+ "suffix, expecting '.iso'"), busName, def->dst);
return -1;
}
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "%s cdrom '%s' has unsupported type '%s', expecting '%s' "
- "or '%s'", busName, def->dst,
+ _("%s cdrom '%s' has unsupported type '%s', expecting '%s' "
+ "or '%s'"), busName, def->dst,
virDomainDiskTypeToString(def->type),
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE),
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK));
char *fileName = NULL;
if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
if (def->src != NULL) {
if (! virFileHasSuffix(def->src, ".flp")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Image file for floppy '%s' has unsupported suffix, "
- "expecting '.flp'", def->dst);
+ _("Image file for floppy '%s' has unsupported "
+ "suffix, expecting '.flp'"), def->dst);
return -1;
}
}
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Floppy '%s' has unsupported type '%s', expecting '%s' "
- "or '%s'", def->dst,
+ _("Floppy '%s' has unsupported type '%s', expecting '%s' "
+ "or '%s'"), def->dst,
virDomainDiskTypeToString(def->type),
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE),
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK));
if (controller < 0 || controller > 3) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Ethernet controller index %d out of [0..3] range",
+ _("Ethernet controller index %d out of [0..3] range"),
controller);
return -1;
}
STRCASENEQ(def->model, "vmxnet3") &&
STRCASENEQ(def->model, "e1000")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML entry 'devices/interfase/model' "
- "to be 'vlance' or 'vmxnet' or 'vmxnet3' or 'e1000' but "
- "found '%s'", def->model);
+ _("Expecting domain XML entry 'devices/interfase/model' "
+ "to be 'vlance' or 'vmxnet' or 'vmxnet3' or 'e1000' "
+ "but found '%s'"), def->model);
return -1;
}
break;
default:
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Unsupported net type '%s'",
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Unsupported net type '%s'"),
virDomainNetTypeToString(def->type));
return -1;
}
if (def->target.port < 0 || def->target.port > 3) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Serial port index %d out of [0..3] range", def->target.port);
+ _("Serial port index %d out of [0..3] range"),
+ def->target.port);
return -1;
}
if (def->data.file.path == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML attribute 'path' of entry "
- "'devices/serial/source' to be present");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Expecting domain XML attribute 'path' of entry "
+ "'devices/serial/source' to be present"));
return -1;
}
default:
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unsupported character device type '%s'",
+ _("Unsupported character device type '%s'"),
virDomainChrTypeToString(def->type));
return -1;
}
if (def->target.port < 0 || def->target.port > 2) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Parallel port index %d out of [0..2] range",
+ _("Parallel port index %d out of [0..2] range"),
def->target.port);
return -1;
}
if (def->data.file.path == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting domain XML attribute 'path' of entry "
- "'devices/parallel/source' to be present");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Expecting domain XML attribute 'path' of entry "
+ "'devices/parallel/source' to be present"));
return -1;
}
default:
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Unsupported character device type '%s'",
+ _("Unsupported character device type '%s'"),
virDomainChrTypeToString(def->type));
return -1;
}