esx: Mark error messages for translation

Also define ESX_ERROR and ESX_VI_ERROR in a central place, instead of
defining them in each source file.

Add ESX_ERROR and ESX_VI_ERROR to the msg_gen_function list in cfg.mk.

Update po/POTFILES.in accordingly.
This commit is contained in:
Matthias Bolte 2010-04-02 21:34:31 +02:00
parent dbfa2ff572
commit 028db0bf5d
15 changed files with 500 additions and 503 deletions

2
cfg.mk
View File

@ -172,6 +172,8 @@ msg_gen_function += DEBUG0
msg_gen_function += DISABLE_fprintf msg_gen_function += DISABLE_fprintf
msg_gen_function += ERROR msg_gen_function += ERROR
msg_gen_function += ERROR0 msg_gen_function += ERROR0
msg_gen_function += ESX_ERROR
msg_gen_function += ESX_VI_ERROR
msg_gen_function += REMOTE_DEBUG msg_gen_function += REMOTE_DEBUG
msg_gen_function += ReportError msg_gen_function += ReportError
msg_gen_function += VIR_FREE msg_gen_function += VIR_FREE

View File

@ -18,6 +18,12 @@ src/cpu/cpu_generic.c
src/cpu/cpu_map.c src/cpu/cpu_map.c
src/cpu/cpu_x86.c src/cpu/cpu_x86.c
src/datatypes.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/interface/netcf_driver.c
src/libvirt.c src/libvirt.c
src/lxc/lxc_container.c src/lxc/lxc_container.c

View File

@ -25,7 +25,6 @@
#include <config.h> #include <config.h>
#include "internal.h" #include "internal.h"
#include "virterror_internal.h"
#include "util.h" #include "util.h"
#include "memory.h" #include "memory.h"
#include "logging.h" #include "logging.h"
@ -38,10 +37,6 @@
#define VIR_FROM_THIS VIR_FROM_ESX #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 static virDrvOpenStatus

View File

@ -27,7 +27,6 @@
#include <netdb.h> #include <netdb.h>
#include "internal.h" #include "internal.h"
#include "virterror_internal.h"
#include "domain_conf.h" #include "domain_conf.h"
#include "authhelper.h" #include "authhelper.h"
#include "util.h" #include "util.h"
@ -48,10 +47,6 @@
#define VIR_FROM_THIS VIR_FROM_ESX #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); static int esxDomainGetMaxVcpus(virDomainPtr domain);
@ -84,8 +79,8 @@ esxSupportsLongMode(esxPrivate *priv)
} }
if (hostSystem == NULL) { if (hostSystem == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Could not retrieve the HostSystem object"); _("Could not retrieve the HostSystem object"));
goto failure; goto failure;
} }
@ -108,9 +103,9 @@ esxSupportsLongMode(esxPrivate *priv)
"%*c%*c%c%*c:"_SKIP12":"_SKIP12":%*c%*c%*c%c", "%*c%*c%c%*c:"_SKIP12":"_SKIP12":%*c%*c%*c%c",
&edxLongModeBit, &edxFirstBit) != 2) { &edxLongModeBit, &edxFirstBit) != 2) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"HostSystem property 'hardware.cpuFeature[].edx' " _("HostSystem property 'hardware.cpuFeature[].edx' "
"with value '%s' doesn't have expected format " "with value '%s' doesn't have expected format "
"'----:----:----:----:----:----:----:----'", "'----:----:----:----:----:----:----:----'"),
hostCpuIdInfo->edx); hostCpuIdInfo->edx);
goto failure; goto failure;
} }
@ -124,10 +119,10 @@ esxSupportsLongMode(esxPrivate *priv)
priv->supportsLongMode = esxVI_Boolean_False; priv->supportsLongMode = esxVI_Boolean_False;
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Bit 29 (Long Mode) of HostSystem property " _("Bit 29 (Long Mode) of HostSystem property "
"'hardware.cpuFeature[].edx' with value '%s' " "'hardware.cpuFeature[].edx' with value '%s' "
"has unexpected value '%c', expecting '0' " "has unexpected value '%c', expecting '0' "
"or '1'", hostCpuIdInfo->edx, edxLongModeBit); "or '1'"), hostCpuIdInfo->edx, edxLongModeBit);
goto failure; goto failure;
} }
@ -358,7 +353,7 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
username = virRequestUsername(auth, "root", conn->uri->server); username = virRequestUsername(auth, "root", conn->uri->server);
if (username == NULL) { if (username == NULL) {
ESX_ERROR(VIR_ERR_AUTH_FAILED, "Username request failed"); ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed"));
goto failure; goto failure;
} }
} }
@ -370,7 +365,7 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
password = virRequestPassword(auth, username, conn->uri->server); password = virRequestPassword(auth, username, conn->uri->server);
if (password == NULL) { if (password == NULL) {
ESX_ERROR(VIR_ERR_AUTH_FAILED, "Password request failed"); ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed"));
goto failure; goto failure;
} }
@ -383,14 +378,14 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
if (priv->host->productVersion != esxVI_ProductVersion_ESX35 && if (priv->host->productVersion != esxVI_ProductVersion_ESX35 &&
priv->host->productVersion != esxVI_ProductVersion_ESX40) { priv->host->productVersion != esxVI_ProductVersion_ESX40) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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); conn->uri->server);
goto failure; goto failure;
} }
} else { /* GSX */ } else { /* GSX */
if (priv->host->productVersion != esxVI_ProductVersion_GSX20) { if (priv->host->productVersion != esxVI_ProductVersion_GSX20) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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; goto failure;
} }
} }
@ -457,16 +452,17 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
if (virStrcpyStatic(vCenterIpAddress, if (virStrcpyStatic(vCenterIpAddress,
dynamicProperty->val->string) == NULL) { dynamicProperty->val->string) == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"vCenter IP address %s too big for " _("vCenter IP address %s too big for "
"destination", dynamicProperty->val->string); "destination"),
dynamicProperty->val->string);
goto failure; goto failure;
} }
} else if (STRNEQ(vCenterIpAddress, } else if (STRNEQ(vCenterIpAddress,
dynamicProperty->val->string)) { dynamicProperty->val->string)) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"This host is managed by a vCenter with IP " _("This host is managed by a vCenter with IP "
"address %s, but a mismachting vCenter '%s' " "address %s, but a mismachting vCenter '%s' "
"(%s) has been specified", "(%s) has been specified"),
dynamicProperty->val->string, vCenter, dynamicProperty->val->string, vCenter,
vCenterIpAddress); vCenterIpAddress);
goto failure; goto failure;
@ -477,8 +473,8 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
} }
if (STREQ(vCenter, "*")) { if (STREQ(vCenter, "*")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"This host is not managed by a vCenter"); _("This host is not managed by a vCenter"));
goto failure; goto failure;
} }
@ -495,14 +491,14 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
username = virRequestUsername(auth, "administrator", vCenter); username = virRequestUsername(auth, "administrator", vCenter);
if (username == NULL) { if (username == NULL) {
ESX_ERROR(VIR_ERR_AUTH_FAILED, "Username request failed"); ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed"));
goto failure; goto failure;
} }
password = virRequestPassword(auth, username, vCenter); password = virRequestPassword(auth, username, vCenter);
if (password == NULL) { if (password == NULL) {
ESX_ERROR(VIR_ERR_AUTH_FAILED, "Password request failed"); ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed"));
goto failure; goto failure;
} }
@ -514,8 +510,8 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
if (priv->vCenter->productVersion != esxVI_ProductVersion_VPX25 && if (priv->vCenter->productVersion != esxVI_ProductVersion_VPX25 &&
priv->vCenter->productVersion != esxVI_ProductVersion_VPX40) { priv->vCenter->productVersion != esxVI_ProductVersion_VPX40) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"%s is neither a vCenter 2.5 server nor a vCenter " _("%s is neither a vCenter 2.5 server nor a vCenter "
"4.0 server", conn->uri->server); "4.0 server"), conn->uri->server);
goto failure; goto failure;
} }
} }
@ -613,8 +609,8 @@ esxSupportsVMotion(esxPrivate *priv)
} }
if (hostSystem == NULL) { if (hostSystem == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Could not retrieve the HostSystem object"); _("Could not retrieve the HostSystem object"));
goto failure; goto failure;
} }
@ -688,7 +684,7 @@ esxGetVersion(virConnectPtr conn, unsigned long *version)
if (virParseVersionString(priv->host->service->about->version, if (virParseVersionString(priv->host->service->about->version,
version) < 0) { version) < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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); priv->host->service->about->version);
return -1; return -1;
@ -725,8 +721,8 @@ esxGetHostname(virConnectPtr conn)
} }
if (hostSystem == NULL) { if (hostSystem == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Could not retrieve the HostSystem object"); _("Could not retrieve the HostSystem object"));
goto failure; goto failure;
} }
@ -754,8 +750,8 @@ esxGetHostname(virConnectPtr conn)
} }
if (hostName == NULL || strlen(hostName) < 1) { if (hostName == NULL || strlen(hostName) < 1) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Missing or empty 'hostName' property"); _("Missing or empty 'hostName' property"));
goto failure; goto failure;
} }
@ -824,8 +820,8 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
} }
if (hostSystem == NULL) { if (hostSystem == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Could not retrieve the HostSystem object"); _("Could not retrieve the HostSystem object"));
goto failure; goto failure;
} }
@ -906,7 +902,7 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
sizeof(nodeinfo->model) - 1, sizeof(nodeinfo->model) - 1,
sizeof(nodeinfo->model)) == NULL) { sizeof(nodeinfo->model)) == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"CPU Model %s too long for destination", _("CPU Model %s too long for destination"),
dynamicProperty->val->string); dynamicProperty->val->string);
goto failure; goto failure;
} }
@ -1003,7 +999,7 @@ esxListDomains(virConnectPtr conn, int *ids, int maxids)
&ids[count]) < 0 || &ids[count]) < 0 ||
ids[count] <= 0) { ids[count] <= 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Failed to parse positive integer from '%s'", _("Failed to parse positive integer from '%s'"),
virtualMachine->obj->value); virtualMachine->obj->value);
goto failure; goto failure;
} }
@ -1110,7 +1106,7 @@ esxDomainLookupByID(virConnectPtr conn, int id)
} }
if (domain == NULL) { 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: cleanup:
@ -1208,7 +1204,7 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
} }
if (virtualMachine == NULL) { 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; goto failure;
} }
@ -1274,7 +1270,8 @@ esxDomainSuspend(virDomainPtr domain)
} }
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) { 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; goto failure;
} }
@ -1285,7 +1282,7 @@ esxDomainSuspend(virDomainPtr domain)
} }
if (taskInfoState != esxVI_TaskInfoState_Success) { 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; goto failure;
} }
@ -1329,7 +1326,7 @@ esxDomainResume(virDomainPtr domain)
} }
if (powerState != esxVI_VirtualMachinePowerState_Suspended) { 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; goto failure;
} }
@ -1340,7 +1337,7 @@ esxDomainResume(virDomainPtr domain)
} }
if (taskInfoState != esxVI_TaskInfoState_Success) { 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; goto failure;
} }
@ -1382,7 +1379,8 @@ esxDomainShutdown(virDomainPtr domain)
} }
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) { 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; goto failure;
} }
@ -1427,7 +1425,8 @@ esxDomainReboot(virDomainPtr domain, unsigned int flags ATTRIBUTE_UNUSED)
} }
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) { 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; goto failure;
} }
@ -1481,7 +1480,8 @@ esxDomainDestroy(virDomainPtr domain)
} }
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) { 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; goto failure;
} }
@ -1492,7 +1492,7 @@ esxDomainDestroy(virDomainPtr domain)
} }
if (taskInfoState != esxVI_TaskInfoState_Success) { 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; goto failure;
} }
@ -1556,7 +1556,8 @@ esxDomainGetMaxMemory(virDomainPtr domain)
} }
if (dynamicProperty->val->int32 < 0) { 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); dynamicProperty->val->int32);
} else { } else {
memoryMB = dynamicProperty->val->int32; memoryMB = dynamicProperty->val->int32;
@ -1616,7 +1617,7 @@ esxDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
if (taskInfoState != esxVI_TaskInfoState_Success) { if (taskInfoState != esxVI_TaskInfoState_Success) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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; goto failure;
} }
@ -1670,7 +1671,7 @@ esxDomainSetMemory(virDomainPtr domain, unsigned long memory)
if (taskInfoState != esxVI_TaskInfoState_Success) { if (taskInfoState != esxVI_TaskInfoState_Success) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not set memory to %lu kilobytes", memory); _("Could not set memory to %lu kilobytes"), memory);
goto failure; goto failure;
} }
@ -1962,8 +1963,8 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
esxVI_TaskInfoState taskInfoState; esxVI_TaskInfoState taskInfoState;
if (nvcpus < 1) { if (nvcpus < 1) {
ESX_ERROR(VIR_ERR_INVALID_ARG, ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
"Requested number of virtual CPUs must at least be 1"); _("Requested number of virtual CPUs must at least be 1"));
goto failure; goto failure;
} }
@ -1979,8 +1980,8 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
if (nvcpus > maxVcpus) { if (nvcpus > maxVcpus) {
ESX_ERROR(VIR_ERR_INVALID_ARG, ESX_ERROR(VIR_ERR_INVALID_ARG,
"Requested number of virtual CPUs is greater than max " _("Requested number of virtual CPUs is greater than max "
"allowable number of virtual CPUs for the domain: %d > %d", "allowable number of virtual CPUs for the domain: %d > %d"),
nvcpus, maxVcpus); nvcpus, maxVcpus);
goto failure; goto failure;
} }
@ -2004,7 +2005,7 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
if (taskInfoState != esxVI_TaskInfoState_Success) { if (taskInfoState != esxVI_TaskInfoState_Success) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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; goto failure;
} }
@ -2048,8 +2049,8 @@ esxDomainGetMaxVcpus(virDomainPtr domain)
} }
if (hostSystem == NULL) { if (hostSystem == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Could not retrieve the HostSystem object"); _("Could not retrieve the HostSystem object"));
goto failure; goto failure;
} }
@ -2193,7 +2194,7 @@ esxDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat,
if (STRNEQ(nativeFormat, "vmware-vmx")) { if (STRNEQ(nativeFormat, "vmware-vmx")) {
ESX_ERROR(VIR_ERR_INVALID_ARG, ESX_ERROR(VIR_ERR_INVALID_ARG,
"Unsupported config format '%s'", nativeFormat); _("Unsupported config format '%s'"), nativeFormat);
return NULL; return NULL;
} }
@ -2222,7 +2223,7 @@ esxDomainXMLToNative(virConnectPtr conn, const char *nativeFormat,
if (STRNEQ(nativeFormat, "vmware-vmx")) { if (STRNEQ(nativeFormat, "vmware-vmx")) {
ESX_ERROR(VIR_ERR_INVALID_ARG, ESX_ERROR(VIR_ERR_INVALID_ARG,
"Unsupported config format '%s'", nativeFormat); _("Unsupported config format '%s'"), nativeFormat);
return NULL; return NULL;
} }
@ -2373,7 +2374,8 @@ esxDomainCreate(virDomainPtr domain)
} }
if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) { 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; goto failure;
} }
@ -2384,7 +2386,7 @@ esxDomainCreate(virDomainPtr domain)
} }
if (taskInfoState != esxVI_TaskInfoState_Success) { 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; goto failure;
} }
@ -2446,9 +2448,9 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)
if (virtualMachine != NULL) { if (virtualMachine != NULL) {
/* FIXME */ /* FIXME */
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Domain already exists, editing existing domains is not " _("Domain already exists, editing existing domains is not "
"supported yet"); "supported yet"));
goto failure; goto failure;
} }
@ -2467,9 +2469,9 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)
* datastore isn't perfect but should work in the majority of cases. * datastore isn't perfect but should work in the majority of cases.
*/ */
if (def->ndisks < 1) { if (def->ndisks < 1) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Domain XML doesn't contain any disks, cannot deduce " _("Domain XML doesn't contain any disks, cannot deduce "
"datastore and path for VMX file"); "datastore and path for VMX file"));
goto failure; goto failure;
} }
@ -2482,16 +2484,16 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)
} }
if (disk == NULL) { if (disk == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Domain XML doesn't contain any file-based harddisks, " _("Domain XML doesn't contain any file-based harddisks, "
"cannot deduce datastore and path for VMX file"); "cannot deduce datastore and path for VMX file"));
goto failure; goto failure;
} }
if (disk->src == NULL) { if (disk->src == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"First file-based harddisk has no source, cannot deduce " _("First file-based harddisk has no source, cannot deduce "
"datastore and path for VMX file"); "datastore and path for VMX file"));
goto failure; goto failure;
} }
@ -2502,8 +2504,8 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)
if (! virFileHasSuffix(fileName, ".vmdk")) { if (! virFileHasSuffix(fileName, ".vmdk")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting source '%s' of first file-based harddisk to be a " _("Expecting source '%s' of first file-based harddisk to "
"VMDK image", disk->src); "be a VMDK image"), disk->src);
goto failure; goto failure;
} }
@ -2572,7 +2574,7 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)
} }
if (taskInfoState != esxVI_TaskInfoState_Success) { 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; goto failure;
} }
@ -2641,8 +2643,8 @@ esxDomainUndefine(virDomainPtr domain)
if (powerState != esxVI_VirtualMachinePowerState_Suspended && if (powerState != esxVI_VirtualMachinePowerState_Suspended &&
powerState != esxVI_VirtualMachinePowerState_PoweredOff) { powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
ESX_ERROR(VIR_ERR_OPERATION_INVALID, ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
"Domain is not suspended or powered off"); _("Domain is not suspended or powered off"));
goto failure; goto failure;
} }
@ -2725,8 +2727,8 @@ esxDomainGetSchedulerParameters(virDomainPtr domain,
int i = 0; int i = 0;
if (*nparams < 3) { if (*nparams < 3) {
ESX_ERROR(VIR_ERR_INVALID_ARG, ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
"Parameter array must have space for 3 items"); _("Parameter array must have space for 3 items"));
goto failure; goto failure;
} }
@ -2810,7 +2812,7 @@ esxDomainGetSchedulerParameters(virDomainPtr domain,
default: default:
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Shares level has unknown value %d", _("Shares level has unknown value %d"),
(int)sharesInfo->level); (int)sharesInfo->level);
goto failure; goto failure;
} }
@ -2874,8 +2876,8 @@ esxDomainSetSchedulerParameters(virDomainPtr domain,
if (params[i].value.l < 0) { if (params[i].value.l < 0) {
ESX_ERROR(VIR_ERR_INVALID_ARG, ESX_ERROR(VIR_ERR_INVALID_ARG,
"Could not set reservation to %lld MHz, expecting " _("Could not set reservation to %lld MHz, expecting "
"positive value", params[i].value.l); "positive value"), params[i].value.l);
goto failure; goto failure;
} }
@ -2888,8 +2890,8 @@ esxDomainSetSchedulerParameters(virDomainPtr domain,
if (params[i].value.l < -1) { if (params[i].value.l < -1) {
ESX_ERROR(VIR_ERR_INVALID_ARG, ESX_ERROR(VIR_ERR_INVALID_ARG,
"Could not set limit to %lld MHz, expecting " _("Could not set limit to %lld MHz, expecting "
"positive value or -1 (unlimited)", "positive value or -1 (unlimited)"),
params[i].value.l); params[i].value.l);
goto failure; goto failure;
} }
@ -2928,14 +2930,14 @@ esxDomainSetSchedulerParameters(virDomainPtr domain,
default: default:
ESX_ERROR(VIR_ERR_INVALID_ARG, ESX_ERROR(VIR_ERR_INVALID_ARG,
"Could not set shares to %d, expecting positive " _("Could not set shares to %d, expecting positive "
"value or -1 (low), -2 (normal) or -3 (high)", "value or -1 (low), -2 (normal) or -3 (high)"),
params[i].value.i); params[i].value.i);
goto failure; goto failure;
} }
} }
} else { } else {
ESX_ERROR(VIR_ERR_INVALID_ARG, "Unknown field '%s'", ESX_ERROR(VIR_ERR_INVALID_ARG, _("Unknown field '%s'"),
params[i].field); params[i].field);
goto failure; goto failure;
} }
@ -2949,8 +2951,8 @@ esxDomainSetSchedulerParameters(virDomainPtr domain,
} }
if (taskInfoState != esxVI_TaskInfoState_Success) { if (taskInfoState != esxVI_TaskInfoState_Success) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Could not change scheduler parameters"); _("Could not change scheduler parameters"));
goto failure; goto failure;
} }
@ -3028,14 +3030,14 @@ esxDomainMigratePerform(virDomainPtr domain,
esxVI_TaskInfoState taskInfoState; esxVI_TaskInfoState taskInfoState;
if (priv->vCenter == NULL) { if (priv->vCenter == NULL) {
ESX_ERROR(VIR_ERR_INVALID_ARG, ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
"Migration not possible without a vCenter"); _("Migration not possible without a vCenter"));
goto failure; goto failure;
} }
if (dname != NULL) { if (dname != NULL) {
ESX_ERROR(VIR_ERR_INVALID_ARG, ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
"Renaming domains on migration not supported"); _("Renaming domains on migration not supported"));
goto failure; goto failure;
} }
@ -3086,12 +3088,12 @@ esxDomainMigratePerform(virDomainPtr domain,
*/ */
if (eventList->fullFormattedMessage != NULL) { if (eventList->fullFormattedMessage != NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not migrate domain, validation reported a " _("Could not migrate domain, validation reported a "
"problem: %s", eventList->fullFormattedMessage); "problem: %s"), eventList->fullFormattedMessage);
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Could not migrate domain, validation reported a " _("Could not migrate domain, validation reported a "
"problem"); "problem"));
} }
goto failure; goto failure;
@ -3109,9 +3111,9 @@ esxDomainMigratePerform(virDomainPtr domain,
} }
if (taskInfoState != esxVI_TaskInfoState_Success) { if (taskInfoState != esxVI_TaskInfoState_Success) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Could not migrate domain, migration task finished with " _("Could not migrate domain, migration task finished with "
"an error"); "an error"));
goto failure; goto failure;
} }
@ -3201,8 +3203,8 @@ esxNodeGetFreeMemory(virConnectPtr conn)
} }
if (resourcePoolResourceUsage == NULL) { if (resourcePoolResourceUsage == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Could not retrieve memory usage of resource pool"); _("Could not retrieve memory usage of resource pool"));
goto failure; goto failure;
} }

View File

@ -25,7 +25,6 @@
#include <config.h> #include <config.h>
#include "internal.h" #include "internal.h"
#include "virterror_internal.h"
#include "util.h" #include "util.h"
#include "memory.h" #include "memory.h"
#include "logging.h" #include "logging.h"
@ -38,10 +37,6 @@
#define VIR_FROM_THIS VIR_FROM_ESX #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 static virDrvOpenStatus

View File

@ -25,7 +25,6 @@
#include <config.h> #include <config.h>
#include "internal.h" #include "internal.h"
#include "virterror_internal.h"
#include "util.h" #include "util.h"
#include "memory.h" #include "memory.h"
#include "logging.h" #include "logging.h"
@ -38,10 +37,6 @@
#define VIR_FROM_THIS VIR_FROM_ESX #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 static virDrvOpenStatus

View File

@ -24,9 +24,14 @@
# define __ESX_PRIVATE_H__ # define __ESX_PRIVATE_H__
# include "internal.h" # include "internal.h"
# include "virterror_internal.h"
# include "capabilities.h" # include "capabilities.h"
# include "esx_vi.h" # include "esx_vi.h"
# define ESX_ERROR(code, ...) \
virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)
typedef struct _esxPrivate { typedef struct _esxPrivate {
esxVI_Context *host; esxVI_Context *host;
esxVI_Context *vCenter; esxVI_Context *vCenter;

View File

@ -24,7 +24,6 @@
#include <config.h> #include <config.h>
#include "internal.h" #include "internal.h"
#include "virterror_internal.h"
#include "util.h" #include "util.h"
#include "memory.h" #include "memory.h"
#include "logging.h" #include "logging.h"
@ -37,10 +36,6 @@
#define VIR_FROM_THIS VIR_FROM_ESX #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 static virDrvOpenStatus

View File

@ -25,7 +25,6 @@
#include <config.h> #include <config.h>
#include "internal.h" #include "internal.h"
#include "virterror_internal.h"
#include "util.h" #include "util.h"
#include "memory.h" #include "memory.h"
#include "logging.h" #include "logging.h"
@ -38,10 +37,6 @@
#define VIR_FROM_THIS VIR_FROM_ESX #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 static virDrvOpenStatus

View File

@ -27,21 +27,17 @@
#include <netdb.h> #include <netdb.h>
#include "internal.h" #include "internal.h"
#include "virterror_internal.h"
#include "datatypes.h" #include "datatypes.h"
#include "qparams.h" #include "qparams.h"
#include "util.h" #include "util.h"
#include "memory.h" #include "memory.h"
#include "logging.h" #include "logging.h"
#include "uuid.h" #include "uuid.h"
#include "esx_private.h"
#include "esx_util.h" #include "esx_util.h"
#define VIR_FROM_THIS VIR_FROM_ESX #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. */ /* AI_ADDRCONFIG is missing on some systems. */
#ifndef AI_ADDRCONFIG #ifndef AI_ADDRCONFIG
# define AI_ADDRCONFIG 0 # define AI_ADDRCONFIG 0
@ -101,8 +97,8 @@ esxUtil_ParseQuery(xmlURIPtr uri, char **transport, char **vCenter,
if (STRNEQ(*transport, "http") && STRNEQ(*transport, "https")) { if (STRNEQ(*transport, "http") && STRNEQ(*transport, "https")) {
ESX_ERROR(VIR_ERR_INVALID_ARG, ESX_ERROR(VIR_ERR_INVALID_ARG,
"Query parameter 'transport' has unexpected value " _("Query parameter 'transport' has unexpected value "
"'%s' (should be http|https)", *transport); "'%s' (should be http|https)"), *transport);
goto failure; goto failure;
} }
} else if (STRCASEEQ(queryParam->name, "vcenter")) { } else if (STRCASEEQ(queryParam->name, "vcenter")) {
@ -124,8 +120,8 @@ esxUtil_ParseQuery(xmlURIPtr uri, char **transport, char **vCenter,
if (virStrToLong_i(queryParam->value, NULL, 10, noVerify) < 0 || if (virStrToLong_i(queryParam->value, NULL, 10, noVerify) < 0 ||
(*noVerify != 0 && *noVerify != 1)) { (*noVerify != 0 && *noVerify != 1)) {
ESX_ERROR(VIR_ERR_INVALID_ARG, ESX_ERROR(VIR_ERR_INVALID_ARG,
"Query parameter 'no_verify' has unexpected value " _("Query parameter 'no_verify' has unexpected value "
"'%s' (should be 0 or 1)", queryParam->value); "'%s' (should be 0 or 1)"), queryParam->value);
goto failure; goto failure;
} }
} else if (STRCASEEQ(queryParam->name, "auto_answer")) { } else if (STRCASEEQ(queryParam->name, "auto_answer")) {
@ -136,8 +132,8 @@ esxUtil_ParseQuery(xmlURIPtr uri, char **transport, char **vCenter,
if (virStrToLong_i(queryParam->value, NULL, 10, autoAnswer) < 0 || if (virStrToLong_i(queryParam->value, NULL, 10, autoAnswer) < 0 ||
(*autoAnswer != 0 && *autoAnswer != 1)) { (*autoAnswer != 0 && *autoAnswer != 1)) {
ESX_ERROR(VIR_ERR_INVALID_ARG, ESX_ERROR(VIR_ERR_INVALID_ARG,
"Query parameter 'auto_answer' has unexpected value " _("Query parameter 'auto_answer' has unexpected "
"'%s' (should be 0 or 1)", queryParam->value); "value '%s' (should be 0 or 1)"), queryParam->value);
goto failure; goto failure;
} }
} else { } else {
@ -213,7 +209,7 @@ esxUtil_ParseDatastoreRelatedPath(const char *datastoreRelatedPath,
if (datastoreName == NULL || *datastoreName != NULL || if (datastoreName == NULL || *datastoreName != NULL ||
directoryName == NULL || *directoryName != NULL || directoryName == NULL || *directoryName != NULL ||
fileName == NULL || *fileName != NULL) { fileName == NULL || *fileName != NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1; return -1;
} }
@ -234,8 +230,8 @@ esxUtil_ParseDatastoreRelatedPath(const char *datastoreRelatedPath,
if (sscanf(datastoreRelatedPath, "[%a[^]%]] %a[^\n]", datastoreName, if (sscanf(datastoreRelatedPath, "[%a[^]%]] %a[^\n]", datastoreName,
&directoryAndFileName) != 2) { &directoryAndFileName) != 2) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Datastore related path '%s' doesn't have expected format " _("Datastore related path '%s' doesn't have expected format "
"'[<datastore>] <path>'", datastoreRelatedPath); "'[<datastore>] <path>'"), datastoreRelatedPath);
goto failure; goto failure;
} }
@ -250,7 +246,7 @@ esxUtil_ParseDatastoreRelatedPath(const char *datastoreRelatedPath,
if (*separator == '\0') { if (*separator == '\0') {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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); datastoreRelatedPath);
goto failure; goto failure;
} }
@ -302,14 +298,14 @@ esxUtil_ResolveHostname(const char *hostname,
if (errcode != 0) { if (errcode != 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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)); gai_strerror(errcode));
return -1; return -1;
} }
if (result == NULL) { if (result == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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)); gai_strerror(errcode));
return -1; return -1;
} }
@ -319,7 +315,7 @@ esxUtil_ResolveHostname(const char *hostname,
if (errcode != 0) { if (errcode != 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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)); gai_strerror(errcode));
freeaddrinfo(result); freeaddrinfo(result);
return -1; return -1;
@ -347,13 +343,13 @@ esxUtil_GetConfigString(virConfPtr conf, const char *name, char **string,
} }
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing essential config entry '%s'", name); _("Missing essential config entry '%s'"), name);
return -1; return -1;
} }
if (value->type != VIR_CONF_STRING) { if (value->type != VIR_CONF_STRING) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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 -1;
} }
@ -363,7 +359,7 @@ esxUtil_GetConfigString(virConfPtr conf, const char *name, char **string,
} }
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing essential config entry '%s'", name); _("Missing essential config entry '%s'"), name);
return -1; return -1;
} }
@ -392,14 +388,14 @@ esxUtil_GetConfigUUID(virConfPtr conf, const char *name, unsigned char *uuid,
return 0; return 0;
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing essential config entry '%s'", name); _("Missing essential config entry '%s'"), name);
return -1; return -1;
} }
} }
if (value->type != VIR_CONF_STRING) { if (value->type != VIR_CONF_STRING) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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 -1;
} }
@ -408,14 +404,14 @@ esxUtil_GetConfigUUID(virConfPtr conf, const char *name, unsigned char *uuid,
return 0; return 0;
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing essential config entry '%s'", name); _("Missing essential config entry '%s'"), name);
return -1; return -1;
} }
} }
if (virUUIDParse(value->str, uuid) < 0) { if (virUUIDParse(value->str, uuid) < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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 -1;
} }
@ -438,7 +434,7 @@ esxUtil_GetConfigLong(virConfPtr conf, const char *name, long long *number,
return 0; return 0;
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing essential config entry '%s'", name); _("Missing essential config entry '%s'"), name);
return -1; return -1;
} }
} }
@ -449,7 +445,7 @@ esxUtil_GetConfigLong(virConfPtr conf, const char *name, long long *number,
return 0; return 0;
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing essential config entry '%s'", name); _("Missing essential config entry '%s'"), name);
return -1; return -1;
} }
} }
@ -458,13 +454,13 @@ esxUtil_GetConfigLong(virConfPtr conf, const char *name, long long *number,
*number = -1; *number = -1;
} else if (virStrToLong_ll(value->str, NULL, 10, number) < 0) { } else if (virStrToLong_ll(value->str, NULL, 10, number) < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Config entry '%s' must represent an integer value", _("Config entry '%s' must represent an integer value"),
name); name);
return -1; return -1;
} }
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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 -1;
} }
@ -487,7 +483,7 @@ esxUtil_GetConfigBoolean(virConfPtr conf, const char *name, int *boolean_,
return 0; return 0;
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing essential config entry '%s'", name); _("Missing essential config entry '%s'"), name);
return -1; return -1;
} }
} }
@ -498,7 +494,7 @@ esxUtil_GetConfigBoolean(virConfPtr conf, const char *name, int *boolean_,
return 0; return 0;
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing essential config entry '%s'", name); _("Missing essential config entry '%s'"), name);
return -1; return -1;
} }
} }
@ -509,13 +505,13 @@ esxUtil_GetConfigBoolean(virConfPtr conf, const char *name, int *boolean_,
*boolean_ = 0; *boolean_ = 0;
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Config entry '%s' must represent a boolean value " _("Config entry '%s' must represent a boolean value "
"(true|false)", name); "(true|false)"), name);
return -1; return -1;
} }
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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 -1;
} }

View File

@ -31,7 +31,6 @@
#include "logging.h" #include "logging.h"
#include "util.h" #include "util.h"
#include "uuid.h" #include "uuid.h"
#include "virterror_internal.h"
#include "xml.h" #include "xml.h"
#include "esx_vi.h" #include "esx_vi.h"
#include "esx_vi_methods.h" #include "esx_vi_methods.h"
@ -39,10 +38,6 @@
#define VIR_FROM_THIS VIR_FROM_ESX #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 \ #define ESX_VI__SOAP__REQUEST_HEADER \
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
"<soapenv:Envelope " \ "<soapenv:Envelope " \
@ -252,7 +247,7 @@ esxVI_CURL_Perform(esxVI_Context *ctx, const char *url)
if (errorCode != CURLE_OK) { if (errorCode != CURLE_OK) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, 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); curl_easy_strerror(errorCode), errorCode, ctx->curl_error);
return -1; return -1;
} }
@ -262,16 +257,16 @@ esxVI_CURL_Perform(esxVI_Context *ctx, const char *url)
if (errorCode != CURLE_OK) { if (errorCode != CURLE_OK) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned an " _("curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned an "
"error: %s (%d) : %s", curl_easy_strerror(errorCode), "error: %s (%d) : %s"), curl_easy_strerror(errorCode),
errorCode, ctx->curl_error); errorCode, ctx->curl_error);
return -1; return -1;
} }
if (responseCode < 0) { if (responseCode < 0) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned a " _("curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned a "
"negative response code"); "negative response code"));
return -1; return -1;
} }
@ -282,17 +277,18 @@ esxVI_CURL_Perform(esxVI_Context *ctx, const char *url)
if (errorCode != CURLE_OK) { if (errorCode != CURLE_OK) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"curl_easy_getinfo(CURLINFO_REDIRECT_URL) returned " _("curl_easy_getinfo(CURLINFO_REDIRECT_URL) returned "
"an error: %s (%d) : %s", curl_easy_strerror(errorCode), "an error: %s (%d) : %s"),
curl_easy_strerror(errorCode),
errorCode, ctx->curl_error); errorCode, ctx->curl_error);
} else { } else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"The server redirects from '%s' to '%s'", url, _("The server redirects from '%s' to '%s'"), url,
redirectUrl); redirectUrl);
} }
#else #else
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"The server redirects from '%s'", url); _("The server redirects from '%s'"), url);
#endif #endif
return -1; return -1;
@ -314,7 +310,7 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
if (ctx == NULL || url == NULL || ipAddress == NULL || username == NULL || if (ctx == NULL || url == NULL || ipAddress == NULL || username == NULL ||
password == NULL || ctx->url != NULL || ctx->service != NULL || password == NULL || ctx->url != NULL || ctx->service != NULL ||
ctx->curl_handle != NULL || ctx->curl_headers != 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; goto failure;
} }
@ -326,7 +322,8 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
ctx->curl_handle = curl_easy_init(); ctx->curl_handle = curl_easy_init();
if (ctx->curl_handle == NULL) { 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; goto failure;
} }
@ -345,7 +342,8 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
"Expect: nothing"); "Expect: nothing");
if (ctx->curl_headers == NULL) { 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; goto failure;
} }
@ -369,7 +367,8 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
#endif #endif
if (virMutexInit(&ctx->curl_lock) < 0) { 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; goto failure;
} }
@ -393,8 +392,8 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
ctx->apiVersion = esxVI_APIVersion_40; ctx->apiVersion = esxVI_APIVersion_40;
} else { } else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VI API major/minor version '2.5' or '4.0' " _("Expecting VI API major/minor version '2.5' or '4.0' "
"but found '%s'", ctx->service->about->apiVersion); "but found '%s'"), ctx->service->about->apiVersion);
goto failure; goto failure;
} }
@ -403,8 +402,8 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
ctx->productVersion = esxVI_ProductVersion_GSX20; ctx->productVersion = esxVI_ProductVersion_GSX20;
} else { } else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting GSX major/minor version '2.0' but " _("Expecting GSX major/minor version '2.0' but "
"found '%s'", ctx->service->about->version); "found '%s'"), ctx->service->about->version);
goto failure; goto failure;
} }
} else if (STREQ(ctx->service->about->productLineId, "esx") || } else if (STREQ(ctx->service->about->productLineId, "esx") ||
@ -415,8 +414,8 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
ctx->productVersion = esxVI_ProductVersion_ESX40; ctx->productVersion = esxVI_ProductVersion_ESX40;
} else { } else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting ESX major/minor version '3.5' or " _("Expecting ESX major/minor version '3.5' or "
"'4.0' but found '%s'", "'4.0' but found '%s'"),
ctx->service->about->version); ctx->service->about->version);
goto failure; goto failure;
} }
@ -427,21 +426,21 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
ctx->productVersion = esxVI_ProductVersion_VPX40; ctx->productVersion = esxVI_ProductVersion_VPX40;
} else { } else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VPX major/minor version '2.5' or '4.0' " _("Expecting VPX major/minor version '2.5' or '4.0' "
"but found '%s'", ctx->service->about->version); "but found '%s'"), ctx->service->about->version);
goto failure; goto failure;
} }
} else { } else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting product 'gsx' or 'esx' or 'embeddedEsx' " _("Expecting product 'gsx' or 'esx' or 'embeddedEsx' "
"or 'vpx' but found '%s'", "or 'vpx' but found '%s'"),
ctx->service->about->productLineId); ctx->service->about->productLineId);
goto failure; goto failure;
} }
} else { } else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VI API type 'HostAgent' or 'VirtualCenter' " _("Expecting VI API type 'HostAgent' or 'VirtualCenter' "
"but found '%s'", ctx->service->about->apiType); "but found '%s'"), ctx->service->about->apiType);
goto failure; goto failure;
} }
@ -466,9 +465,9 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
} }
if (datacenterList == NULL) { if (datacenterList == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Could not retrieve the 'datacenter' object from the VI " _("Could not retrieve the 'datacenter' object from the "
"host/center"); "VI host/center"));
goto failure; goto failure;
} }
@ -494,9 +493,9 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
} }
if (ctx->vmFolder == NULL || ctx->hostFolder == NULL) { if (ctx->vmFolder == NULL || ctx->hostFolder == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"The 'datacenter' object is missing the " _("The 'datacenter' object is missing the "
"'vmFolder'/'hostFolder' property"); "'vmFolder'/'hostFolder' property"));
goto failure; goto failure;
} }
@ -519,7 +518,7 @@ esxVI_Context_DownloadFile(esxVI_Context *ctx, const char *url, char **content)
int responseCode = 0; int responseCode = 0;
if (content == NULL || *content != NULL) { 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;
} }
@ -538,7 +537,7 @@ esxVI_Context_DownloadFile(esxVI_Context *ctx, const char *url, char **content)
goto failure; goto failure;
} else if (responseCode != 200) { } else if (responseCode != 200) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, 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); responseCode, url);
goto failure; goto failure;
} }
@ -565,7 +564,7 @@ esxVI_Context_UploadFile(esxVI_Context *ctx, const char *url,
int responseCode = 0; int responseCode = 0;
if (content == NULL) { 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;
} }
@ -584,7 +583,7 @@ esxVI_Context_UploadFile(esxVI_Context *ctx, const char *url,
return -1; return -1;
} else if (responseCode != 200 && responseCode != 201) { } else if (responseCode != 200 && responseCode != 201) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, 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); responseCode, url);
return -1; return -1;
} }
@ -605,7 +604,7 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
xmlNodePtr responseNode = NULL; xmlNodePtr responseNode = NULL;
if (request == NULL || response == NULL || *response != 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; goto failure;
} }
@ -642,14 +641,14 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
if ((*response)->document == NULL) { if ((*response)->document == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, 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); methodName);
goto failure; goto failure;
} }
if (xmlDocGetRootElement((*response)->document) == NULL) { if (xmlDocGetRootElement((*response)->document) == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, 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); methodName);
goto failure; goto failure;
} }
@ -657,8 +656,8 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
xpathContext = xmlXPathNewContext((*response)->document); xpathContext = xmlXPathNewContext((*response)->document);
if (xpathContext == NULL) { if (xpathContext == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Could not create XPath context"); _("Could not create XPath context"));
goto failure; goto failure;
} }
@ -673,23 +672,23 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
if ((*response)->node == NULL) { if ((*response)->node == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"HTTP response code %d for call to '%s'. " _("HTTP response code %d for call to '%s'. "
"Fault is unknown, XPath evaluation failed", "Fault is unknown, XPath evaluation failed"),
(*response)->responseCode, methodName); (*response)->responseCode, methodName);
goto failure; goto failure;
} }
if (esxVI_Fault_Deserialize((*response)->node, &fault) < 0) { if (esxVI_Fault_Deserialize((*response)->node, &fault) < 0) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"HTTP response code %d for call to '%s'. " _("HTTP response code %d for call to '%s'. "
"Fault is unknown, deserialization failed", "Fault is unknown, deserialization failed"),
(*response)->responseCode, methodName); (*response)->responseCode, methodName);
goto failure; goto failure;
} }
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"HTTP response code %d for call to '%s'. " _("HTTP response code %d for call to '%s'. "
"Fault: %s - %s", (*response)->responseCode, "Fault: %s - %s"), (*response)->responseCode,
methodName, fault->faultcode, fault->faultstring); methodName, fault->faultcode, fault->faultstring);
/* FIXME: Dump raw response until detail part gets deserialized */ /* FIXME: Dump raw response until detail part gets deserialized */
@ -710,8 +709,8 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
if (responseNode == NULL) { if (responseNode == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"XPath evaluation of response for call to '%s' " _("XPath evaluation of response for call to '%s' "
"failed", methodName); "failed"), methodName);
goto failure; goto failure;
} }
@ -722,13 +721,13 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
case esxVI_Occurrence_RequiredItem: case esxVI_Occurrence_RequiredItem:
if ((*response)->node == NULL) { if ((*response)->node == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Call to '%s' returned an empty result, " _("Call to '%s' returned an empty result, "
"expecting a non-empty result", methodName); "expecting a non-empty result"), methodName);
goto failure; goto failure;
} else if ((*response)->node->next != NULL) { } else if ((*response)->node->next != NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Call to '%s' returned a list, expecting " _("Call to '%s' returned a list, expecting "
"exactly one item", methodName); "exactly one item"), methodName);
goto failure; goto failure;
} }
@ -737,8 +736,8 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
case esxVI_Occurrence_RequiredList: case esxVI_Occurrence_RequiredList:
if ((*response)->node == NULL) { if ((*response)->node == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Call to '%s' returned an empty result, " _("Call to '%s' returned an empty result, "
"expecting a non-empty result", methodName); "expecting a non-empty result"), methodName);
goto failure; goto failure;
} }
@ -748,8 +747,8 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
if ((*response)->node != NULL && if ((*response)->node != NULL &&
(*response)->node->next != NULL) { (*response)->node->next != NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Call to '%s' returned a list, expecting " _("Call to '%s' returned a list, expecting "
"exactly one item", methodName); "exactly one item"), methodName);
goto failure; goto failure;
} }
@ -762,22 +761,22 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
case esxVI_Occurrence_None: case esxVI_Occurrence_None:
if ((*response)->node != NULL) { if ((*response)->node != NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Call to '%s' returned something, expecting " _("Call to '%s' returned something, expecting "
"an empty result", methodName); "an empty result"), methodName);
goto failure; goto failure;
} }
break; break;
default: default:
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Invalid argument (occurrence)"); _("Invalid argument (occurrence)"));
goto failure; goto failure;
} }
} }
} else { } else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, 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); (*response)->responseCode, methodName);
goto failure; goto failure;
} }
@ -830,7 +829,7 @@ esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration *enumeration,
int i; int i;
if (anyType == NULL || value == NULL) { 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; return -1;
} }
@ -838,7 +837,7 @@ esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration *enumeration,
if (anyType->type != enumeration->type) { if (anyType->type != enumeration->type) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, 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(enumeration->type),
esxVI_Type_ToString(anyType->type)); esxVI_Type_ToString(anyType->type));
return -1; return -1;
@ -852,7 +851,7 @@ esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration *enumeration,
} }
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, 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)); esxVI_Type_ToString(enumeration->type));
return -1; return -1;
@ -866,7 +865,7 @@ esxVI_Enumeration_Serialize(const esxVI_Enumeration *enumeration,
const char *name = NULL; const char *name = NULL;
if (element == NULL || output == 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; return -1;
} }
@ -882,7 +881,7 @@ esxVI_Enumeration_Serialize(const esxVI_Enumeration *enumeration,
} }
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"));
return -1; return -1;
} }
@ -905,7 +904,7 @@ esxVI_Enumeration_Deserialize(const esxVI_Enumeration *enumeration,
char *name = NULL; char *name = NULL;
if (value == 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; goto failure;
} }
@ -922,7 +921,7 @@ esxVI_Enumeration_Deserialize(const esxVI_Enumeration *enumeration,
} }
} }
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)); name, esxVI_Type_ToString(enumeration->type));
cleanup: cleanup:
@ -948,7 +947,7 @@ esxVI_List_Append(esxVI_List **list, esxVI_List *item)
esxVI_List *next = NULL; esxVI_List *next = NULL;
if (list == NULL || item == 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; return -1;
} }
@ -977,7 +976,7 @@ esxVI_List_DeepCopy(esxVI_List **destList, esxVI_List *srcList,
esxVI_List *src = NULL; esxVI_List *src = NULL;
if (destList == NULL || *destList != 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; goto failure;
} }
@ -1011,7 +1010,7 @@ esxVI_List_CastFromAnyType(esxVI_AnyType *anyType, esxVI_List **list,
if (list == NULL || *list != NULL || if (list == NULL || *list != NULL ||
castFromAnyTypeFunc == NULL || freeFunc == 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; return -1;
} }
@ -1021,7 +1020,7 @@ esxVI_List_CastFromAnyType(esxVI_AnyType *anyType, esxVI_List **list,
if (! STRPREFIX(anyType->other, "ArrayOf")) { if (! STRPREFIX(anyType->other, "ArrayOf")) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, 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); anyType->other);
return -1; return -1;
} }
@ -1030,7 +1029,7 @@ esxVI_List_CastFromAnyType(esxVI_AnyType *anyType, esxVI_List **list,
childNode = childNode->next) { childNode = childNode->next) {
if (childNode->type != XML_ELEMENT_NODE) { if (childNode->type != XML_ELEMENT_NODE) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Wrong XML element type %d", childNode->type); _("Wrong XML element type %d"), childNode->type);
goto failure; goto failure;
} }
@ -1067,7 +1066,7 @@ esxVI_List_Serialize(esxVI_List *list, const char *element,
esxVI_List *item = NULL; esxVI_List *item = NULL;
if (element == NULL || output == NULL || serializeFunc == 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; return -1;
} }
@ -1093,7 +1092,7 @@ esxVI_List_Deserialize(xmlNodePtr node, esxVI_List **list,
if (list == NULL || *list != NULL || if (list == NULL || *list != NULL ||
deserializeFunc == NULL || freeFunc == 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; return -1;
} }
@ -1104,7 +1103,7 @@ esxVI_List_Deserialize(xmlNodePtr node, esxVI_List **list,
for (; node != NULL; node = node->next) { for (; node != NULL; node = node->next) {
if (node->type != XML_ELEMENT_NODE) { if (node->type != XML_ELEMENT_NODE) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Wrong XML element type %d", node->type); _("Wrong XML element type %d"), node->type);
goto failure; goto failure;
} }
@ -1139,7 +1138,7 @@ int
esxVI_Alloc(void **ptrptr, size_t size) esxVI_Alloc(void **ptrptr, size_t size)
{ {
if (ptrptr == NULL || *ptrptr != 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; return -1;
} }
@ -1163,7 +1162,7 @@ esxVI_BuildFullTraversalSpecItem(esxVI_SelectionSpec **fullTraversalSpecList,
const char *currentSelectSetName = NULL; const char *currentSelectSetName = NULL;
if (fullTraversalSpecList == 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; return -1;
} }
@ -1214,7 +1213,7 @@ int
esxVI_BuildFullTraversalSpecList(esxVI_SelectionSpec **fullTraversalSpecList) esxVI_BuildFullTraversalSpecList(esxVI_SelectionSpec **fullTraversalSpecList)
{ {
if (fullTraversalSpecList == NULL || *fullTraversalSpecList != NULL) { 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; return -1;
} }
@ -1332,7 +1331,7 @@ esxVI_EnsureSession(esxVI_Context *ctx)
#endif #endif
if (ctx->session == NULL) { 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; return -1;
} }
@ -1383,9 +1382,9 @@ esxVI_EnsureSession(esxVI_Context *ctx)
goto failure; goto failure;
} }
} else if (STRNEQ(ctx->session->key, currentSession->key)) { } else if (STRNEQ(ctx->session->key, currentSession->key)) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Key of the current session differs from the key at " _("Key of the current session differs from the key at "
"last login"); "last login"));
goto failure; goto failure;
} }
@ -1419,7 +1418,7 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx,
esxVI_PropertyFilterSpec *propertyFilterSpec = NULL; esxVI_PropertyFilterSpec *propertyFilterSpec = NULL;
if (ctx->fullTraversalSpecList == 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; return -1;
} }
@ -1495,8 +1494,8 @@ esxVI_GetManagedEntityStatus(esxVI_ObjectContent *objectContent,
} }
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing '%s' property while looking for ManagedEntityStatus", _("Missing '%s' property while looking for "
propertyName); "ManagedEntityStatus"), propertyName);
return -1; return -1;
} }
@ -1517,8 +1516,8 @@ esxVI_GetVirtualMachinePowerState(esxVI_ObjectContent *virtualMachine,
} }
} }
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Missing 'runtime.powerState' property"); _("Missing 'runtime.powerState' property"));
return -1; return -1;
} }
@ -1533,7 +1532,7 @@ esxVI_GetVirtualMachineQuestionInfo
esxVI_DynamicProperty *dynamicProperty; esxVI_DynamicProperty *dynamicProperty;
if (questionInfo == NULL || *questionInfo != NULL) { 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; return -1;
} }
@ -1618,8 +1617,8 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
esxVI_ManagedEntityStatus configStatus = esxVI_ManagedEntityStatus_Undefined; esxVI_ManagedEntityStatus configStatus = esxVI_ManagedEntityStatus_Undefined;
if (STRNEQ(virtualMachine->obj->type, "VirtualMachine")) { if (STRNEQ(virtualMachine->obj->type, "VirtualMachine")) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"ObjectContent does not reference a virtual machine"); _("ObjectContent does not reference a virtual machine"));
return -1; return -1;
} }
@ -1627,7 +1626,7 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
if (esxUtil_ParseVirtualMachineIDString if (esxUtil_ParseVirtualMachineIDString
(virtualMachine->obj->value, id) < 0 || *id <= 0) { (virtualMachine->obj->value, id) < 0 || *id <= 0) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not parse positive integer from '%s'", _("Could not parse positive integer from '%s'"),
virtualMachine->obj->value); virtualMachine->obj->value);
goto failure; goto failure;
} }
@ -1635,7 +1634,7 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
if (name != NULL) { if (name != NULL) {
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; goto failure;
} }
@ -1660,8 +1659,8 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
} }
if (*name == NULL) { if (*name == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Could not get name of virtual machine"); _("Could not get name of virtual machine"));
goto failure; goto failure;
} }
} }
@ -1688,14 +1687,14 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
} }
if (uuid_string == NULL) { if (uuid_string == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Could not get UUID of virtual machine"); _("Could not get UUID of virtual machine"));
goto failure; goto failure;
} }
if (virUUIDParse(uuid_string, uuid) < 0) { if (virUUIDParse(uuid_string, uuid) < 0) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not parse UUID from string '%s'", _("Could not parse UUID from string '%s'"),
uuid_string); uuid_string);
goto failure; goto failure;
} }
@ -1731,7 +1730,7 @@ esxVI_LookupResourcePoolByHostSystem
esxVI_ObjectContent *computeResource = NULL; esxVI_ObjectContent *computeResource = NULL;
if (resourcePool == NULL || *resourcePool != 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; return -1;
} }
@ -1750,8 +1749,8 @@ esxVI_LookupResourcePoolByHostSystem
} }
if (managedObjectReference == NULL) { if (managedObjectReference == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Could not retrieve compute resource of host system"); _("Could not retrieve compute resource of host system"));
goto failure; goto failure;
} }
@ -1764,8 +1763,8 @@ esxVI_LookupResourcePoolByHostSystem
} }
if (computeResource == NULL) { if (computeResource == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Could not retrieve compute resource of host system"); _("Could not retrieve compute resource of host system"));
goto failure; goto failure;
} }
@ -1784,8 +1783,8 @@ esxVI_LookupResourcePoolByHostSystem
} }
if ((*resourcePool) == NULL) { if ((*resourcePool) == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Could not retrieve resource pool of compute resource"); _("Could not retrieve resource pool of compute resource"));
goto failure; goto failure;
} }
@ -1813,7 +1812,7 @@ esxVI_LookupHostSystemByIp(esxVI_Context *ctx, const char *ipAddress,
esxVI_ManagedObjectReference *managedObjectReference = NULL; esxVI_ManagedObjectReference *managedObjectReference = NULL;
if (hostSystem == NULL || *hostSystem != 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; return -1;
} }
@ -1852,7 +1851,7 @@ esxVI_LookupVirtualMachineByUuid(esxVI_Context *ctx, const unsigned char *uuid,
char uuid_string[VIR_UUID_STRING_BUFLEN] = ""; char uuid_string[VIR_UUID_STRING_BUFLEN] = "";
if (virtualMachine == NULL || *virtualMachine != 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 -1;
} }
@ -1868,7 +1867,8 @@ esxVI_LookupVirtualMachineByUuid(esxVI_Context *ctx, const unsigned char *uuid,
return 0; return 0;
} else { } else {
ESX_VI_ERROR(VIR_ERR_NO_DOMAIN, 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; goto failure;
} }
} }
@ -1906,7 +1906,7 @@ esxVI_LookupVirtualMachineByName(esxVI_Context *ctx, const char *name,
char *name_candidate = NULL; char *name_candidate = NULL;
if (virtualMachine == NULL || *virtualMachine != 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 -1;
} }
@ -1945,7 +1945,7 @@ esxVI_LookupVirtualMachineByName(esxVI_Context *ctx, const char *name,
return 0; return 0;
} else { } else {
ESX_VI_ERROR(VIR_ERR_NO_DOMAIN, 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; goto failure;
} }
} }
@ -1998,8 +1998,8 @@ esxVI_LookupVirtualMachineByUuidAndPrepareForTask
} }
if (pendingTaskInfoList != NULL) { if (pendingTaskInfoList != NULL) {
ESX_VI_ERROR(VIR_ERR_OPERATION_INVALID, ESX_VI_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
"Other tasks are pending for this domain"); _("Other tasks are pending for this domain"));
goto failure; goto failure;
} }
@ -2034,7 +2034,7 @@ esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name,
int numInaccessibleDatastores = 0; int numInaccessibleDatastores = 0;
if (datastore == NULL || *datastore != NULL) { 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; return -1;
} }
@ -2059,7 +2059,8 @@ esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name,
if (occurrence == esxVI_Occurrence_OptionalItem) { if (occurrence == esxVI_Occurrence_OptionalItem) {
goto cleanup; goto cleanup;
} else { } else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "No datastores available"); ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
_("No datastores available"));
goto failure; goto failure;
} }
} }
@ -2083,9 +2084,9 @@ esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name,
} }
if (accessible == esxVI_Boolean_Undefined) { if (accessible == esxVI_Boolean_Undefined) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Got incomplete response while querying for the " _("Got incomplete response while querying for the "
"datastore 'summary.accessible' property"); "datastore 'summary.accessible' property"));
goto failure; goto failure;
} }
@ -2129,8 +2130,8 @@ esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name,
if (! STRPREFIX(dynamicProperty->val->string, if (! STRPREFIX(dynamicProperty->val->string,
"/vmfs/volumes/")) { "/vmfs/volumes/")) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Datastore URL '%s' has unexpected prefix, " _("Datastore URL '%s' has unexpected prefix, "
"expecting '/vmfs/volumes/' prefix", "expecting '/vmfs/volumes/' prefix"),
dynamicProperty->val->string); dynamicProperty->val->string);
goto failure; goto failure;
} }
@ -2153,11 +2154,11 @@ esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name,
if (occurrence != esxVI_Occurrence_OptionalItem) { if (occurrence != esxVI_Occurrence_OptionalItem) {
if (numInaccessibleDatastores > 0) { if (numInaccessibleDatastores > 0) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not find datastore '%s', maybe it's " _("Could not find datastore '%s', maybe it's "
"inaccessible", name); "inaccessible"), name);
} else { } else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not find datastore '%s'", name); _("Could not find datastore '%s'"), name);
} }
goto failure; goto failure;
@ -2187,7 +2188,7 @@ int esxVI_LookupTaskInfoByTask(esxVI_Context *ctx,
esxVI_DynamicProperty *dynamicProperty = NULL; esxVI_DynamicProperty *dynamicProperty = NULL;
if (taskInfo == NULL || *taskInfo != 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; return -1;
} }
@ -2239,7 +2240,7 @@ esxVI_LookupPendingTaskInfoListByVirtualMachine
esxVI_TaskInfo *taskInfo = NULL; esxVI_TaskInfo *taskInfo = NULL;
if (pendingTaskInfoList == NULL || *pendingTaskInfoList != 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; return -1;
} }
@ -2377,15 +2378,15 @@ esxVI_HandleVirtualMachineQuestion
if (autoAnswer == esxVI_Boolean_True) { if (autoAnswer == esxVI_Boolean_True) {
if (possibleAnswers == NULL) { if (possibleAnswers == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Pending question blocks virtual machine execution, " _("Pending question blocks virtual machine execution, "
"question is '%s', no possible answers", "question is '%s', no possible answers"),
questionInfo->text); questionInfo->text);
goto failure; goto failure;
} else if (answerChoice == NULL) { } else if (answerChoice == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Pending question blocks virtual machine execution, " _("Pending question blocks virtual machine execution, "
"question is '%s', possible answers are %s, but no " "question is '%s', possible answers are %s, but no "
"default answer is specified", questionInfo->text, "default answer is specified"), questionInfo->text,
possibleAnswers); possibleAnswers);
goto failure; goto failure;
} }
@ -2402,13 +2403,13 @@ esxVI_HandleVirtualMachineQuestion
} else { } else {
if (possibleAnswers != NULL) { if (possibleAnswers != NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Pending question blocks virtual machine execution, " _("Pending question blocks virtual machine execution, "
"question is '%s', possible answers are %s", "question is '%s', possible answers are %s"),
questionInfo->text, possibleAnswers); questionInfo->text, possibleAnswers);
} else { } else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Pending question blocks virtual machine execution, " _("Pending question blocks virtual machine execution, "
"question is '%s', no possible answers", "question is '%s', no possible answers"),
questionInfo->text); questionInfo->text);
} }

View File

@ -28,9 +28,18 @@
# include <curl/curl.h> # include <curl/curl.h>
# include "internal.h" # include "internal.h"
# include "virterror_internal.h"
# include "datatypes.h" # include "datatypes.h"
# include "esx_vi_types.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_APIVersion esxVI_APIVersion;
typedef enum _esxVI_ProductVersion esxVI_ProductVersion; typedef enum _esxVI_ProductVersion esxVI_ProductVersion;
typedef enum _esxVI_Occurrence esxVI_Occurrence; typedef enum _esxVI_Occurrence esxVI_Occurrence;

View File

@ -27,15 +27,12 @@
#include "memory.h" #include "memory.h"
#include "logging.h" #include "logging.h"
#include "uuid.h" #include "uuid.h"
#include "virterror_internal.h"
#include "esx_vi_methods.h" #include "esx_vi_methods.h"
#include "esx_util.h" #include "esx_util.h"
#define VIR_FROM_THIS VIR_FROM_ESX #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 \ #define ESX_VI__SOAP__REQUEST_HEADER \
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
@ -46,6 +43,8 @@
"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" \ "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" \
"<soapenv:Body>" "<soapenv:Body>"
#define ESX_VI__SOAP__REQUEST_FOOTER \ #define ESX_VI__SOAP__REQUEST_FOOTER \
"</soapenv:Body>" \ "</soapenv:Body>" \
"</soapenv:Envelope>" "</soapenv:Envelope>"
@ -109,7 +108,7 @@
#define ESX_VI__METHOD__CHECK_SERVICE() \ #define ESX_VI__METHOD__CHECK_SERVICE() \
if (ctx->service == NULL) { \ 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; \ return -1; \
} }
@ -117,7 +116,7 @@
#define ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(_name) \ #define ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(_name) \
if (_name == NULL || *_name != NULL) { \ 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; \ return -1; \
} }
@ -198,7 +197,7 @@ esxVI_RetrieveServiceContent(esxVI_Context *ctx,
esxVI_Response *response = NULL; esxVI_Response *response = NULL;
if (serviceContent == NULL || *serviceContent != 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; return -1;
} }
@ -276,7 +275,7 @@ ESX_VI__METHOD(SessionIsActive,
ESX_VI__METHOD__CHECK_SERVICE() ESX_VI__METHOD__CHECK_SERVICE()
if (active == NULL) { if (active == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1; return -1;
} }
}, },

View File

@ -32,16 +32,11 @@
#include "memory.h" #include "memory.h"
#include "logging.h" #include "logging.h"
#include "util.h" #include "util.h"
#include "virterror_internal.h"
#include "esx_vi.h" #include "esx_vi.h"
#include "esx_vi_types.h" #include "esx_vi_types.h"
#define VIR_FROM_THIS VIR_FROM_ESX #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) \ #define ESV_VI__XML_TAG__OPEN(_buffer, _element, _type) \
@ -123,7 +118,8 @@
esxVI_##_type##_DeepCopy(esxVI_##_type **dest, esxVI_##_type *src) \ esxVI_##_type##_DeepCopy(esxVI_##_type **dest, esxVI_##_type *src) \
{ \ { \
if (dest == NULL || *dest != NULL) { \ 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; \ return -1; \
} \ } \
\ \
@ -213,7 +209,8 @@
esxVI_##_type **ptrptr) \ esxVI_##_type **ptrptr) \
{ \ { \
if (anyType == NULL || ptrptr == NULL || *ptrptr != NULL) { \ 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; \ return -1; \
} \ } \
\ \
@ -236,7 +233,8 @@
const char *element, virBufferPtr output) \ const char *element, virBufferPtr output) \
{ \ { \
if (element == NULL || output == 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; \ return -1; \
} \ } \
\ \
@ -274,7 +272,8 @@
xmlNodePtr childNode = NULL; \ xmlNodePtr childNode = NULL; \
\ \
if (ptrptr == NULL || *ptrptr != 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; \ return -1; \
} \ } \
\ \
@ -318,7 +317,8 @@
long long value; \ long long value; \
\ \
if (number == NULL || *number != NULL) { \ 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; \ return -1; \
} \ } \
\ \
@ -565,7 +565,8 @@
esxVI_##__type##_DynamicCast(void *item) \ esxVI_##__type##_DynamicCast(void *item) \
{ \ { \
if (item == NULL) { \ if (item == NULL) { \
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \
_("Invalid argument")); \
return NULL; \ return NULL; \
} \ } \
\ \
@ -709,7 +710,7 @@ esxVI_AnyType_ExpectType(esxVI_AnyType *anyType, esxVI_Type type)
{ {
if (anyType->type != type) { if (anyType->type != type) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting type '%s' but found '%s'", _("Expecting type '%s' but found '%s'"),
esxVI_Type_ToString(type), esxVI_Type_ToString(type),
anyType->type != esxVI_Type_Other anyType->type != esxVI_Type_Other
? esxVI_Type_ToString(anyType->type) ? esxVI_Type_ToString(anyType->type)
@ -724,7 +725,7 @@ int
esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src) esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
{ {
if (dest == NULL || *dest != NULL) { 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; return -1;
} }
@ -740,7 +741,8 @@ esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
(*dest)->node = xmlCopyNode(src->node, 1); (*dest)->node = xmlCopyNode(src->node, 1);
if ((*dest)->node == NULL) { 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; goto failure;
} }
@ -790,7 +792,7 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
long long int number; long long int number;
if (anyType == NULL || *anyType != NULL) { 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; return -1;
} }
@ -801,7 +803,8 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
(*anyType)->node = xmlCopyNode(node, 1); (*anyType)->node = xmlCopyNode(node, 1);
if ((*anyType)->node == NULL) { 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; goto failure;
} }
@ -811,8 +814,8 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
BAD_CAST "http://www.w3.org/2001/XMLSchema-instance"); BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");
if ((*anyType)->other == NULL) { if ((*anyType)->other == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"AnyType is missing 'type' property"); _("AnyType is missing 'type' property"));
goto failure; goto failure;
} }
@ -820,7 +823,7 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
if ((*anyType)->type == esxVI_Type_Undefined) { if ((*anyType)->type == esxVI_Type_Undefined) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unknown value '%s' for AnyType 'type' property", _("Unknown value '%s' for AnyType 'type' property"),
(*anyType)->other); (*anyType)->other);
goto failure; goto failure;
} }
@ -837,19 +840,19 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
} }
} }
#define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max) \ #define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max) \
do { \ do { \
if (virStrToLong_ll((*anyType)->value, NULL, 10, &number) < 0) { \ if (virStrToLong_ll((*anyType)->value, NULL, 10, &number) < 0) { \
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
"Unknown value '%s' for "_xsdType, \ _("Unknown value '%s' for %s"), \
(*anyType)->value); \ (*anyType)->value, _xsdType); \
goto failure; \ goto failure; \
} \ } \
\ \
if (number < (_min) || number > (_max)) { \ if (number < (_min) || number > (_max)) { \
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
"Value '%s' is out of "_xsdType" range", \ _("Value '%s' is out of %s range"), \
(*anyType)->value); \ (*anyType)->value, _xsdType); \
goto failure; \ goto failure; \
} \ } \
\ \
@ -864,7 +867,7 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
(*anyType)->boolean = esxVI_Boolean_False; (*anyType)->boolean = esxVI_Boolean_False;
} else { } else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unknown value '%s' for xsd:boolean", _("Unknown value '%s' for xsd:boolean"),
(*anyType)->value); (*anyType)->value);
goto failure; goto failure;
} }
@ -995,7 +998,7 @@ int
esxVI_String_DeepCopyValue(char **dest, const char *src) esxVI_String_DeepCopyValue(char **dest, const char *src)
{ {
if (dest == NULL || *dest != NULL) { 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; return -1;
} }
@ -1029,7 +1032,7 @@ esxVI_String_SerializeValue(const char *value, const char *element,
virBufferPtr output) virBufferPtr output)
{ {
if (element == NULL || output == 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; return -1;
} }
@ -1059,7 +1062,7 @@ int
esxVI_String_DeserializeValue(xmlNodePtr node, char **value) esxVI_String_DeserializeValue(xmlNodePtr node, char **value)
{ {
if (value == NULL || *value != NULL) { 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; return -1;
} }
@ -1184,7 +1187,7 @@ int
esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime) esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime)
{ {
if (dateTime == NULL || *dateTime != NULL) { 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; return -1;
} }
@ -1196,9 +1199,9 @@ esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime)
(char *)xmlNodeListGetString(node->doc, node->children, 1); (char *)xmlNodeListGetString(node->doc, node->children, 1);
if ((*dateTime)->value == NULL) { if ((*dateTime)->value == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"XML node doesn't contain text, expecting an " _("XML node doesn't contain text, expecting an "
"xsd:dateTime value"); "xsd:dateTime value"));
goto failure; goto failure;
} }
@ -1281,7 +1284,7 @@ esxVI_ManagedObjectReference_Serialize
const char *element, virBufferPtr output) const char *element, virBufferPtr output)
{ {
if (element == NULL || output == 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; return -1;
} }
@ -1311,7 +1314,7 @@ esxVI_ManagedObjectReference_Deserialize
(xmlNodePtr node, esxVI_ManagedObjectReference **managedObjectReference) (xmlNodePtr node, esxVI_ManagedObjectReference **managedObjectReference)
{ {
if (managedObjectReference == NULL || *managedObjectReference != NULL) { 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; return -1;
} }
@ -1323,8 +1326,8 @@ esxVI_ManagedObjectReference_Deserialize
(char *)xmlGetNoNsProp(node, BAD_CAST "type"); (char *)xmlGetNoNsProp(node, BAD_CAST "type");
if ((*managedObjectReference)->type == NULL) { if ((*managedObjectReference)->type == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"ManagedObjectReference is missing 'type' property"); _("ManagedObjectReference is missing 'type' property"));
goto failure; goto failure;
} }

View File

@ -27,6 +27,7 @@
#include "virterror_internal.h" #include "virterror_internal.h"
#include "memory.h" #include "memory.h"
#include "logging.h" #include "logging.h"
#include "esx_private.h"
#include "esx_util.h" #include "esx_util.h"
#include "esx_vmx.h" #include "esx_vmx.h"
@ -421,12 +422,6 @@ def->parallels[0]...
#define VIR_FROM_THIS VIR_FROM_ESX #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) \ #define ESX_BUILD_VMX_NAME(_suffix) \
snprintf(_suffix##_name, sizeof(_suffix##_name), "%s."#_suffix, prefix); snprintf(_suffix##_name, sizeof(_suffix##_name), "%s."#_suffix, prefix);
@ -438,9 +433,9 @@ esxVMX_SCSIDiskNameToControllerAndID(const char *name, int *controller, int *id)
int idx; int idx;
if (! STRPREFIX(name, "sd")) { if (! STRPREFIX(name, "sd")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Expecting domain XML attribute 'dev' of entry " _("Expecting domain XML attribute 'dev' of entry "
"'devices/disk/target' to start with 'sd'"); "'devices/disk/target' to start with 'sd'"));
return -1; return -1;
} }
@ -448,14 +443,14 @@ esxVMX_SCSIDiskNameToControllerAndID(const char *name, int *controller, int *id)
if (idx < 0) { if (idx < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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; return -1;
} }
/* Each of the 4 SCSI controllers offers 15 IDs for devices */ /* Each of the 4 SCSI controllers offers 15 IDs for devices */
if (idx >= (4 * 15)) { if (idx >= (4 * 15)) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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; return -1;
} }
@ -478,9 +473,9 @@ esxVMX_IDEDiskNameToControllerAndID(const char *name, int *controller, int *id)
int idx; int idx;
if (! STRPREFIX(name, "hd")) { if (! STRPREFIX(name, "hd")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Expecting domain XML attribute 'dev' of entry " _("Expecting domain XML attribute 'dev' of entry "
"'devices/disk/target' to start with 'hd'"); "'devices/disk/target' to start with 'hd'"));
return -1; return -1;
} }
@ -488,14 +483,14 @@ esxVMX_IDEDiskNameToControllerAndID(const char *name, int *controller, int *id)
if (idx < 0) { if (idx < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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; return -1;
} }
/* Each of the 2 IDE controllers offers 2 IDs for devices */ /* Each of the 2 IDE controllers offers 2 IDs for devices */
if (idx >= (2 * 2)) { if (idx >= (2 * 2)) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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; return -1;
} }
@ -513,9 +508,9 @@ esxVMX_FloppyDiskNameToController(const char *name, int *controller)
int idx; int idx;
if (! STRPREFIX(name, "fd")) { if (! STRPREFIX(name, "fd")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Expecting domain XML attribute 'dev' of entry " _("Expecting domain XML attribute 'dev' of entry "
"'devices/disk/target' to start with 'fd'"); "'devices/disk/target' to start with 'fd'"));
return -1; return -1;
} }
@ -523,13 +518,13 @@ esxVMX_FloppyDiskNameToController(const char *name, int *controller)
if (idx < 0) { if (idx < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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; return -1;
} }
if (idx >= 2) { if (idx >= 2) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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; return -1;
} }
@ -559,8 +554,8 @@ esxVMX_GatherSCSIControllers(virDomainDefPtr def, char *virtualDev[4],
STRCASENEQ(disk->driverName, "buslogic") && STRCASENEQ(disk->driverName, "buslogic") &&
STRCASENEQ(disk->driverName, "lsilogic")) { STRCASENEQ(disk->driverName, "lsilogic")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML entry 'devices/disk/target' to be " _("Expecting domain XML entry 'devices/disk/target' to "
"'buslogic' or 'lsilogic' but found '%s'", "be 'buslogic' or 'lsilogic' but found '%s'"),
disk->driverName); disk->driverName);
return -1; return -1;
} }
@ -576,8 +571,8 @@ esxVMX_GatherSCSIControllers(virDomainDefPtr def, char *virtualDev[4],
virtualDev[controller] = disk->driverName; virtualDev[controller] = disk->driverName;
} else if (STRCASENEQ(virtualDev[controller], disk->driverName)) { } else if (STRCASENEQ(virtualDev[controller], disk->driverName)) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Inconsistent driver usage ('%s' is not '%s') on SCSI " _("Inconsistent driver usage ('%s' is not '%s') on SCSI "
"controller index %d", virtualDev[controller], "controller index %d"), virtualDev[controller],
disk->driverName, controller); disk->driverName, controller);
return -1; return -1;
} }
@ -602,8 +597,8 @@ esxVMX_AbsolutePathToDatastoreRelatedPath(esxVI_Context *ctx,
if (sscanf(absolutePath, "/vmfs/volumes/%a[^/]/%a[^\n]", if (sscanf(absolutePath, "/vmfs/volumes/%a[^/]/%a[^\n]",
&preliminaryDatastoreName, &directoryAndFileName) != 2) { &preliminaryDatastoreName, &directoryAndFileName) != 2) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Absolute path '%s' doesn't have expected format " _("Absolute path '%s' doesn't have expected format "
"'/vmfs/volumes/<datastore>/<path>'", absolutePath); "'/vmfs/volumes/<datastore>/<path>'"), absolutePath);
goto failure; goto failure;
} }
@ -697,8 +692,8 @@ esxVMX_ParseFileName(esxVI_Context *ctx, const char *fileName,
} else if (strchr(fileName, '/') != NULL) { } else if (strchr(fileName, '/') != NULL) {
/* Found relative path, this is not supported */ /* Found relative path, this is not supported */
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Found relative path '%s' in VMX file, this is not " _("Found relative path '%s' in VMX file, this is not "
"supported", fileName); "supported"), fileName);
return NULL; return NULL;
} else { } else {
/* Found single file name referencing a file inside a datastore */ /* Found single file name referencing a file inside a datastore */
@ -758,8 +753,8 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
if (config_version != 8) { if (config_version != 8) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry 'config.version' to be 8 but found " _("Expecting VMX entry 'config.version' to be 8 but found "
"%lld", config_version); "%lld"), config_version);
goto failure; goto failure;
} }
@ -773,8 +768,9 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
case esxVI_APIVersion_25: case esxVI_APIVersion_25:
if (virtualHW_version != 4) { if (virtualHW_version != 4) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry 'virtualHW.version' to be 4 for " _("Expecting VMX entry 'virtualHW.version' to be 4 for "
"VI API version 2.5 but found %lld", virtualHW_version); "VI API version 2.5 but found %lld"),
virtualHW_version);
goto failure; goto failure;
} }
@ -783,8 +779,9 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
case esxVI_APIVersion_40: case esxVI_APIVersion_40:
if (virtualHW_version != 4 && virtualHW_version != 7) { if (virtualHW_version != 4 && virtualHW_version != 7) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry 'virtualHW.version' to be 4 or 7 for " _("Expecting VMX entry 'virtualHW.version' to be 4 or 7 "
"VI API version 4.0 but found %lld", virtualHW_version); "for VI API version 4.0 but found %lld"),
virtualHW_version);
goto failure; goto failure;
} }
@ -793,16 +790,16 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
case esxVI_APIVersion_Unknown: case esxVI_APIVersion_Unknown:
if (virtualHW_version != 4 && virtualHW_version != 7) { if (virtualHW_version != 4 && virtualHW_version != 7) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry 'virtualHW.version' to be 4 or 7 " _("Expecting VMX entry 'virtualHW.version' to be 4 or 7 "
"but found %lld", virtualHW_version); "but found %lld"), virtualHW_version);
goto failure; goto failure;
} }
break; break;
default: default:
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Expecting VI API version 2.5 or 4.0"); _("Expecting VI API version 2.5 or 4.0"));
goto failure; goto failure;
} }
@ -824,8 +821,8 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
if (memsize <= 0 || memsize % 4 != 0) { if (memsize <= 0 || memsize % 4 != 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry 'memsize' to be an unsigned " _("Expecting VMX entry 'memsize' to be an unsigned "
"integer (multiple of 4) but found %lld", memsize); "integer (multiple of 4) but found %lld"), memsize);
goto failure; goto failure;
} }
@ -853,8 +850,8 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
if (numvcpus <= 0 || (numvcpus % 2 != 0 && numvcpus != 1)) { if (numvcpus <= 0 || (numvcpus % 2 != 0 && numvcpus != 1)) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry 'numvcpus' to be an unsigned " _("Expecting VMX entry 'numvcpus' to be an unsigned "
"integer (1 or a multiple of 2) but found %lld", numvcpus); "integer (1 or a multiple of 2) but found %lld"), numvcpus);
goto failure; goto failure;
} }
@ -885,16 +882,16 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
if (number < 0) { if (number < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry 'sched.cpu.affinity' to be " _("Expecting VMX entry 'sched.cpu.affinity' to be "
"a comma separated list of unsigned integers but " "a comma separated list of unsigned integers but "
"found '%s'", sched_cpu_affinity); "found '%s'"), sched_cpu_affinity);
goto failure; goto failure;
} }
if (number >= VIR_DOMAIN_CPUMASK_LEN) { if (number >= VIR_DOMAIN_CPUMASK_LEN) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"VMX entry 'sched.cpu.affinity' contains a %d, this " _("VMX entry 'sched.cpu.affinity' contains a %d, "
"value is too large", number); "this value is too large"), number);
goto failure; goto failure;
} }
@ -913,9 +910,9 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
break; break;
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry 'sched.cpu.affinity' to be " _("Expecting VMX entry 'sched.cpu.affinity' to be "
"a comma separated list of unsigned integers but " "a comma separated list of unsigned integers but "
"found '%s'", sched_cpu_affinity); "found '%s'"), sched_cpu_affinity);
goto failure; goto failure;
} }
@ -924,9 +921,9 @@ esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
if (count < numvcpus) { if (count < numvcpus) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry 'sched.cpu.affinity' to contain " _("Expecting VMX entry 'sched.cpu.affinity' to contain "
"at least as many values as 'numvcpus' (%lld) but " "at least as many values as 'numvcpus' (%lld) but "
"found only %d value(s)", numvcpus, count); "found only %d value(s)"), numvcpus, count);
goto failure; goto failure;
} }
} }
@ -1175,7 +1172,7 @@ esxVMX_ParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def)
long long port = 0; long long port = 0;
if (def == NULL || *def != 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; return -1;
} }
@ -1240,13 +1237,13 @@ esxVMX_ParseSCSIController(virConfPtr conf, int controller, int *present,
char virtualDev_name[32]; char virtualDev_name[32];
if (virtualDev == NULL || *virtualDev != NULL) { if (virtualDev == NULL || *virtualDev != NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1; return -1;
} }
if (controller < 0 || controller > 3) { if (controller < 0 || controller > 3) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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); controller);
return -1; return -1;
} }
@ -1271,8 +1268,8 @@ esxVMX_ParseSCSIController(virConfPtr conf, int controller, int *present,
STRCASENEQ(*virtualDev, "buslogic") && STRCASENEQ(*virtualDev, "buslogic") &&
STRCASENEQ(*virtualDev, "lsilogic")) { STRCASENEQ(*virtualDev, "lsilogic")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be 'buslogic' or 'lsilogic' " _("Expecting VMX entry '%s' to be 'buslogic' or 'lsilogic' "
"but found '%s'", virtualDev_name, *virtualDev); "but found '%s'"), virtualDev_name, *virtualDev);
goto failure; goto failure;
} }
@ -1352,7 +1349,7 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
int writeThrough = 0; int writeThrough = 0;
if (def == NULL || *def != 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; return -1;
} }
@ -1370,14 +1367,14 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
if (bus == VIR_DOMAIN_DISK_BUS_SCSI) { if (bus == VIR_DOMAIN_DISK_BUS_SCSI) {
if (controller < 0 || controller > 3) { if (controller < 0 || controller > 3) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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); controller);
goto failure; goto failure;
} }
if (id < 0 || id > 15 || id == 7) { if (id < 0 || id > 15 || id == 7) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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; goto failure;
} }
@ -1405,14 +1402,14 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
} else if (bus == VIR_DOMAIN_DISK_BUS_IDE) { } else if (bus == VIR_DOMAIN_DISK_BUS_IDE) {
if (controller < 0 || controller > 1) { if (controller < 0 || controller > 1) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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); controller);
goto failure; goto failure;
} }
if (id < 0 || id > 1) { if (id < 0 || id > 1) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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; goto failure;
} }
@ -1428,7 +1425,7 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
} }
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unsupported bus type '%s' for device type '%s'", _("Unsupported bus type '%s' for device type '%s'"),
virDomainDiskBusTypeToString(bus), virDomainDiskBusTypeToString(bus),
virDomainDiskDeviceTypeToString(device)); virDomainDiskDeviceTypeToString(device));
goto failure; goto failure;
@ -1437,7 +1434,7 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
if (bus == VIR_DOMAIN_DISK_BUS_FDC) { if (bus == VIR_DOMAIN_DISK_BUS_FDC) {
if (controller < 0 || controller > 1) { if (controller < 0 || controller > 1) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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); controller);
goto failure; goto failure;
} }
@ -1454,14 +1451,14 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
} }
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unsupported bus type '%s' for device type '%s'", _("Unsupported bus type '%s' for device type '%s'"),
virDomainDiskBusTypeToString(bus), virDomainDiskBusTypeToString(bus),
virDomainDiskDeviceTypeToString(device)); virDomainDiskDeviceTypeToString(device));
goto failure; goto failure;
} }
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unsupported device type '%s'", _("Unsupported device type '%s'"),
virDomainDiskDeviceTypeToString(device)); virDomainDiskDeviceTypeToString(device));
goto failure; goto failure;
} }
@ -1532,14 +1529,14 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
if (bus == VIR_DOMAIN_DISK_BUS_SCSI && if (bus == VIR_DOMAIN_DISK_BUS_SCSI &&
STRCASENEQ(deviceType, "scsi-hardDisk")) { STRCASENEQ(deviceType, "scsi-hardDisk")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be 'scsi-hardDisk' " _("Expecting VMX entry '%s' to be 'scsi-hardDisk' "
"but found '%s'", deviceType_name, deviceType); "but found '%s'"), deviceType_name, deviceType);
goto failure; goto failure;
} else if (bus == VIR_DOMAIN_DISK_BUS_IDE && } else if (bus == VIR_DOMAIN_DISK_BUS_IDE &&
STRCASENEQ(deviceType, "ata-hardDisk")) { STRCASENEQ(deviceType, "ata-hardDisk")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be 'ata-hardDisk' " _("Expecting VMX entry '%s' to be 'ata-hardDisk' "
"but found '%s'", deviceType_name, deviceType); "but found '%s'"), deviceType_name, deviceType);
goto failure; goto failure;
} }
} }
@ -1574,8 +1571,8 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
goto ignore; goto ignore;
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Invalid or not yet handled value '%s' for VMX entry " _("Invalid or not yet handled value '%s' for VMX entry "
"'%s'", fileName, fileName_name); "'%s'"), fileName, fileName_name);
goto failure; goto failure;
} }
} else if (device == VIR_DOMAIN_DISK_DEVICE_CDROM) { } else if (device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
@ -1583,8 +1580,8 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
if (deviceType != NULL) { if (deviceType != NULL) {
if (STRCASENEQ(deviceType, "cdrom-image")) { if (STRCASENEQ(deviceType, "cdrom-image")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be 'cdrom-image' " _("Expecting VMX entry '%s' to be 'cdrom-image' "
"but found '%s'", deviceType_name, deviceType); "but found '%s'"), deviceType_name, deviceType);
goto failure; goto failure;
} }
} }
@ -1611,8 +1608,8 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
fileName = NULL; fileName = NULL;
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Invalid or not yet handled value '%s' for VMX entry " _("Invalid or not yet handled value '%s' for VMX entry "
"'%s'", fileName, fileName_name); "'%s'"), fileName, fileName_name);
goto failure; goto failure;
} }
} else if (device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) { } else if (device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
@ -1620,8 +1617,8 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
if (fileType != NULL) { if (fileType != NULL) {
if (STRCASENEQ(fileType, "file")) { if (STRCASENEQ(fileType, "file")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be 'file' but " _("Expecting VMX entry '%s' to be 'file' but "
"found '%s'", fileType_name, fileType); "found '%s'"), fileType_name, fileType);
goto failure; goto failure;
} }
} }
@ -1640,12 +1637,12 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
fileName = NULL; fileName = NULL;
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Invalid or not yet handled value '%s' for VMX entry " _("Invalid or not yet handled value '%s' for VMX entry "
"'%s'", fileName, fileName_name); "'%s'"), fileName, fileName_name);
goto failure; goto failure;
} }
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Unsupported device type '%s'", ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Unsupported device type '%s'"),
virDomainDiskDeviceTypeToString(device)); virDomainDiskDeviceTypeToString(device));
goto failure; goto failure;
} }
@ -1704,13 +1701,13 @@ esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
char *networkName = NULL; char *networkName = NULL;
if (def == NULL || *def != 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; return -1;
} }
if (controller < 0 || controller > 3) { if (controller < 0 || controller > 3) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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); controller);
return -1; return -1;
} }
@ -1767,8 +1764,8 @@ esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
if (generatedAddress != NULL) { if (generatedAddress != NULL) {
if (virParseMacAddr(generatedAddress, (*def)->mac) < 0) { if (virParseMacAddr(generatedAddress, (*def)->mac) < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be MAC address but " _("Expecting VMX entry '%s' to be MAC address but "
"found '%s'", generatedAddress_name, "found '%s'"), generatedAddress_name,
generatedAddress); generatedAddress);
goto failure; goto failure;
} }
@ -1777,15 +1774,15 @@ esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
if (address != NULL) { if (address != NULL) {
if (virParseMacAddr(address, (*def)->mac) < 0) { if (virParseMacAddr(address, (*def)->mac) < 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be MAC address but " _("Expecting VMX entry '%s' to be MAC address but "
"found '%s'", address_name, address); "found '%s'"), address_name, address);
goto failure; goto failure;
} }
} }
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be 'generated' or 'static' or " _("Expecting VMX entry '%s' to be 'generated' or 'static' or "
"'vpx' but found '%s'", addressType_name, addressType); "'vpx' but found '%s'"), addressType_name, addressType);
goto failure; goto failure;
} }
@ -1800,8 +1797,8 @@ esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
STRCASENEQ(virtualDev, "vmxnet3") && STRCASENEQ(virtualDev, "vmxnet3") &&
STRCASENEQ(virtualDev, "e1000")) { STRCASENEQ(virtualDev, "e1000")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be 'vlance' or 'vmxnet' or " _("Expecting VMX entry '%s' to be 'vlance' or 'vmxnet' or "
"'vmxnet3' or 'e1000' but found '%s'", virtualDev_name, "'vmxnet3' or 'e1000' but found '%s'"), virtualDev_name,
virtualDev); virtualDev);
goto failure; goto failure;
} }
@ -1831,13 +1828,13 @@ esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
} else if (STRCASEEQ(connectionType, "hostonly")) { } else if (STRCASEEQ(connectionType, "hostonly")) {
/* FIXME */ /* FIXME */
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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); connectionType, connectionType_name);
goto failure; goto failure;
} else if (STRCASEEQ(connectionType, "nat")) { } else if (STRCASEEQ(connectionType, "nat")) {
/* FIXME */ /* FIXME */
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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); connectionType, connectionType_name);
goto failure; goto failure;
} else if (STRCASEEQ(connectionType, "custom")) { } else if (STRCASEEQ(connectionType, "custom")) {
@ -1851,7 +1848,7 @@ esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
vnet = NULL; vnet = NULL;
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Invalid value '%s' for VMX entry '%s'", connectionType, _("Invalid value '%s' for VMX entry '%s'"), connectionType,
connectionType_name); connectionType_name);
goto failure; goto failure;
} }
@ -1899,13 +1896,13 @@ esxVMX_ParseSerial(esxVI_Context *ctx, virConfPtr conf, int port,
char *fileName = NULL; char *fileName = NULL;
if (def == NULL || *def != 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; return -1;
} }
if (port < 0 || port > 3) { if (port < 0 || port > 3) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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; return -1;
} }
@ -1978,8 +1975,8 @@ esxVMX_ParseSerial(esxVI_Context *ctx, virConfPtr conf, int port,
fileName = NULL; fileName = NULL;
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be 'device', 'file' or 'pipe' " _("Expecting VMX entry '%s' to be 'device', 'file' or 'pipe' "
"but found '%s'", fileType_name, fileType); "but found '%s'"), fileType_name, fileType);
goto failure; goto failure;
} }
@ -2022,13 +2019,13 @@ esxVMX_ParseParallel(esxVI_Context *ctx, virConfPtr conf, int port,
char *fileName = NULL; char *fileName = NULL;
if (def == NULL || *def != 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; return -1;
} }
if (port < 0 || port > 2) { if (port < 0 || port > 2) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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; return -1;
} }
@ -2091,8 +2088,8 @@ esxVMX_ParseParallel(esxVI_Context *ctx, virConfPtr conf, int port,
} }
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be 'device' or 'file' but " _("Expecting VMX entry '%s' to be 'device' or 'file' but "
"found '%s'", fileType_name, fileType); "found '%s'"), fileType_name, fileType);
goto failure; goto failure;
} }
@ -2157,8 +2154,8 @@ esxVMX_FormatFileName(esxVI_Context *ctx ATTRIBUTE_UNUSED, const char *src)
} else { } else {
/* Found relative path, this is not supported */ /* Found relative path, this is not supported */
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Found relative path '%s' in domain XML, this is not " _("Found relative path '%s' in domain XML, this is not "
"supported", src); "supported"), src);
goto failure; goto failure;
} }
@ -2192,7 +2189,7 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
if (def->virtType != VIR_DOMAIN_VIRT_VMWARE) { /* FIXME: maybe add VIR_DOMAIN_VIRT_ESX ? */ if (def->virtType != VIR_DOMAIN_VIRT_VMWARE) { /* FIXME: maybe add VIR_DOMAIN_VIRT_ESX ? */
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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(VIR_DOMAIN_VIRT_VMWARE),
virDomainVirtTypeToString(def->virtType)); virDomainVirtTypeToString(def->virtType));
return NULL; return NULL;
@ -2212,8 +2209,8 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
break; break;
default: default:
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Expecting VI API version 2.5 or 4.0"); _("Expecting VI API version 2.5 or 4.0"));
goto failure; goto failure;
} }
@ -2224,8 +2221,8 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
virBufferAddLit(&buffer, "guestOS = \"other-64\"\n"); virBufferAddLit(&buffer, "guestOS = \"other-64\"\n");
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML attribute 'arch' of entry 'os/type' " _("Expecting domain XML attribute 'arch' of entry 'os/type' "
"to be 'i686' or 'x86_64' but found '%s'", def->os.arch); "to be 'i686' or 'x86_64' but found '%s'"), def->os.arch);
goto failure; goto failure;
} }
@ -2248,8 +2245,8 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
/* def:maxmem -> vmx:memsize */ /* def:maxmem -> vmx:memsize */
if (def->maxmem <= 0 || def->maxmem % 4096 != 0) { if (def->maxmem <= 0 || def->maxmem % 4096 != 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML entry 'memory' to be an unsigned " _("Expecting domain XML entry 'memory' to be an unsigned "
"integer (multiple of 4096) but found %lld", "integer (multiple of 4096) but found %lld"),
(unsigned long long)def->maxmem); (unsigned long long)def->maxmem);
goto failure; goto failure;
} }
@ -2262,8 +2259,8 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
if (def->memory < def->maxmem) { if (def->memory < def->maxmem) {
if (def->memory <= 0 || def->memory % 1024 != 0) { if (def->memory <= 0 || def->memory % 1024 != 0) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML entry 'currentMemory' to be an " _("Expecting domain XML entry 'currentMemory' to be an "
"unsigned integer (multiple of 1024) but found %lld", "unsigned integer (multiple of 1024) but found %lld"),
(unsigned long long)def->memory); (unsigned long long)def->memory);
goto failure; goto failure;
} }
@ -2276,8 +2273,8 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
/* def:vcpus -> vmx:numvcpus */ /* def:vcpus -> vmx:numvcpus */
if (def->vcpus <= 0 || (def->vcpus % 2 != 0 && def->vcpus != 1)) { if (def->vcpus <= 0 || (def->vcpus % 2 != 0 && def->vcpus != 1)) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML entry 'vcpu' to be an unsigned " _("Expecting domain XML entry 'vcpu' to be an unsigned "
"integer (1 or a multiple of 2) but found %d", "integer (1 or a multiple of 2) but found %d"),
(int)def->vcpus); (int)def->vcpus);
goto failure; goto failure;
} }
@ -2298,8 +2295,8 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
if (sched_cpu_affinity_length < def->vcpus) { if (sched_cpu_affinity_length < def->vcpus) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML attribute 'cpuset' of entry " _("Expecting domain XML attribute 'cpuset' of entry "
"'vcpu' to contains at least %d CPU(s)", "'vcpu' to contains at least %d CPU(s)"),
(int)def->vcpus); (int)def->vcpus);
goto failure; goto failure;
} }
@ -2331,7 +2328,7 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
default: default:
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unsupported graphics type '%s'", _("Unsupported graphics type '%s'"),
virDomainGraphicsTypeToString(def->graphics[i]->type)); virDomainGraphicsTypeToString(def->graphics[i]->type));
goto failure; goto failure;
} }
@ -2381,7 +2378,7 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
default: default:
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unsupported disk device type '%s'", _("Unsupported disk device type '%s'"),
virDomainDiskDeviceTypeToString(def->disks[i]->device)); virDomainDiskDeviceTypeToString(def->disks[i]->device));
goto failure; goto failure;
} }
@ -2440,7 +2437,7 @@ int
esxVMX_FormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer) esxVMX_FormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer)
{ {
if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { 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; return -1;
} }
@ -2490,7 +2487,7 @@ esxVMX_FormatHardDisk(esxVI_Context *ctx, virDomainDiskDefPtr def,
char *fileName = NULL; char *fileName = NULL;
if (def->device != VIR_DOMAIN_DISK_DEVICE_DISK) { 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; return -1;
} }
@ -2514,14 +2511,14 @@ esxVMX_FormatHardDisk(esxVI_Context *ctx, virDomainDiskDefPtr def,
} }
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unsupported bus type '%s' for harddisk", _("Unsupported bus type '%s' for harddisk"),
virDomainDiskBusTypeToString(def->bus)); virDomainDiskBusTypeToString(def->bus));
return -1; return -1;
} }
if (def->type != VIR_DOMAIN_DISK_TYPE_FILE) { if (def->type != VIR_DOMAIN_DISK_TYPE_FILE) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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), busName, def->dst, virDomainDiskTypeToString(def->type),
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE)); virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE));
return -1; return -1;
@ -2535,8 +2532,8 @@ esxVMX_FormatHardDisk(esxVI_Context *ctx, virDomainDiskDefPtr def,
if (def->src != NULL) { if (def->src != NULL) {
if (! virFileHasSuffix(def->src, ".vmdk")) { if (! virFileHasSuffix(def->src, ".vmdk")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Image file for %s harddisk '%s' has unsupported suffix, " _("Image file for %s harddisk '%s' has unsupported suffix, "
"expecting '.vmdk'", busName, def->dst); "expecting '.vmdk'"), busName, def->dst);
return -1; return -1;
} }
@ -2558,7 +2555,7 @@ esxVMX_FormatHardDisk(esxVI_Context *ctx, virDomainDiskDefPtr def,
entryPrefix, controller, id); entryPrefix, controller, id);
} else if (def->cachemode != VIR_DOMAIN_DISK_CACHE_DEFAULT) { } else if (def->cachemode != VIR_DOMAIN_DISK_CACHE_DEFAULT) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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, busName, def->dst,
virDomainDiskCacheTypeToString(def->cachemode)); virDomainDiskCacheTypeToString(def->cachemode));
return -1; return -1;
@ -2580,7 +2577,7 @@ esxVMX_FormatCDROM(esxVI_Context *ctx, virDomainDiskDefPtr def,
char *fileName = NULL; char *fileName = NULL;
if (def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) { 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;
} }
@ -2601,7 +2598,8 @@ esxVMX_FormatCDROM(esxVI_Context *ctx, virDomainDiskDefPtr def,
return -1; return -1;
} }
} else { } 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)); virDomainDiskBusTypeToString(def->bus));
return -1; return -1;
} }
@ -2616,8 +2614,8 @@ esxVMX_FormatCDROM(esxVI_Context *ctx, virDomainDiskDefPtr def,
if (def->src != NULL) { if (def->src != NULL) {
if (! virFileHasSuffix(def->src, ".iso")) { if (! virFileHasSuffix(def->src, ".iso")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Image file for %s cdrom '%s' has unsupported " _("Image file for %s cdrom '%s' has unsupported "
"suffix, expecting '.iso'", busName, def->dst); "suffix, expecting '.iso'"), busName, def->dst);
return -1; return -1;
} }
@ -2642,8 +2640,8 @@ esxVMX_FormatCDROM(esxVI_Context *ctx, virDomainDiskDefPtr def,
} }
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"%s cdrom '%s' has unsupported type '%s', expecting '%s' " _("%s cdrom '%s' has unsupported type '%s', expecting '%s' "
"or '%s'", busName, def->dst, "or '%s'"), busName, def->dst,
virDomainDiskTypeToString(def->type), virDomainDiskTypeToString(def->type),
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE), virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE),
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK)); virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK));
@ -2663,7 +2661,7 @@ esxVMX_FormatFloppy(esxVI_Context *ctx, virDomainDiskDefPtr def,
char *fileName = NULL; char *fileName = NULL;
if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) { 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; return -1;
} }
@ -2680,8 +2678,8 @@ esxVMX_FormatFloppy(esxVI_Context *ctx, virDomainDiskDefPtr def,
if (def->src != NULL) { if (def->src != NULL) {
if (! virFileHasSuffix(def->src, ".flp")) { if (! virFileHasSuffix(def->src, ".flp")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Image file for floppy '%s' has unsupported suffix, " _("Image file for floppy '%s' has unsupported "
"expecting '.flp'", def->dst); "suffix, expecting '.flp'"), def->dst);
return -1; return -1;
} }
@ -2706,8 +2704,8 @@ esxVMX_FormatFloppy(esxVI_Context *ctx, virDomainDiskDefPtr def,
} }
} else { } else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Floppy '%s' has unsupported type '%s', expecting '%s' " _("Floppy '%s' has unsupported type '%s', expecting '%s' "
"or '%s'", def->dst, "or '%s'"), def->dst,
virDomainDiskTypeToString(def->type), virDomainDiskTypeToString(def->type),
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE), virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE),
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK)); virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK));
@ -2728,7 +2726,7 @@ esxVMX_FormatEthernet(virDomainNetDefPtr def, int controller,
if (controller < 0 || controller > 3) { if (controller < 0 || controller > 3) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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); controller);
return -1; return -1;
} }
@ -2742,9 +2740,9 @@ esxVMX_FormatEthernet(virDomainNetDefPtr def, int controller,
STRCASENEQ(def->model, "vmxnet3") && STRCASENEQ(def->model, "vmxnet3") &&
STRCASENEQ(def->model, "e1000")) { STRCASENEQ(def->model, "e1000")) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML entry 'devices/interfase/model' " _("Expecting domain XML entry 'devices/interfase/model' "
"to be 'vlance' or 'vmxnet' or 'vmxnet3' or 'e1000' but " "to be 'vlance' or 'vmxnet' or 'vmxnet3' or 'e1000' "
"found '%s'", def->model); "but found '%s'"), def->model);
return -1; return -1;
} }
@ -2771,7 +2769,7 @@ esxVMX_FormatEthernet(virDomainNetDefPtr def, int controller,
break; break;
default: default:
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Unsupported net type '%s'", ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Unsupported net type '%s'"),
virDomainNetTypeToString(def->type)); virDomainNetTypeToString(def->type));
return -1; return -1;
} }
@ -2821,14 +2819,15 @@ esxVMX_FormatSerial(esxVI_Context *ctx, virDomainChrDefPtr def,
if (def->target.port < 0 || def->target.port > 3) { if (def->target.port < 0 || def->target.port > 3) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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; return -1;
} }
if (def->data.file.path == NULL) { if (def->data.file.path == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Expecting domain XML attribute 'path' of entry " _("Expecting domain XML attribute 'path' of entry "
"'devices/serial/source' to be present"); "'devices/serial/source' to be present"));
return -1; return -1;
} }
@ -2874,7 +2873,7 @@ esxVMX_FormatSerial(esxVI_Context *ctx, virDomainChrDefPtr def,
default: default:
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unsupported character device type '%s'", _("Unsupported character device type '%s'"),
virDomainChrTypeToString(def->type)); virDomainChrTypeToString(def->type));
return -1; return -1;
} }
@ -2897,15 +2896,15 @@ esxVMX_FormatParallel(esxVI_Context *ctx, virDomainChrDefPtr def,
if (def->target.port < 0 || def->target.port > 2) { if (def->target.port < 0 || def->target.port > 2) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, 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); def->target.port);
return -1; return -1;
} }
if (def->data.file.path == NULL) { if (def->data.file.path == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
"Expecting domain XML attribute 'path' of entry " _("Expecting domain XML attribute 'path' of entry "
"'devices/parallel/source' to be present"); "'devices/parallel/source' to be present"));
return -1; return -1;
} }
@ -2939,7 +2938,7 @@ esxVMX_FormatParallel(esxVI_Context *ctx, virDomainChrDefPtr def,
default: default:
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unsupported character device type '%s'", _("Unsupported character device type '%s'"),
virDomainChrTypeToString(def->type)); virDomainChrTypeToString(def->type));
return -1; return -1;
} }