From: "Daniel P. Berrange" <berrange(a)redhat.com>
Update the ESX driver to use virReportError instead of
the ESX_ERROR & ESX_VI_ERROR custom macros
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
cfg.mk | 2 -
src/esx/esx_driver.c | 422 ++++++++++++++--------------
src/esx/esx_private.h | 4 -
src/esx/esx_storage_driver.c | 100 +++----
src/esx/esx_util.c | 74 ++---
src/esx/esx_vi.c | 626 +++++++++++++++++++++---------------------
src/esx/esx_vi.h | 7 -
src/esx/esx_vi_methods.c | 12 +-
src/esx/esx_vi_types.c | 216 +++++++--------
9 files changed, 725 insertions(+), 738 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index d813f34..5e8958b 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -506,8 +506,6 @@ sc_avoid_attribute_unused_in_header:
# |grep -vE
'^(qsort|if|close|assert|fputc|free|N_|vir.*GetName|.*Unlock|virNodeListDevices|virHashRemoveEntry|freeaddrinfo|.*[fF]ree|xdrmem_create|xmlXPathFreeObject|virUUIDFormat|openvzSetProgramSentinal|polkit_action_unref)$'
msg_gen_function =
-msg_gen_function += ESX_ERROR
-msg_gen_function += ESX_VI_ERROR
msg_gen_function += HYPERV_ERROR
msg_gen_function += PHYP_ERROR
msg_gen_function += VIR_ERROR
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index db2144c..1aab6a7 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -213,9 +213,9 @@ esxParseVMXFileName(const char *fileName, void *opaque)
if ((tmp = STRSKIP(copyOfFileName, "/vmfs/volumes/")) == NULL ||
(datastoreName = strtok_r(tmp, "/", &saveptr)) == NULL ||
(directoryAndFileName = strtok_r(NULL, "", &saveptr)) ==
NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("File name '%s' doesn't have expected format
"
-
"'/vmfs/volumes/<datastore>/<path>'"), fileName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("File name '%s' doesn't have expected
format "
+
"'/vmfs/volumes/<datastore>/<path>'"), fileName);
goto cleanup;
}
@@ -228,9 +228,9 @@ esxParseVMXFileName(const char *fileName, void *opaque)
}
if (datastoreList == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("File name '%s' refers to non-existing datastore
'%s'"),
- fileName, datastoreName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("File name '%s' refers to non-existing
datastore '%s'"),
+ fileName, datastoreName);
goto cleanup;
}
@@ -250,8 +250,8 @@ esxParseVMXFileName(const char *fileName, void *opaque)
}
if (result == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not handle file name '%s'"), fileName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not handle file name '%s'"),
fileName);
goto cleanup;
}
}
@@ -352,8 +352,8 @@ esxFormatVMXFileName(const char *fileName, void *opaque)
goto cleanup;
}
} else {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not handle file name '%s'"), fileName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not handle file name '%s'"),
fileName);
goto cleanup;
}
@@ -407,8 +407,8 @@ esxAutodetectSCSIControllerModel(virDomainDiskDefPtr def, int *model,
vmDiskFileInfo = esxVI_VmDiskFileInfo_DynamicCast(fileInfo);
if (vmDiskFileInfo == NULL || vmDiskFileInfo->controllerType == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not lookup controller model for '%s'"),
def->src);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not lookup controller model for '%s'"),
def->src);
goto cleanup;
}
@@ -425,9 +425,9 @@ esxAutodetectSCSIControllerModel(virDomainDiskDefPtr def, int *model,
"ParaVirtualSCSIController")) {
*model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI;
} else {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Found unexpected controller model '%s' for disk
'%s'"),
- vmDiskFileInfo->controllerType, def->src);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Found unexpected controller model '%s' for disk
'%s'"),
+ vmDiskFileInfo->controllerType, def->src);
goto cleanup;
}
@@ -468,8 +468,8 @@ esxSupportsLongMode(esxPrivate *priv)
}
if (hostSystem == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not retrieve the HostSystem object"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the HostSystem object"));
goto cleanup;
}
@@ -496,11 +496,11 @@ esxSupportsLongMode(esxPrivate *priv)
} else if (edxLongModeBit == '0') {
priv->supportsLongMode = esxVI_Boolean_False;
} else {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Bit 29 (Long Mode) of HostSystem property
"
- "'hardware.cpuFeature[].edx' with value
'%s' "
- "has unexpected value '%c', expecting
'0' "
- "or '1'"), hostCpuIdInfo->edx,
edxLongModeBit);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Bit 29 (Long Mode) of HostSystem property
"
+ "'hardware.cpuFeature[].edx' with
value '%s' "
+ "has unexpected value '%c',
expecting '0' "
+ "or '1'"),
hostCpuIdInfo->edx, edxLongModeBit);
goto cleanup;
}
@@ -548,8 +548,8 @@ esxLookupHostSystemBiosUuid(esxPrivate *priv, unsigned char *uuid)
}
if (hostSystem == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not retrieve the HostSystem object"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the HostSystem object"));
goto cleanup;
}
@@ -686,7 +686,7 @@ esxConnectToHost(virConnectPtr conn,
: esxVI_ProductVersion_GSX;
if (vCenterIpAddress == NULL || *vCenterIpAddress != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -705,7 +705,7 @@ esxConnectToHost(virConnectPtr conn,
username = virAuthGetUsername(conn, auth, "esx", "root",
conn->uri->server);
if (username == NULL) {
- ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Username request
failed"));
+ virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Username request
failed"));
goto cleanup;
}
}
@@ -713,7 +713,7 @@ esxConnectToHost(virConnectPtr conn,
unescapedPassword = virAuthGetPassword(conn, auth, "esx", username,
conn->uri->server);
if (unescapedPassword == NULL) {
- ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Password request
failed"));
+ virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Password request
failed"));
goto cleanup;
}
@@ -743,15 +743,15 @@ esxConnectToHost(virConnectPtr conn,
priv->host->productVersion != esxVI_ProductVersion_ESX4x &&
priv->host->productVersion != esxVI_ProductVersion_ESX50 &&
priv->host->productVersion != esxVI_ProductVersion_ESX5x) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("%s is neither an ESX 3.5, 4.x nor 5.x host"),
- conn->uri->server);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s is neither an ESX 3.5, 4.x nor 5.x host"),
+ conn->uri->server);
goto cleanup;
}
} else { /* GSX */
if (priv->host->productVersion != esxVI_ProductVersion_GSX20) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("%s isn't a GSX 2.0 host"),
conn->uri->server);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s isn't a GSX 2.0 host"),
conn->uri->server);
goto cleanup;
}
}
@@ -816,8 +816,8 @@ esxConnectToVCenter(virConnectPtr conn,
if (hostSystemIpAddress == NULL &&
(priv->parsedUri->path == NULL || STREQ(priv->parsedUri->path,
"/"))) {
- ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
- _("Path has to specify the datacenter and compute
resource"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Path has to specify the datacenter and compute
resource"));
return -1;
}
@@ -836,7 +836,7 @@ esxConnectToVCenter(virConnectPtr conn,
username = virAuthGetUsername(conn, auth, "esx",
"administrator", hostname);
if (username == NULL) {
- ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Username request
failed"));
+ virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Username request
failed"));
goto cleanup;
}
}
@@ -844,7 +844,7 @@ esxConnectToVCenter(virConnectPtr conn,
unescapedPassword = virAuthGetPassword(conn, auth, "esx", username,
hostname);
if (unescapedPassword == NULL) {
- ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Password request
failed"));
+ virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Password request
failed"));
goto cleanup;
}
@@ -872,9 +872,9 @@ esxConnectToVCenter(virConnectPtr conn,
priv->vCenter->productVersion != esxVI_ProductVersion_VPX4x &&
priv->vCenter->productVersion != esxVI_ProductVersion_VPX50 &&
priv->vCenter->productVersion != esxVI_ProductVersion_VPX5x) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("%s is neither a vCenter 2.5, 4.x nor 5.x server"),
- hostname);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s is neither a vCenter 2.5, 4.x nor 5.x server"),
+ hostname);
goto cleanup;
}
@@ -982,9 +982,9 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth,
return VIR_DRV_OPEN_DECLINED;
}
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- _("Transport '%s' in URI scheme is not supported, try
again "
- "without the transport part"), plus + 1);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Transport '%s' in URI scheme is not supported, try
again "
+ "without the transport part"), plus + 1);
return VIR_DRV_OPEN_ERROR;
}
@@ -996,15 +996,15 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth,
/* Require server part */
if (conn->uri->server == NULL) {
- ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
- _("URI is missing the server part"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("URI is missing the server part"));
return VIR_DRV_OPEN_ERROR;
}
/* Require auth */
if (auth == NULL || auth->cb == NULL) {
- ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
- _("Missing or invalid auth pointer"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Missing or invalid auth pointer"));
return VIR_DRV_OPEN_ERROR;
}
@@ -1060,16 +1060,16 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth,
if (priv->parsedUri->vCenter != NULL) {
if (STREQ(priv->parsedUri->vCenter, "*")) {
if (potentialVCenterIpAddress == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("This host is not managed by a vCenter"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("This host is not managed by a
vCenter"));
goto cleanup;
}
if (virStrcpyStatic(vCenterIpAddress,
potentialVCenterIpAddress) == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("vCenter IP address %s too big for
destination"),
- potentialVCenterIpAddress);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("vCenter IP address %s too big for
destination"),
+ potentialVCenterIpAddress);
goto cleanup;
}
} else {
@@ -1080,12 +1080,12 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth,
if (potentialVCenterIpAddress != NULL &&
STRNEQ(vCenterIpAddress, potentialVCenterIpAddress)) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("This host is managed by a vCenter with IP "
- "address %s, but a mismachting vCenter '%s'
"
- "(%s) has been specified"),
- potentialVCenterIpAddress, priv->parsedUri->vCenter,
- vCenterIpAddress);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("This host is managed by a vCenter with IP
"
+ "address %s, but a mismachting vCenter
'%s' "
+ "(%s) has been specified"),
+ potentialVCenterIpAddress,
priv->parsedUri->vCenter,
+ vCenterIpAddress);
goto cleanup;
}
}
@@ -1181,8 +1181,8 @@ esxSupportsVMotion(esxPrivate *priv)
}
if (hostSystem == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not retrieve the HostSystem object"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the HostSystem object"));
goto cleanup;
}
@@ -1245,9 +1245,9 @@ esxGetVersion(virConnectPtr conn, unsigned long *version)
if (virParseVersionString(priv->primary->service->about->version,
version, false) < 0) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not parse version number from '%s'"),
- priv->primary->service->about->version);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not parse version number from '%s'"),
+ priv->primary->service->about->version);
return -1;
}
@@ -1282,8 +1282,8 @@ esxGetHostname(virConnectPtr conn)
}
if (hostSystem == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not retrieve the HostSystem object"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the HostSystem object"));
goto cleanup;
}
@@ -1311,8 +1311,8 @@ esxGetHostname(virConnectPtr conn)
}
if (hostName == NULL || strlen(hostName) < 1) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Missing or empty 'hostName' property"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Missing or empty 'hostName' property"));
goto cleanup;
}
@@ -1380,8 +1380,8 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
}
if (hostSystem == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not retrieve the HostSystem object"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the HostSystem object"));
goto cleanup;
}
@@ -1461,9 +1461,9 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
if (virStrncpy(nodeinfo->model, dynamicProperty->val->string,
sizeof(nodeinfo->model) - 1,
sizeof(nodeinfo->model)) == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("CPU Model %s too long for destination"),
- dynamicProperty->val->string);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("CPU Model %s too long for destination"),
+ dynamicProperty->val->string);
goto cleanup;
}
} else {
@@ -1550,9 +1550,9 @@ esxListDomains(virConnectPtr conn, int *ids, int maxids)
if (esxUtil_ParseVirtualMachineIDString(virtualMachine->obj->value,
&ids[count]) < 0 ||
ids[count] <= 0) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Failed to parse positive integer from '%s'"),
- virtualMachine->obj->value);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to parse positive integer from
'%s'"),
+ virtualMachine->obj->value);
goto cleanup;
}
@@ -1652,7 +1652,7 @@ esxDomainLookupByID(virConnectPtr conn, int id)
}
if (domain == NULL) {
- ESX_ERROR(VIR_ERR_NO_DOMAIN, _("No domain with ID %d"), id);
+ virReportError(VIR_ERR_NO_DOMAIN, _("No domain with ID %d"), id);
}
cleanup:
@@ -1740,7 +1740,7 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
}
if (virtualMachine == NULL) {
- ESX_ERROR(VIR_ERR_NO_DOMAIN, _("No domain with name '%s'"),
name);
+ virReportError(VIR_ERR_NO_DOMAIN, _("No domain with name
'%s'"), name);
goto cleanup;
}
@@ -1797,8 +1797,8 @@ esxDomainSuspend(virDomainPtr domain)
}
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
- _("Domain is not powered on"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not powered on"));
goto cleanup;
}
@@ -1811,8 +1811,8 @@ esxDomainSuspend(virDomainPtr domain)
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not suspend domain: %s"),
- taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not suspend domain:
%s"),
+ taskInfoErrorMessage);
goto cleanup;
}
@@ -1855,7 +1855,7 @@ esxDomainResume(virDomainPtr domain)
}
if (powerState != esxVI_VirtualMachinePowerState_Suspended) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not
suspended"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not
suspended"));
goto cleanup;
}
@@ -1869,8 +1869,8 @@ esxDomainResume(virDomainPtr domain)
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not resume domain: %s"),
- taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not resume domain:
%s"),
+ taskInfoErrorMessage);
goto cleanup;
}
@@ -1912,8 +1912,8 @@ esxDomainShutdownFlags(virDomainPtr domain, unsigned int flags)
}
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
- _("Domain is not powered on"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not powered on"));
goto cleanup;
}
@@ -1963,8 +1963,8 @@ esxDomainReboot(virDomainPtr domain, unsigned int flags)
}
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
- _("Domain is not powered on"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not powered on"));
goto cleanup;
}
@@ -2019,8 +2019,8 @@ esxDomainDestroyFlags(virDomainPtr domain,
}
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
- _("Domain is not powered on"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not powered on"));
goto cleanup;
}
@@ -2033,8 +2033,8 @@ esxDomainDestroyFlags(virDomainPtr domain,
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not destroy domain: %s"),
- taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not destroy domain:
%s"),
+ taskInfoErrorMessage);
goto cleanup;
}
@@ -2103,9 +2103,9 @@ esxDomainGetMaxMemory(virDomainPtr domain)
}
if (dynamicProperty->val->int32 < 0) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Got invalid memory size %d"),
- dynamicProperty->val->int32);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Got invalid memory size %d"),
+ dynamicProperty->val->int32);
} else {
memoryMB = dynamicProperty->val->int32;
}
@@ -2152,8 +2152,8 @@ esxDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
}
if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
- _("Domain is not powered off"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not powered off"));
goto cleanup;
}
@@ -2176,9 +2176,9 @@ esxDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not set max-memory to %lu kilobytes: %s"), memory,
- taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not set max-memory to %lu kilobytes: %s"),
memory,
+ taskInfoErrorMessage);
goto cleanup;
}
@@ -2233,9 +2233,9 @@ esxDomainSetMemory(virDomainPtr domain, unsigned long memory)
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not set memory to %lu kilobytes: %s"), memory,
- taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not set memory to %lu kilobytes: %s"), memory,
+ taskInfoErrorMessage);
goto cleanup;
}
@@ -2469,9 +2469,9 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
esxVI_PerfEntityMetric_DynamicCast(perfEntityMetricBase);
if (perfEntityMetric == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("QueryPerf returned object with unexpected type
'%s'"),
- esxVI_Type_ToString(perfEntityMetricBase->_type));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("QueryPerf returned object with unexpected type
'%s'"),
+ esxVI_Type_ToString(perfEntityMetricBase->_type));
goto cleanup;
}
@@ -2479,9 +2479,9 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
esxVI_PerfMetricIntSeries_DynamicCast(perfEntityMetric->value);
if (perfMetricIntSeries == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("QueryPerf returned object with unexpected type
'%s'"),
-
esxVI_Type_ToString(perfEntityMetric->value->_type));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("QueryPerf returned object with unexpected type
'%s'"),
+
esxVI_Type_ToString(perfEntityMetric->value->_type));
goto cleanup;
}
@@ -2597,13 +2597,13 @@ esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
char *taskInfoErrorMessage = NULL;
if (flags != VIR_DOMAIN_AFFECT_LIVE) {
- ESX_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
+ virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
flags);
return -1;
}
if (nvcpus < 1) {
- ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
- _("Requested number of virtual CPUs must at least be 1"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Requested number of virtual CPUs must at least be
1"));
return -1;
}
@@ -2618,10 +2618,10 @@ esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
}
if (nvcpus > maxVcpus) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- _("Requested number of virtual CPUs is greater than max "
- "allowable number of virtual CPUs for the domain: %d >
%d"),
- nvcpus, maxVcpus);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Requested number of virtual CPUs is greater than max
"
+ "allowable number of virtual CPUs for the domain: %d >
%d"),
+ nvcpus, maxVcpus);
return -1;
}
@@ -2645,9 +2645,9 @@ esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not set number of virtual CPUs to %d: %s"), nvcpus,
- taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not set number of virtual CPUs to %d: %s"),
nvcpus,
+ taskInfoErrorMessage);
goto cleanup;
}
@@ -2681,7 +2681,7 @@ esxDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
esxVI_DynamicProperty *dynamicProperty = NULL;
if (flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
- ESX_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
+ virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
flags);
return -1;
}
@@ -2703,8 +2703,8 @@ esxDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
}
if (hostSystem == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not retrieve the HostSystem object"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the HostSystem object"));
goto cleanup;
}
@@ -2873,8 +2873,8 @@ esxDomainXMLFromNative(virConnectPtr conn, const char
*nativeFormat,
memset(&data, 0, sizeof(data));
if (STRNEQ(nativeFormat, "vmware-vmx")) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- _("Unsupported config format '%s'"), nativeFormat);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Unsupported config format '%s'"),
nativeFormat);
return NULL;
}
@@ -2916,8 +2916,8 @@ esxDomainXMLToNative(virConnectPtr conn, const char *nativeFormat,
memset(&data, 0, sizeof(data));
if (STRNEQ(nativeFormat, "vmware-vmx")) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- _("Unsupported config format '%s'"), nativeFormat);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Unsupported config format '%s'"),
nativeFormat);
return NULL;
}
@@ -3069,8 +3069,8 @@ esxDomainCreateWithFlags(virDomainPtr domain, unsigned int flags)
}
if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
- _("Domain is not powered off"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not powered off"));
goto cleanup;
}
@@ -3084,8 +3084,8 @@ esxDomainCreateWithFlags(virDomainPtr domain, unsigned int flags)
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not start domain: %s"),
- taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not start domain:
%s"),
+ taskInfoErrorMessage);
goto cleanup;
}
@@ -3167,9 +3167,9 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
if (virtualMachine != NULL) {
/* FIXME */
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Domain already exists, editing existing domains is not "
- "supported yet"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Domain already exists, editing existing domains is not
"
+ "supported yet"));
goto cleanup;
}
@@ -3203,9 +3203,9 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
* datastore isn't perfect but should work in the majority of cases.
*/
if (def->ndisks < 1) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Domain XML doesn't contain any disks, cannot deduce "
- "datastore and path for VMX file"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Domain XML doesn't contain any disks, cannot deduce
"
+ "datastore and path for VMX file"));
goto cleanup;
}
@@ -3218,16 +3218,16 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
}
if (disk == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Domain XML doesn't contain any file-based harddisks,
"
- "cannot deduce datastore and path for VMX file"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Domain XML doesn't contain any file-based harddisks,
"
+ "cannot deduce datastore and path for VMX file"));
goto cleanup;
}
if (disk->src == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("First file-based harddisk has no source, cannot deduce "
- "datastore and path for VMX file"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("First file-based harddisk has no source, cannot deduce
"
+ "datastore and path for VMX file"));
goto cleanup;
}
@@ -3237,9 +3237,9 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
}
if (! virFileHasSuffix(disk->src, ".vmdk")) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting source '%s' of first file-based harddisk to
"
- "be a VMDK image"), disk->src);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting source '%s' of first file-based harddisk
to "
+ "be a VMDK image"), disk->src);
goto cleanup;
}
@@ -3308,8 +3308,8 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not define domain: %s"),
- taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not define domain:
%s"),
+ taskInfoErrorMessage);
goto cleanup;
}
@@ -3382,8 +3382,8 @@ esxDomainUndefineFlags(virDomainPtr domain,
if (powerState != esxVI_VirtualMachinePowerState_Suspended &&
powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
- _("Domain is not suspended or powered off"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not suspended or powered off"));
goto cleanup;
}
@@ -3528,9 +3528,9 @@ esxDomainSetAutostart(virDomainPtr domain, int autostart)
for (powerInfo = powerInfoList; powerInfo != NULL;
powerInfo = powerInfo->_next) {
if (STRNEQ(powerInfo->key->value,
virtualMachine->obj->value)) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
- _("Cannot enable general autostart option "
- "without affecting other domains"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Cannot enable general autostart option "
+ "without affecting other domains"));
goto cleanup;
}
}
@@ -3735,9 +3735,9 @@ esxDomainGetSchedulerParametersFlags(virDomainPtr domain,
break;
default:
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Shares level has unknown value %d"),
- (int)sharesInfo->level);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Shares level has unknown value %d"),
+ (int)sharesInfo->level);
goto cleanup;
}
@@ -3813,9 +3813,9 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain,
}
if (params[i].value.l < 0) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- _("Could not set reservation to %lld MHz, expecting
"
- "positive value"), params[i].value.l);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Could not set reservation to %lld MHz, expecting
"
+ "positive value"), params[i].value.l);
goto cleanup;
}
@@ -3826,10 +3826,10 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain,
}
if (params[i].value.l < -1) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- _("Could not set limit to %lld MHz, expecting "
- "positive value or -1 (unlimited)"),
- params[i].value.l);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Could not set limit to %lld MHz, expecting "
+ "positive value or -1 (unlimited)"),
+ params[i].value.l);
goto cleanup;
}
@@ -3865,10 +3865,10 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain,
break;
default:
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- _("Could not set shares to %d, expecting positive
"
- "value or -1 (low), -2 (normal) or -3
(high)"),
- params[i].value.i);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Could not set shares to %d, expecting positive
"
+ "value or -1 (low), -2 (normal) or -3
(high)"),
+ params[i].value.i);
goto cleanup;
}
}
@@ -3885,9 +3885,9 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain,
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not change scheduler parameters: %s"),
- taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not change scheduler parameters: %s"),
+ taskInfoErrorMessage);
goto cleanup;
}
@@ -3971,14 +3971,14 @@ esxDomainMigratePerform(virDomainPtr domain,
virCheckFlags(ESX_MIGRATION_FLAGS, -1);
if (priv->vCenter == NULL) {
- ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
- _("Migration not possible without a vCenter"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Migration not possible without a vCenter"));
return -1;
}
if (dname != NULL) {
- ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
- _("Renaming domains on migration not supported"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Renaming domains on migration not supported"));
return -1;
}
@@ -3991,15 +3991,15 @@ esxDomainMigratePerform(virDomainPtr domain,
return -1;
if (parsedUri->scheme == NULL || STRCASENEQ(parsedUri->scheme,
"vpxmigr")) {
- ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
- _("Only vpxmigr:// migration URIs are supported"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Only vpxmigr:// migration URIs are supported"));
goto cleanup;
}
if (STRCASENEQ(priv->vCenter->ipAddress, parsedUri->server)) {
- ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
- _("Migration source and destination have to refer to "
- "the same vCenter"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Migration source and destination have to refer to "
+ "the same vCenter"));
goto cleanup;
}
@@ -4007,8 +4007,8 @@ esxDomainMigratePerform(virDomainPtr domain,
path_hostSystem = strtok_r(NULL, "", &saveptr);
if (path_resourcePool == NULL || path_hostSystem == NULL) {
- ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
- _("Migration URI has to specify resource pool and host
system"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Migration URI has to specify resource pool and host
system"));
goto cleanup;
}
@@ -4042,13 +4042,13 @@ esxDomainMigratePerform(virDomainPtr domain,
* to the first event for now.
*/
if (eventList->fullFormattedMessage != NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not migrate domain, validation reported a "
- "problem: %s"), eventList->fullFormattedMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not migrate domain, validation reported a
"
+ "problem: %s"),
eventList->fullFormattedMessage);
} else {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not migrate domain, validation reported a "
- "problem"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not migrate domain, validation reported a
"
+ "problem"));
}
goto cleanup;
@@ -4068,10 +4068,10 @@ esxDomainMigratePerform(virDomainPtr domain,
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not migrate domain, migration task finished with "
- "an error: %s"),
- taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not migrate domain, migration task finished with
"
+ "an error: %s"),
+ taskInfoErrorMessage);
goto cleanup;
}
@@ -4143,8 +4143,8 @@ esxNodeGetFreeMemory(virConnectPtr conn)
}
if (resourcePoolResourceUsage == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not retrieve memory usage of resource pool"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve memory usage of resource pool"));
goto cleanup;
}
@@ -4324,8 +4324,8 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char
*xmlDesc,
}
if (def->ndisks) {
- ESX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("disk snapshots not supported yet"));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("disk snapshots not supported yet"));
return NULL;
}
@@ -4341,8 +4341,8 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char
*xmlDesc,
}
if (snapshotTree != NULL) {
- ESX_ERROR(VIR_ERR_OPERATION_INVALID,
- _("Snapshot '%s' already exists"), def->name);
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("Snapshot '%s' already exists"),
def->name);
goto cleanup;
}
@@ -4358,8 +4358,8 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char
*xmlDesc,
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not create snapshot: %s"),
- taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not create snapshot:
%s"),
+ taskInfoErrorMessage);
goto cleanup;
}
@@ -4486,7 +4486,7 @@ esxDomainSnapshotListNames(virDomainPtr domain, char **names, int
nameslen,
leaves = (flags & VIR_DOMAIN_SNAPSHOT_LIST_LEAVES) != 0;
if (names == NULL || nameslen < 0) {
- ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", _("Invalid argument"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s", _("Invalid
argument"));
return -1;
}
@@ -4579,7 +4579,7 @@ esxDomainSnapshotListChildrenNames(virDomainSnapshotPtr snapshot,
leaves = (flags & VIR_DOMAIN_SNAPSHOT_LIST_LEAVES) != 0;
if (names == NULL || nameslen < 0) {
- ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", _("Invalid argument"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s", _("Invalid
argument"));
return -1;
}
@@ -4701,9 +4701,9 @@ esxDomainSnapshotGetParent(virDomainSnapshotPtr snapshot, unsigned
int flags)
}
if (!snapshotTreeParent) {
- ESX_ERROR(VIR_ERR_NO_DOMAIN_SNAPSHOT,
- _("snapshot '%s' does not have a parent"),
- snapshotTree->name);
+ virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
+ _("snapshot '%s' does not have a parent"),
+ snapshotTree->name);
goto cleanup;
}
@@ -4849,9 +4849,9 @@ esxDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, unsigned
int flags)
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not revert to snapshot '%s': %s"),
snapshot->name,
- taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not revert to snapshot '%s': %s"),
snapshot->name,
+ taskInfoErrorMessage);
goto cleanup;
}
@@ -4915,9 +4915,9 @@ esxDomainSnapshotDelete(virDomainSnapshotPtr snapshot, unsigned int
flags)
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not delete snapshot '%s': %s"),
snapshot->name,
- taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not delete snapshot '%s': %s"),
snapshot->name,
+ taskInfoErrorMessage);
goto cleanup;
}
@@ -4986,9 +4986,9 @@ esxDomainSetMemoryParameters(virDomainPtr domain,
virTypedParameterPtr params,
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not change memory parameters: %s"),
- taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not change memory parameters: %s"),
+ taskInfoErrorMessage);
goto cleanup;
}
diff --git a/src/esx/esx_private.h b/src/esx/esx_private.h
index 3fcc001..58d1233 100644
--- a/src/esx/esx_private.h
+++ b/src/esx/esx_private.h
@@ -28,10 +28,6 @@
# include "capabilities.h"
# include "esx_vi.h"
-# define ESX_ERROR(code, ...) \
- virReportErrorHelper(VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
- __LINE__, __VA_ARGS__)
-
typedef struct _esxPrivate {
esxVI_Context *primary; /* points to host or vCenter */
esxVI_Context *host;
diff --git a/src/esx/esx_storage_driver.c b/src/esx/esx_storage_driver.c
index 9b64891..b200e56 100644
--- a/src/esx/esx_storage_driver.c
+++ b/src/esx/esx_storage_driver.c
@@ -84,8 +84,8 @@ esxStoragePoolLookupType(esxVI_Context *ctx, const char *poolName,
} else if (esxVI_VmfsDatastoreInfo_DynamicCast(datastoreInfo) != NULL) {
*poolType = VIR_STORAGE_POOL_FS;
} else {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("DatastoreInfo has unexpected type"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("DatastoreInfo has unexpected type"));
goto cleanup;
}
@@ -336,9 +336,9 @@ esxStoragePoolLookupByUUID(virConnectPtr conn, const unsigned char
*uuid)
if (datastore == NULL) {
virUUIDFormat(uuid, uuid_string);
- ESX_VI_ERROR(VIR_ERR_NO_STORAGE_POOL,
- _("Could not find datastore with UUID '%s'"),
- uuid_string);
+ virReportError(VIR_ERR_NO_STORAGE_POOL,
+ _("Could not find datastore with UUID '%s'"),
+ uuid_string);
goto cleanup;
}
@@ -557,9 +557,9 @@ esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
} else if (STRCASEEQ(nasInfo->nas->type, "CIFS")) {
def.source.format = VIR_STORAGE_POOL_NETFS_CIFS;
} else {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Datastore has unexpected type '%s'"),
- nasInfo->nas->type);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Datastore has unexpected type '%s'"),
+ nasInfo->nas->type);
goto cleanup;
}
} else if (esxVI_VmfsDatastoreInfo_DynamicCast(info) != NULL) {
@@ -569,8 +569,8 @@ esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
* VMFS based datastore in libvirt terms
*/
} else {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("DatastoreInfo has unexpected type"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("DatastoreInfo has unexpected type"));
goto cleanup;
}
@@ -607,8 +607,8 @@ esxStoragePoolSetAutostart(virStoragePoolPtr pool ATTRIBUTE_UNUSED,
autostart = (autostart != 0);
if (! autostart) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot deactivate storage pool autostart"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Cannot deactivate storage pool autostart"));
return -1;
}
@@ -670,7 +670,7 @@ esxStoragePoolListStorageVolumes(virStoragePoolPtr pool, char **const
names,
int i;
if (names == NULL || maxnames < 0) {
- ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", _("Invalid argument"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s", _("Invalid
argument"));
return -1;
}
@@ -837,9 +837,9 @@ esxStorageVolumeLookupByKey(virConnectPtr conn, const char *key)
}
if (!priv->primary->hasQueryVirtualDiskUuid) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("QueryVirtualDiskUuid not available, cannot lookup storage
"
- "volume by UUID"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("QueryVirtualDiskUuid not available, cannot lookup storage
"
+ "volume by UUID"));
return NULL;
}
@@ -999,8 +999,8 @@ esxStorageVolumeCreateXML(virStoragePoolPtr pool, const char
*xmldesc,
}
if (def->type != VIR_STORAGE_VOL_FILE) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Creating non-file volumes is not supported"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Creating non-file volumes is not supported"));
goto cleanup;
}
@@ -1008,16 +1008,16 @@ esxStorageVolumeCreateXML(virStoragePoolPtr pool, const char
*xmldesc,
tmp = strrchr(def->name, '/');
if (tmp == NULL || *def->name == '/' || tmp[1] == '\0') {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Volume name '%s' doesn't have expected format
"
- "'<directory>/<file>'"),
def->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Volume name '%s' doesn't have expected format
"
+ "'<directory>/<file>'"),
def->name);
goto cleanup;
}
if (! virFileHasSuffix(def->name, ".vmdk")) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Volume name '%s' has unsupported suffix, expecting
'.vmdk'"),
- def->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Volume name '%s' has unsupported suffix, expecting
'.vmdk'"),
+ def->name);
goto cleanup;
}
@@ -1095,8 +1095,8 @@ esxStorageVolumeCreateXML(virStoragePoolPtr pool, const char
*xmldesc,
*/
virtualDiskSpec->diskType = (char *)"thin";
} else {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unsupported capacity-to-allocation relation"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Unsupported capacity-to-allocation relation"));
goto cleanup;
}
@@ -1122,8 +1122,8 @@ esxStorageVolumeCreateXML(virStoragePoolPtr pool, const char
*xmldesc,
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not create volume:
%s"),
- taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not create volume:
%s"),
+ taskInfoErrorMessage);
goto cleanup;
}
@@ -1149,9 +1149,9 @@ esxStorageVolumeCreateXML(virStoragePoolPtr pool, const char
*xmldesc,
}
}
} else {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Creation of %s volumes is not supported"),
- virStorageFileFormatTypeToString(def->target.format));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Creation of %s volumes is not supported"),
+ virStorageFileFormatTypeToString(def->target.format));
goto cleanup;
}
@@ -1233,8 +1233,8 @@ esxStorageVolumeCreateXMLFrom(virStoragePoolPtr pool, const char
*xmldesc,
}
if (def->type != VIR_STORAGE_VOL_FILE) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Creating non-file volumes is not supported"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Creating non-file volumes is not supported"));
goto cleanup;
}
@@ -1242,16 +1242,16 @@ esxStorageVolumeCreateXMLFrom(virStoragePoolPtr pool, const char
*xmldesc,
tmp = strrchr(def->name, '/');
if (tmp == NULL || *def->name == '/' || tmp[1] == '\0') {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Volume name '%s' doesn't have expected format
"
- "'<directory>/<file>'"),
def->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Volume name '%s' doesn't have expected format
"
+ "'<directory>/<file>'"),
def->name);
goto cleanup;
}
if (! virFileHasSuffix(def->name, ".vmdk")) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Volume name '%s' has unsupported suffix, expecting
'.vmdk'"),
- def->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Volume name '%s' has unsupported suffix, expecting
'.vmdk'"),
+ def->name);
goto cleanup;
}
@@ -1324,8 +1324,8 @@ esxStorageVolumeCreateXMLFrom(virStoragePoolPtr pool, const char
*xmldesc,
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not copy volume: %s"),
- taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not copy volume:
%s"),
+ taskInfoErrorMessage);
goto cleanup;
}
@@ -1351,9 +1351,9 @@ esxStorageVolumeCreateXMLFrom(virStoragePoolPtr pool, const char
*xmldesc,
}
}
} else {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Creation of %s volumes is not supported"),
- virStorageFileFormatTypeToString(def->target.format));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Creation of %s volumes is not supported"),
+ virStorageFileFormatTypeToString(def->target.format));
goto cleanup;
}
@@ -1412,8 +1412,8 @@ esxStorageVolumeDelete(virStorageVolPtr volume, unsigned int flags)
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not delete volume: %s"),
- taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not delete volume:
%s"),
+ taskInfoErrorMessage);
goto cleanup;
}
@@ -1461,8 +1461,8 @@ esxStorageVolumeWipe(virStorageVolPtr volume, unsigned int flags)
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not wipe volume: %s"),
- taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not wipe volume: %s"),
+ taskInfoErrorMessage);
goto cleanup;
}
@@ -1595,8 +1595,8 @@ esxStorageVolumeGetXMLDesc(virStorageVolPtr volume, unsigned int
flags)
def.target.format = VIR_STORAGE_FILE_RAW;
} else {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("File '%s' has unknown type"), datastorePath);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("File '%s' has unknown type"),
datastorePath);
goto cleanup;
}
diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c
index 478f60b..6ed3a3e 100644
--- a/src/esx/esx_util.c
+++ b/src/esx/esx_util.c
@@ -50,7 +50,7 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
char *tmp;
if (parsedUri == NULL || *parsedUri != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -74,10 +74,10 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
if (STRNEQ((*parsedUri)->transport, "http") &&
STRNEQ((*parsedUri)->transport, "https")) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- _("Query parameter 'transport' has unexpected
value "
- "'%s' (should be http|https)"),
- (*parsedUri)->transport);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Query parameter 'transport' has unexpected
value "
+ "'%s' (should be http|https)"),
+ (*parsedUri)->transport);
goto cleanup;
}
} else if (STRCASEEQ(queryParam->name, "vcenter")) {
@@ -92,9 +92,9 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
} else if (STRCASEEQ(queryParam->name, "no_verify")) {
if (virStrToLong_i(queryParam->value, NULL, 10, &noVerify) < 0 ||
(noVerify != 0 && noVerify != 1)) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- _("Query parameter 'no_verify' has unexpected
value "
- "'%s' (should be 0 or 1)"),
queryParam->value);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Query parameter 'no_verify' has unexpected
value "
+ "'%s' (should be 0 or 1)"),
queryParam->value);
goto cleanup;
}
@@ -102,9 +102,9 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
} else if (STRCASEEQ(queryParam->name, "auto_answer")) {
if (virStrToLong_i(queryParam->value, NULL, 10, &autoAnswer) < 0
||
(autoAnswer != 0 && autoAnswer != 1)) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- _("Query parameter 'auto_answer' has unexpected
"
- "value '%s' (should be 0 or 1)"),
queryParam->value);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Query parameter 'auto_answer' has
unexpected "
+ "value '%s' (should be 0 or 1)"),
queryParam->value);
goto cleanup;
}
@@ -128,10 +128,10 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
} else if ((tmp = strstr(queryParam->value, "://")) != NULL) {
*tmp = '\0';
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- _("Query parameter 'proxy' contains unexpected
"
- "type '%s' (should be
(http|socks(|4|4a|5))"),
- queryParam->value);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Query parameter 'proxy' contains
unexpected "
+ "type '%s' (should be
(http|socks(|4|4a|5))"),
+ queryParam->value);
goto cleanup;
} else {
tmp = queryParam->value;
@@ -146,9 +146,9 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
if ((tmp = strchr((*parsedUri)->proxy_hostname, ':')) != NULL) {
if (tmp == (*parsedUri)->proxy_hostname) {
- ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
- _("Query parameter 'proxy' doesn't contain
a "
- "hostname"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Query parameter 'proxy' doesn't
contain a "
+ "hostname"));
goto cleanup;
}
@@ -158,9 +158,9 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
&(*parsedUri)->proxy_port) < 0 ||
(*parsedUri)->proxy_port < 1 ||
(*parsedUri)->proxy_port > 65535) {
- ESX_ERROR(VIR_ERR_INVALID_ARG,
- _("Query parameter 'proxy' has unexpected
port"
- "value '%s' (should be [1..65535])"),
tmp);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Query parameter 'proxy' has unexpected
port"
+ "value '%s' (should be
[1..65535])"), tmp);
goto cleanup;
}
}
@@ -255,7 +255,7 @@ esxUtil_ParseDatastorePath(const char *datastorePath, char
**datastoreName,
if ((datastoreName != NULL && *datastoreName != NULL) ||
(directoryName != NULL && *directoryName != NULL) ||
(directoryAndFileName != NULL && *directoryAndFileName != NULL)) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -266,9 +266,9 @@ esxUtil_ParseDatastorePath(const char *datastorePath, char
**datastoreName,
/* Expected format: '[<datastore>] <path>' where <path> is
optional */
if ((tmp = STRSKIP(copyOfDatastorePath, "[")) == NULL || *tmp ==
']' ||
(preliminaryDatastoreName = strtok_r(tmp, "]", &saveptr)) == NULL)
{
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Datastore path '%s' doesn't have expected format
"
- "'[<datastore>] <path>'"),
datastorePath);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Datastore path '%s' doesn't have expected
format "
+ "'[<datastore>] <path>'"),
datastorePath);
goto cleanup;
}
@@ -349,16 +349,16 @@ esxUtil_ResolveHostname(const char *hostname,
errcode = getaddrinfo(hostname, NULL, &hints, &result);
if (errcode != 0) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("IP address lookup for host '%s' failed: %s"),
hostname,
- gai_strerror(errcode));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("IP address lookup for host '%s' failed: %s"),
hostname,
+ gai_strerror(errcode));
return -1;
}
if (result == NULL) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("No IP address for host '%s' found: %s"),
hostname,
- gai_strerror(errcode));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("No IP address for host '%s' found: %s"),
hostname,
+ gai_strerror(errcode));
return -1;
}
@@ -366,9 +366,9 @@ esxUtil_ResolveHostname(const char *hostname,
ipAddress_length, NULL, 0, NI_NUMERICHOST);
if (errcode != 0) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Formatting IP address for host '%s' failed: %s"),
hostname,
- gai_strerror(errcode));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Formatting IP address for host '%s' failed:
%s"), hostname,
+ gai_strerror(errcode));
freeaddrinfo(result);
return -1;
}
@@ -386,9 +386,9 @@ esxUtil_ReformatUuid(const char *input, char *output)
unsigned char uuid[VIR_UUID_BUFLEN];
if (virUUIDParse(input, uuid) < 0) {
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not parse UUID from string '%s'"),
- input);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not parse UUID from string '%s'"),
+ input);
return -1;
}
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 48718b6..914102d 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -231,9 +231,9 @@ esxVI_CURL_Perform(esxVI_CURL *curl, const char *url)
errorCode = curl_easy_perform(curl->handle);
if (errorCode != CURLE_OK) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("curl_easy_perform() returned an error: %s (%d) : %s"),
- curl_easy_strerror(errorCode), errorCode, curl->error);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("curl_easy_perform() returned an error: %s (%d) :
%s"),
+ curl_easy_strerror(errorCode), errorCode, curl->error);
return -1;
}
@@ -241,17 +241,17 @@ esxVI_CURL_Perform(esxVI_CURL *curl, const char *url)
&responseCode);
if (errorCode != CURLE_OK) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned an
"
- "error: %s (%d) : %s"), curl_easy_strerror(errorCode),
- errorCode, curl->error);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned an
"
+ "error: %s (%d) : %s"),
curl_easy_strerror(errorCode),
+ errorCode, curl->error);
return -1;
}
if (responseCode < 0) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned a "
- "negative response code"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned a
"
+ "negative response code"));
return -1;
}
@@ -261,19 +261,19 @@ esxVI_CURL_Perform(esxVI_CURL *curl, const char *url)
&redirectUrl);
if (errorCode != CURLE_OK) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("curl_easy_getinfo(CURLINFO_REDIRECT_URL) returned
"
- "an error: %s (%d) : %s"),
- curl_easy_strerror(errorCode),
- errorCode, curl->error);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("curl_easy_getinfo(CURLINFO_REDIRECT_URL) returned
"
+ "an error: %s (%d) : %s"),
+ curl_easy_strerror(errorCode),
+ errorCode, curl->error);
} else {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("The server redirects from '%s' to
'%s'"), url,
- redirectUrl);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("The server redirects from '%s' to
'%s'"), url,
+ redirectUrl);
}
#else
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("The server redirects from '%s'"), url);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("The server redirects from '%s'"), url);
#endif
return -1;
@@ -286,15 +286,15 @@ int
esxVI_CURL_Connect(esxVI_CURL *curl, esxUtil_ParsedUri *parsedUri)
{
if (curl->handle != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
call"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
call"));
return -1;
}
curl->handle = curl_easy_init();
if (curl->handle == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not initialize CURL"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not initialize CURL"));
return -1;
}
@@ -312,8 +312,8 @@ esxVI_CURL_Connect(esxVI_CURL *curl, esxUtil_ParsedUri *parsedUri)
curl->headers = curl_slist_append(curl->headers, "Expect:");
if (curl->headers == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not build CURL header list"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not build CURL header list"));
return -1;
}
@@ -346,8 +346,8 @@ esxVI_CURL_Connect(esxVI_CURL *curl, esxUtil_ParsedUri *parsedUri)
}
if (virMutexInit(&curl->lock) < 0) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not initialize CURL mutex"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not initialize CURL mutex"));
return -1;
}
@@ -361,7 +361,7 @@ esxVI_CURL_Download(esxVI_CURL *curl, const char *url, char
**content)
int responseCode = 0;
if (content == NULL || *content != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -379,9 +379,9 @@ esxVI_CURL_Download(esxVI_CURL *curl, const char *url, char
**content)
if (responseCode < 0) {
goto cleanup;
} else if (responseCode != 200) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("HTTP response code %d for download from
'%s'"),
- responseCode, url);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("HTTP response code %d for download from
'%s'"),
+ responseCode, url);
goto cleanup;
}
@@ -407,7 +407,7 @@ esxVI_CURL_Upload(esxVI_CURL *curl, const char *url, const char
*content)
int responseCode = 0;
if (content == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -425,9 +425,9 @@ esxVI_CURL_Upload(esxVI_CURL *curl, const char *url, const char
*content)
if (responseCode < 0) {
return -1;
} else if (responseCode != 200 && responseCode != 201) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("HTTP response code %d for upload to '%s'"),
- responseCode, url);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("HTTP response code %d for upload to '%s'"),
+ responseCode, url);
return -1;
}
@@ -525,14 +525,14 @@ esxVI_SharedCURL_Add(esxVI_SharedCURL *shared, esxVI_CURL *curl)
int i;
if (curl->handle == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot share uninitialized CURL handle"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Cannot share uninitialized CURL handle"));
return -1;
}
if (curl->shared != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot share CURL handle that is already shared"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Cannot share CURL handle that is already shared"));
return -1;
}
@@ -540,8 +540,8 @@ esxVI_SharedCURL_Add(esxVI_SharedCURL *shared, esxVI_CURL *curl)
shared->handle = curl_share_init();
if (shared->handle == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not initialize CURL (share)"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not initialize CURL (share)"));
return -1;
}
@@ -557,8 +557,8 @@ esxVI_SharedCURL_Add(esxVI_SharedCURL *shared, esxVI_CURL *curl)
for (i = 0; i < ARRAY_CARDINALITY(shared->locks); ++i) {
if (virMutexInit(&shared->locks[i]) < 0) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not initialize a CURL (share) mutex"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not initialize a CURL (share)
mutex"));
return -1;
}
}
@@ -580,19 +580,19 @@ int
esxVI_SharedCURL_Remove(esxVI_SharedCURL *shared, esxVI_CURL *curl)
{
if (curl->handle == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot unshare uninitialized CURL handle"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Cannot unshare uninitialized CURL handle"));
return -1;
}
if (curl->shared == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot unshare CURL handle that is not shared"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Cannot unshare CURL handle that is not shared"));
return -1;
}
if (curl->shared != shared) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("CURL (share)
mismatch"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("CURL (share)
mismatch"));
return -1;
}
@@ -635,14 +635,14 @@ int
esxVI_MultiCURL_Add(esxVI_MultiCURL *multi, esxVI_CURL *curl)
{
if (curl->handle == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot add uninitialized CURL handle to a multi
handle"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Cannot add uninitialized CURL handle to a multi
handle"));
return -1;
}
if (curl->multi != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot add CURL handle to a multi handle twice"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Cannot add CURL handle to a multi handle twice"));
return -1;
}
@@ -650,8 +650,8 @@ esxVI_MultiCURL_Add(esxVI_MultiCURL *multi, esxVI_CURL *curl)
multi->handle = curl_multi_init();
if (multi->handle == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not initialize CURL (multi)"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not initialize CURL (multi)"));
return -1;
}
}
@@ -672,21 +672,21 @@ int
esxVI_MultiCURL_Remove(esxVI_MultiCURL *multi, esxVI_CURL *curl)
{
if (curl->handle == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot remove uninitialized CURL handle from a "
- "multi handle"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Cannot remove uninitialized CURL handle from a "
+ "multi handle"));
return -1;
}
if (curl->multi == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot remove CURL handle from a multi handle when it
"
- "wasn't added before"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Cannot remove CURL handle from a multi handle when it
"
+ "wasn't added before"));
return -1;
}
if (curl->multi != multi) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("CURL (multi)
mismatch"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("CURL (multi)
mismatch"));
return -1;
}
@@ -748,7 +748,7 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
if (ctx == NULL || url == NULL || ipAddress == NULL || username == NULL ||
password == NULL || ctx->url != NULL || ctx->service != NULL ||
ctx->curl != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -767,8 +767,8 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
}
if (virMutexInit(ctx->sessionLock) < 0) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not initialize session mutex"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not initialize session mutex"));
return -1;
}
@@ -797,9 +797,9 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
VIR_WARN("Found untested VI API major/minor version '%s'",
ctx->service->about->apiVersion);
} else {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VI API major/minor version '2.5',
'4.x' or "
- "'5.x' but found '%s'"),
ctx->service->about->apiVersion);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VI API major/minor version '2.5',
'4.x' or "
+ "'5.x' but found '%s'"),
ctx->service->about->apiVersion);
return -1;
}
@@ -807,9 +807,9 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
if (STRPREFIX(ctx->service->about->version, "2.0")) {
ctx->productVersion = esxVI_ProductVersion_GSX20;
} else {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting GSX major/minor version '2.0' but
"
- "found '%s'"),
ctx->service->about->version);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting GSX major/minor version '2.0'
but "
+ "found '%s'"),
ctx->service->about->version);
return -1;
}
} else if (STREQ(ctx->service->about->productLineId, "esx")
||
@@ -833,10 +833,10 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
VIR_WARN("Found untested ESX major/minor version
'%s'",
ctx->service->about->version);
} else {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting ESX major/minor version '3.5',
"
- "'4.x' or '5.x' but found
'%s'"),
- ctx->service->about->version);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting ESX major/minor version '3.5',
"
+ "'4.x' or '5.x' but found
'%s'"),
+ ctx->service->about->version);
return -1;
}
} else if (STREQ(ctx->service->about->productLineId, "vpx"))
{
@@ -859,23 +859,23 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
VIR_WARN("Found untested VPX major/minor version
'%s'",
ctx->service->about->version);
} else {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VPX major/minor version '2.5',
'4.x' "
- "or '5.x' but found '%s'"),
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VPX major/minor version '2.5',
'4.x' "
+ "or '5.x' but found '%s'"),
ctx->service->about->version);
return -1;
}
} else {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting product 'gsx' or 'esx' or
'embeddedEsx' "
- "or 'vpx' but found '%s'"),
- ctx->service->about->productLineId);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting product 'gsx' or 'esx' or
'embeddedEsx' "
+ "or 'vpx' but found '%s'"),
+ ctx->service->about->productLineId);
return -1;
}
} else {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting VI API type 'HostAgent' or
'VirtualCenter' "
- "but found '%s'"),
ctx->service->about->apiType);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting VI API type 'HostAgent' or
'VirtualCenter' "
+ "but found '%s'"),
ctx->service->about->apiType);
return -1;
}
@@ -927,8 +927,8 @@ esxVI_Context_LookupManagedObjects(esxVI_Context *ctx)
}
if (ctx->computeResource->resourcePool == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not retrieve resource pool"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve resource pool"));
return -1;
}
@@ -979,8 +979,8 @@ esxVI_Context_LookupManagedObjectsByPath(esxVI_Context *ctx, const
char *path)
item = strtok_r(tmp, "/", &saveptr);
if (item == NULL) {
- ESX_VI_ERROR(VIR_ERR_INVALID_ARG,
- _("Path '%s' does not specify a datacenter"),
path);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Path '%s' does not specify a datacenter"),
path);
goto cleanup;
}
@@ -1023,8 +1023,8 @@ esxVI_Context_LookupManagedObjectsByPath(esxVI_Context *ctx, const
char *path)
}
if (ctx->datacenter == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not find datacenter specified in '%s'"),
path);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not find datacenter specified in
'%s'"), path);
goto cleanup;
}
@@ -1037,8 +1037,8 @@ esxVI_Context_LookupManagedObjectsByPath(esxVI_Context *ctx, const
char *path)
/* Lookup (Cluster)ComputeResource */
if (item == NULL) {
- ESX_VI_ERROR(VIR_ERR_INVALID_ARG,
- _("Path '%s' does not specify a compute
resource"), path);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Path '%s' does not specify a compute
resource"), path);
goto cleanup;
}
@@ -1086,15 +1086,15 @@ esxVI_Context_LookupManagedObjectsByPath(esxVI_Context *ctx, const
char *path)
}
if (ctx->computeResource == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not find compute resource specified in
'%s'"),
- path);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not find compute resource specified in
'%s'"),
+ path);
goto cleanup;
}
if (ctx->computeResource->resourcePool == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not retrieve resource pool"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve resource pool"));
goto cleanup;
}
@@ -1109,8 +1109,8 @@ esxVI_Context_LookupManagedObjectsByPath(esxVI_Context *ctx, const
char *path)
if (STREQ(ctx->computeResource->_reference->type,
"ClusterComputeResource")) {
if (item == NULL) {
- ESX_VI_ERROR(VIR_ERR_INVALID_ARG,
- _("Path '%s' does not specify a host system"),
path);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Path '%s' does not specify a host
system"), path);
goto cleanup;
}
@@ -1120,8 +1120,8 @@ esxVI_Context_LookupManagedObjectsByPath(esxVI_Context *ctx, const
char *path)
}
if (item != NULL) {
- ESX_VI_ERROR(VIR_ERR_INVALID_ARG,
- _("Path '%s' ends with an excess item"), path);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Path '%s' ends with an excess item"), path);
goto cleanup;
}
@@ -1140,8 +1140,8 @@ esxVI_Context_LookupManagedObjectsByPath(esxVI_Context *ctx, const
char *path)
}
if (ctx->hostSystem == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not find host system specified in '%s'"),
path);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not find host system specified in
'%s'"), path);
goto cleanup;
}
@@ -1187,8 +1187,8 @@ esxVI_Context_LookupManagedObjectsByHostSystemIp(esxVI_Context
*ctx,
}
if (ctx->computeResource->resourcePool == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not retrieve resource pool"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve resource pool"));
goto cleanup;
}
@@ -1220,7 +1220,7 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
xmlNodePtr responseNode = NULL;
if (request == NULL || response == NULL || *response != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1270,25 +1270,25 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
xpathContext);
if ((*response)->node == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("HTTP response code %d for call to '%s'.
"
- "Fault is unknown, XPath evaluation failed"),
- (*response)->responseCode, methodName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("HTTP response code %d for call to '%s'.
"
+ "Fault is unknown, XPath evaluation failed"),
+ (*response)->responseCode, methodName);
goto cleanup;
}
if (esxVI_Fault_Deserialize((*response)->node, &fault) < 0) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("HTTP response code %d for call to '%s'.
"
- "Fault is unknown, deserialization failed"),
- (*response)->responseCode, methodName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("HTTP response code %d for call to '%s'.
"
+ "Fault is unknown, deserialization failed"),
+ (*response)->responseCode, methodName);
goto cleanup;
}
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("HTTP response code %d for call to '%s'. "
- "Fault: %s - %s"), (*response)->responseCode,
- methodName, fault->faultcode, fault->faultstring);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("HTTP response code %d for call to '%s'.
"
+ "Fault: %s - %s"), (*response)->responseCode,
+ methodName, fault->faultcode, fault->faultstring);
/* FIXME: Dump raw response until detail part gets deserialized */
VIR_DEBUG("HTTP response code %d for call to '%s'
[[[[%s]]]]",
@@ -1307,9 +1307,9 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
responseNode = virXPathNode(xpathExpression, xpathContext);
if (responseNode == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("XPath evaluation of response for call to
'%s' "
- "failed"), methodName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("XPath evaluation of response for call to
'%s' "
+ "failed"), methodName);
goto cleanup;
}
@@ -1319,14 +1319,14 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
switch (occurrence) {
case esxVI_Occurrence_RequiredItem:
if ((*response)->node == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Call to '%s' returned an empty result,
"
- "expecting a non-empty result"),
methodName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Call to '%s' returned an empty result,
"
+ "expecting a non-empty result"),
methodName);
goto cleanup;
} else if ((*response)->node->next != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Call to '%s' returned a list, expecting
"
- "exactly one item"), methodName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Call to '%s' returned a list,
expecting "
+ "exactly one item"), methodName);
goto cleanup;
}
@@ -1334,9 +1334,9 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
case esxVI_Occurrence_RequiredList:
if ((*response)->node == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Call to '%s' returned an empty result,
"
- "expecting a non-empty result"),
methodName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Call to '%s' returned an empty result,
"
+ "expecting a non-empty result"),
methodName);
goto cleanup;
}
@@ -1345,9 +1345,9 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
case esxVI_Occurrence_OptionalItem:
if ((*response)->node != NULL &&
(*response)->node->next != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Call to '%s' returned a list, expecting
"
- "exactly one item"), methodName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Call to '%s' returned a list,
expecting "
+ "exactly one item"), methodName);
goto cleanup;
}
@@ -1359,24 +1359,24 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
case esxVI_Occurrence_None:
if ((*response)->node != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Call to '%s' returned something,
expecting "
- "an empty result"), methodName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Call to '%s' returned something,
expecting "
+ "an empty result"), methodName);
goto cleanup;
}
break;
default:
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Invalid argument (occurrence)"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Invalid argument (occurrence)"));
goto cleanup;
}
}
} else {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("HTTP response code %d for call to '%s'"),
- (*response)->responseCode, methodName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("HTTP response code %d for call to '%s'"),
+ (*response)->responseCode, methodName);
goto cleanup;
}
@@ -1425,17 +1425,17 @@ esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration
*enumeration,
int i;
if (anyType == NULL || value == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
*value = 0; /* undefined */
if (anyType->type != enumeration->type) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting type '%s' but found '%s'"),
- esxVI_Type_ToString(enumeration->type),
- esxVI_Type_ToString(anyType->type));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting type '%s' but found
'%s'"),
+ esxVI_Type_ToString(enumeration->type),
+ esxVI_Type_ToString(anyType->type));
return -1;
}
@@ -1446,9 +1446,9 @@ esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration
*enumeration,
}
}
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Unknown value '%s' for %s"), anyType->value,
- esxVI_Type_ToString(enumeration->type));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unknown value '%s' for %s"), anyType->value,
+ esxVI_Type_ToString(enumeration->type));
return -1;
}
@@ -1461,7 +1461,7 @@ esxVI_Enumeration_Serialize(const esxVI_Enumeration *enumeration,
const char *name = NULL;
if (element == NULL || output == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1477,7 +1477,7 @@ esxVI_Enumeration_Serialize(const esxVI_Enumeration *enumeration,
}
if (name == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1500,7 +1500,7 @@ esxVI_Enumeration_Deserialize(const esxVI_Enumeration *enumeration,
char *name = NULL;
if (value == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1519,8 +1519,8 @@ esxVI_Enumeration_Deserialize(const esxVI_Enumeration *enumeration,
}
if (result < 0) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, _("Unknown value '%s' for
%s"),
- name, esxVI_Type_ToString(enumeration->type));
+ virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown value '%s' for
%s"),
+ name, esxVI_Type_ToString(enumeration->type));
}
VIR_FREE(name);
@@ -1540,7 +1540,7 @@ esxVI_List_Append(esxVI_List **list, esxVI_List *item)
esxVI_List *next = NULL;
if (list == NULL || item == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1569,7 +1569,7 @@ esxVI_List_DeepCopy(esxVI_List **destList, esxVI_List *srcList,
esxVI_List *src = NULL;
if (destList == NULL || *destList != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1603,7 +1603,7 @@ esxVI_List_CastFromAnyType(esxVI_AnyType *anyType, esxVI_List
**list,
if (list == NULL || *list != NULL ||
castFromAnyTypeFunc == NULL || freeFunc == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1612,17 +1612,17 @@ esxVI_List_CastFromAnyType(esxVI_AnyType *anyType, esxVI_List
**list,
}
if (! STRPREFIX(anyType->other, "ArrayOf")) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting type to begin with 'ArrayOf' but found
'%s'"),
- anyType->other);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting type to begin with 'ArrayOf' but found
'%s'"),
+ anyType->other);
return -1;
}
for (childNode = anyType->node->children; childNode != NULL;
childNode = childNode->next) {
if (childNode->type != XML_ELEMENT_NODE) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Wrong XML element type %d"), childNode->type);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Wrong XML element type %d"),
childNode->type);
goto cleanup;
}
@@ -1658,7 +1658,7 @@ esxVI_List_Serialize(esxVI_List *list, const char *element,
esxVI_List *item = NULL;
if (element == NULL || output == NULL || serializeFunc == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1684,7 +1684,7 @@ esxVI_List_Deserialize(xmlNodePtr node, esxVI_List **list,
if (list == NULL || *list != NULL ||
deserializeFunc == NULL || freeFunc == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1694,8 +1694,8 @@ esxVI_List_Deserialize(xmlNodePtr node, esxVI_List **list,
for (; node != NULL; node = node->next) {
if (node->type != XML_ELEMENT_NODE) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Wrong XML element type %d"), node->type);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Wrong XML element type %d"), node->type);
goto failure;
}
@@ -1730,7 +1730,7 @@ int
esxVI_Alloc(void **ptrptr, size_t size)
{
if (ptrptr == NULL || *ptrptr != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1758,7 +1758,7 @@ esxVI_BuildSelectSet(esxVI_SelectionSpec **selectSet,
* Don't check for *selectSet != NULL here because selectSet is a list
* and might contain items already. This function appends to selectSet.
*/
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1897,14 +1897,14 @@ esxVI_EnsureSession(esxVI_Context *ctx)
esxVI_UserSession *currentSession = NULL;
if (ctx->sessionLock == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call, no
mutex"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call, no
mutex"));
return -1;
}
virMutexLock(ctx->sessionLock);
if (ctx->session == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call, no
session"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call, no
session"));
goto cleanup;
}
@@ -1962,9 +1962,9 @@ esxVI_EnsureSession(esxVI_Context *ctx)
goto cleanup;
}
} else if (STRNEQ(ctx->session->key, currentSession->key)) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Key of the current session differs from the key at
"
- "last login"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Key of the current session differs from the key at
"
+ "last login"));
goto cleanup;
}
}
@@ -1999,7 +1999,7 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx,
esxVI_PropertyFilterSpec *propertyFilterSpec = NULL;
if (objectContentList == NULL || *objectContentList != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -2017,9 +2017,9 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx,
STREQ(type, "ClusterComputeResource")) {
objectSpec->selectSet = ctx->selectSet_folderToChildEntity;
} else {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Invalid lookup of '%s' from
'%s'"),
- type, root->type);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Invalid lookup of '%s' from
'%s'"),
+ type, root->type);
goto cleanup;
}
} else if (STREQ(root->type, "ComputeResource") ||
@@ -2029,9 +2029,9 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx,
} else if (STREQ(type, "Datacenter")) {
objectSpec->selectSet =
ctx->selectSet_computeResourceToParentToParent;
} else {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Invalid lookup of '%s' from
'%s'"),
- type, root->type);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Invalid lookup of '%s' from
'%s'"),
+ type, root->type);
goto cleanup;
}
} else if (STREQ(root->type, "HostSystem")) {
@@ -2043,14 +2043,14 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx,
} else if (STREQ(type, "Datastore")) {
objectSpec->selectSet = ctx->selectSet_hostSystemToDatastore;
} else {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Invalid lookup of '%s' from
'%s'"),
- type, root->type);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Invalid lookup of '%s' from
'%s'"),
+ type, root->type);
goto cleanup;
}
} else {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Invalid lookup from '%s'"),
root->type);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Invalid lookup from '%s'"),
root->type);
goto cleanup;
}
}
@@ -2090,20 +2090,20 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx,
break;
case esxVI_Occurrence_RequiredItem:
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not lookup '%s' from '%s'"),
- type, root->type);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not lookup '%s' from
'%s'"),
+ type, root->type);
break;
case esxVI_Occurrence_RequiredList:
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not lookup '%s' list from
'%s'"),
- type, root->type);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not lookup '%s' list from
'%s'"),
+ type, root->type);
break;
default:
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Invalid occurrence value"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Invalid occurrence value"));
break;
}
@@ -2157,9 +2157,9 @@ esxVI_GetManagedEntityStatus(esxVI_ObjectContent *objectContent,
}
}
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Missing '%s' property while looking for "
- "ManagedEntityStatus"), propertyName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing '%s' property while looking for "
+ "ManagedEntityStatus"), propertyName);
return -1;
}
@@ -2180,8 +2180,8 @@ esxVI_GetVirtualMachinePowerState(esxVI_ObjectContent
*virtualMachine,
}
}
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Missing 'runtime.powerState' property"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Missing 'runtime.powerState' property"));
return -1;
}
@@ -2196,7 +2196,7 @@ esxVI_GetVirtualMachineQuestionInfo
esxVI_DynamicProperty *dynamicProperty;
if (questionInfo == NULL || *questionInfo != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -2222,7 +2222,7 @@ esxVI_GetBoolean(esxVI_ObjectContent *objectContent, const char
*propertyName,
esxVI_DynamicProperty *dynamicProperty;
if (value == NULL || *value != esxVI_Boolean_Undefined) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -2241,8 +2241,8 @@ esxVI_GetBoolean(esxVI_ObjectContent *objectContent, const char
*propertyName,
if (*value == esxVI_Boolean_Undefined &&
occurrence == esxVI_Occurrence_RequiredItem) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Missing '%s' property"), propertyName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing '%s' property"), propertyName);
return -1;
}
@@ -2258,7 +2258,7 @@ esxVI_GetLong(esxVI_ObjectContent *objectContent, const char
*propertyName,
esxVI_DynamicProperty *dynamicProperty;
if (value == NULL || *value != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -2274,8 +2274,8 @@ esxVI_GetLong(esxVI_ObjectContent *objectContent, const char
*propertyName,
}
if (*value == NULL && occurrence == esxVI_Occurrence_RequiredItem) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Missing '%s' property"), propertyName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing '%s' property"), propertyName);
return -1;
}
@@ -2292,7 +2292,7 @@ esxVI_GetStringValue(esxVI_ObjectContent *objectContent,
esxVI_DynamicProperty *dynamicProperty;
if (value == NULL || *value != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -2310,8 +2310,8 @@ esxVI_GetStringValue(esxVI_ObjectContent *objectContent,
}
if (*value == NULL && occurrence == esxVI_Occurrence_RequiredItem) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Missing '%s' property"), propertyName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing '%s' property"), propertyName);
return -1;
}
@@ -2329,7 +2329,7 @@ esxVI_GetManagedObjectReference(esxVI_ObjectContent *objectContent,
esxVI_DynamicProperty *dynamicProperty;
if (value == NULL || *value != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -2346,8 +2346,8 @@ esxVI_GetManagedObjectReference(esxVI_ObjectContent *objectContent,
}
if (*value == NULL && occurrence == esxVI_Occurrence_RequiredItem) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Missing '%s' property"), propertyName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing '%s' property"), propertyName);
return -1;
}
@@ -2417,24 +2417,24 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent
*virtualMachine,
esxVI_ManagedEntityStatus configStatus = esxVI_ManagedEntityStatus_Undefined;
if (STRNEQ(virtualMachine->obj->type, "VirtualMachine")) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("ObjectContent does not reference a virtual machine"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("ObjectContent does not reference a virtual
machine"));
return -1;
}
if (id != NULL) {
if (esxUtil_ParseVirtualMachineIDString
(virtualMachine->obj->value, id) < 0 || *id <= 0) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not parse positive integer from
'%s'"),
- virtualMachine->obj->value);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not parse positive integer from
'%s'"),
+ virtualMachine->obj->value);
goto failure;
}
}
if (name != NULL) {
if (*name != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
goto failure;
}
@@ -2455,8 +2455,8 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent
*virtualMachine,
}
if (virVMXUnescapeHexPercent(*name) < 0) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Domain name contains invalid escape
sequence"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Domain name contains invalid escape
sequence"));
goto failure;
}
@@ -2465,8 +2465,8 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent
*virtualMachine,
}
if (*name == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not get name of virtual machine"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not get name of virtual machine"));
goto failure;
}
}
@@ -2493,15 +2493,15 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent
*virtualMachine,
}
if (uuid_string == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not get UUID of virtual machine"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not get UUID of virtual machine"));
goto failure;
}
if (virUUIDParse(uuid_string, uuid) < 0) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not parse UUID from string
'%s'"),
- uuid_string);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not parse UUID from string
'%s'"),
+ uuid_string);
goto failure;
}
} else {
@@ -2611,7 +2611,7 @@ esxVI_GetSnapshotTreeByName
if (snapshotTree == NULL || *snapshotTree != NULL ||
(snapshotTreeParent && *snapshotTreeParent != NULL)) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -2638,8 +2638,8 @@ esxVI_GetSnapshotTreeByName
if (occurrence == esxVI_Occurrence_OptionalItem) {
return 0;
} else {
- ESX_VI_ERROR(VIR_ERR_NO_DOMAIN_SNAPSHOT,
- _("Could not find snapshot with name '%s'"),
name);
+ virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
+ _("Could not find snapshot with name '%s'"),
name);
return -1;
}
@@ -2656,7 +2656,7 @@ esxVI_GetSnapshotTreeBySnapshot
esxVI_VirtualMachineSnapshotTree *candidate;
if (snapshotTree == NULL || *snapshotTree != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -2673,9 +2673,9 @@ esxVI_GetSnapshotTreeBySnapshot
}
}
- ESX_VI_ERROR(VIR_ERR_NO_DOMAIN_SNAPSHOT,
- _("Could not find domain snapshot with internal name
'%s'"),
- snapshot->value);
+ virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
+ _("Could not find domain snapshot with internal name
'%s'"),
+ snapshot->value);
return -1;
}
@@ -2721,7 +2721,7 @@ esxVI_LookupVirtualMachineByUuid(esxVI_Context *ctx, const unsigned
char *uuid,
char uuid_string[VIR_UUID_STRING_BUFLEN] = "";
if (virtualMachine == NULL || *virtualMachine != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -2738,9 +2738,9 @@ esxVI_LookupVirtualMachineByUuid(esxVI_Context *ctx, const unsigned
char *uuid,
goto cleanup;
} else {
- ESX_VI_ERROR(VIR_ERR_NO_DOMAIN,
- _("Could not find domain with UUID '%s'"),
- uuid_string);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("Could not find domain with UUID '%s'"),
+ uuid_string);
goto cleanup;
}
}
@@ -2775,7 +2775,7 @@ esxVI_LookupVirtualMachineByName(esxVI_Context *ctx, const char
*name,
char *name_candidate = NULL;
if (virtualMachine == NULL || *virtualMachine != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -2813,8 +2813,8 @@ esxVI_LookupVirtualMachineByName(esxVI_Context *ctx, const char
*name,
goto cleanup;
} else {
- ESX_VI_ERROR(VIR_ERR_NO_DOMAIN,
- _("Could not find domain with name '%s'"),
name);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("Could not find domain with name '%s'"),
name);
goto cleanup;
}
}
@@ -2866,8 +2866,8 @@ esxVI_LookupVirtualMachineByUuidAndPrepareForTask
}
if (pendingTaskInfoList != NULL) {
- ESX_VI_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
- _("Other tasks are pending for this domain"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Other tasks are pending for this domain"));
goto cleanup;
}
@@ -2910,7 +2910,7 @@ esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name,
char *name_candidate;
if (datastore == NULL || *datastore != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -2947,8 +2947,8 @@ esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name,
}
if (*datastore == NULL && occurrence != esxVI_Occurrence_OptionalItem) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not find datastore with name '%s'"),
name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not find datastore with name '%s'"),
name);
goto cleanup;
}
@@ -2978,7 +2978,7 @@ esxVI_LookupDatastoreByAbsolutePath(esxVI_Context *ctx,
esxVI_DatastoreHostMount *datastoreHostMount = NULL;
if (datastore == NULL || *datastore != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -3034,9 +3034,9 @@ esxVI_LookupDatastoreByAbsolutePath(esxVI_Context *ctx,
}
if (*datastore == NULL && occurrence != esxVI_Occurrence_OptionalItem) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not find datastore containing absolute path
'%s'"),
- absolutePath);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not find datastore containing absolute path
'%s'"),
+ absolutePath);
goto cleanup;
}
@@ -3065,7 +3065,7 @@ esxVI_LookupDatastoreHostMount(esxVI_Context *ctx,
esxVI_DatastoreHostMount *candidate = NULL;
if (hostMount == NULL || *hostMount != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -3104,8 +3104,8 @@ esxVI_LookupDatastoreHostMount(esxVI_Context *ctx,
}
if (*hostMount == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not lookup datastore host mount"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not lookup datastore host mount"));
goto cleanup;
}
@@ -3131,7 +3131,7 @@ esxVI_LookupTaskInfoByTask(esxVI_Context *ctx,
esxVI_DynamicProperty *dynamicProperty = NULL;
if (taskInfo == NULL || *taskInfo != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -3180,7 +3180,7 @@ esxVI_LookupPendingTaskInfoListByVirtualMachine
esxVI_TaskInfo *taskInfo = NULL;
if (pendingTaskInfoList == NULL || *pendingTaskInfoList != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -3288,7 +3288,7 @@ esxVI_LookupRootSnapshotTreeList
esxVI_DynamicProperty *dynamicProperty = NULL;
if (rootSnapshotTreeList == NULL || *rootSnapshotTreeList != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -3344,7 +3344,7 @@ esxVI_LookupCurrentSnapshotTree
esxVI_VirtualMachineSnapshotTree *snapshotTree = NULL;
if (currentSnapshotTree == NULL || *currentSnapshotTree != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -3380,15 +3380,15 @@ esxVI_LookupCurrentSnapshotTree
goto cleanup;
} else {
- ESX_VI_ERROR(VIR_ERR_NO_DOMAIN_SNAPSHOT, "%s",
- _("Domain has no current snapshot"));
+ virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, "%s",
+ _("Domain has no current snapshot"));
goto cleanup;
}
}
if (rootSnapshotTreeList == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not lookup root snapshot list"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not lookup root snapshot list"));
goto cleanup;
}
@@ -3441,7 +3441,7 @@ esxVI_LookupFileInfoByDatastorePath(esxVI_Context *ctx,
esxVI_HostDatastoreBrowserSearchResults *searchResults = NULL;
if (fileInfo == NULL || *fileInfo != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -3475,9 +3475,9 @@ esxVI_LookupFileInfoByDatastorePath(esxVI_Context *ctx,
if (directoryAndFileName[length] != '/' ||
directoryAndFileName[length + 1] == '\0') {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Datastore path '%s' doesn't reference a
file"),
- datastorePath);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Datastore path '%s' doesn't reference a
file"),
+ datastorePath);
goto cleanup;
}
@@ -3562,9 +3562,9 @@ esxVI_LookupFileInfoByDatastorePath(esxVI_Context *ctx,
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not search in datastore '%s': %s"),
- datastoreName, taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not search in datastore '%s': %s"),
+ datastoreName, taskInfoErrorMessage);
goto cleanup;
}
@@ -3581,9 +3581,9 @@ esxVI_LookupFileInfoByDatastorePath(esxVI_Context *ctx,
goto cleanup;
} else {
- ESX_VI_ERROR(VIR_ERR_NO_STORAGE_VOL,
- _("No storage volume with key or path '%s'"),
- datastorePath);
+ virReportError(VIR_ERR_NO_STORAGE_VOL,
+ _("No storage volume with key or path
'%s'"),
+ datastorePath);
goto cleanup;
}
}
@@ -3638,7 +3638,7 @@ esxVI_LookupDatastoreContentByDatastoreName
esxVI_TaskInfo *taskInfo = NULL;
if (searchResultsList == NULL || *searchResultsList != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -3707,9 +3707,9 @@ esxVI_LookupDatastoreContentByDatastoreName
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not serach in datastore '%s': %s"),
- datastoreName, taskInfoErrorMessage);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not serach in datastore '%s': %s"),
+ datastoreName, taskInfoErrorMessage);
goto cleanup;
}
@@ -3746,7 +3746,7 @@ esxVI_LookupStorageVolumeKeyByDatastorePath(esxVI_Context *ctx,
char *uuid_string = NULL;
if (key == NULL || *key != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -3804,7 +3804,7 @@ esxVI_LookupAutoStartDefaults(esxVI_Context *ctx,
esxVI_DynamicProperty *dynamicProperty = NULL;
if (defaults == NULL || *defaults != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -3835,8 +3835,8 @@ esxVI_LookupAutoStartDefaults(esxVI_Context *ctx,
}
if (*defaults == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not retrieve the AutoStartDefaults object"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not retrieve the AutoStartDefaults object"));
goto cleanup;
}
@@ -3861,7 +3861,7 @@ esxVI_LookupAutoStartPowerInfoList(esxVI_Context *ctx,
esxVI_DynamicProperty *dynamicProperty = NULL;
if (powerInfoList == NULL || *powerInfoList != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -3916,7 +3916,7 @@ esxVI_HandleVirtualMachineQuestion
char *possibleAnswers = NULL;
if (blocked == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -3951,19 +3951,19 @@ esxVI_HandleVirtualMachineQuestion
if (autoAnswer) {
if (possibleAnswers == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Pending question blocks virtual machine execution,
"
- "question is '%s', no possible answers"),
- questionInfo->text);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Pending question blocks virtual machine execution,
"
+ "question is '%s', no possible answers"),
+ questionInfo->text);
*blocked = true;
goto cleanup;
} else if (answerChoice == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Pending question blocks virtual machine execution,
"
- "question is '%s', possible answers are %s, but
no "
- "default answer is specified"),
questionInfo->text,
- possibleAnswers);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Pending question blocks virtual machine execution,
"
+ "question is '%s', possible answers are %s, but
no "
+ "default answer is specified"),
questionInfo->text,
+ possibleAnswers);
*blocked = true;
goto cleanup;
@@ -3980,15 +3980,15 @@ esxVI_HandleVirtualMachineQuestion
}
} else {
if (possibleAnswers != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Pending question blocks virtual machine execution,
"
- "question is '%s', possible answers are
%s"),
- questionInfo->text, possibleAnswers);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Pending question blocks virtual machine execution,
"
+ "question is '%s', possible answers are
%s"),
+ questionInfo->text, possibleAnswers);
} else {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Pending question blocks virtual machine execution,
"
- "question is '%s', no possible answers"),
- questionInfo->text);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Pending question blocks virtual machine execution,
"
+ "question is '%s', no possible answers"),
+ questionInfo->text);
}
*blocked = true;
@@ -4035,7 +4035,7 @@ esxVI_WaitForTaskCompletion(esxVI_Context *ctx,
esxVI_TaskInfo *taskInfo = NULL;
if (errorMessage == NULL || *errorMessage != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -4249,9 +4249,9 @@ esxVI_ParseHostCpuIdInfo(esxVI_ParsedHostCpuIdInfo
*parsedHostCpuIdInfo,
for (r = 0; r < 4; ++r) {
if (strlen(input[r]) != expectedLength) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("HostCpuIdInfo register '%s' has an unexpected
length"),
- name[r]);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("HostCpuIdInfo register '%s' has an unexpected
length"),
+ name[r]);
return -1;
}
@@ -4263,9 +4263,9 @@ esxVI_ParseHostCpuIdInfo(esxVI_ParsedHostCpuIdInfo
*parsedHostCpuIdInfo,
output[r][o - 3] = input[r][i + 3];
if (i + 4 < expectedLength && input[r][i + 4] != ':') {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("HostCpuIdInfo register '%s' has an
unexpected format"),
- name[r]);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("HostCpuIdInfo register '%s' has an
unexpected format"),
+ name[r]);
return -1;
}
}
@@ -4314,8 +4314,8 @@ esxVI_ProductVersionToDefaultVirtualHWVersion(esxVI_ProductVersion
productVersio
return 8;
default:
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unexpected product version"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Unexpected product version"));
return -1;
}
}
@@ -4382,8 +4382,8 @@ esxVI_ProductVersionToDefaultVirtualHWVersion(esxVI_ProductVersion
productVersio
esxVI_DynamicProperty *dynamicProperty = NULL; \
\
if (ptrptr == NULL || *ptrptr != NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
\
- _("Invalid argument"));
\
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
\
+ _("Invalid argument")); \
return -1; \
} \
\
@@ -4463,13 +4463,13 @@ esxVI_LookupManagedObjectHelper(esxVI_Context *ctx,
if (objectContent == NULL || *objectContent != NULL ||
objectContentList == NULL || *objectContentList != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
if (!esxVI_String_ListContainsValue(propertyNameList, "name")) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Missing 'name' property in %s lookup"), type);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing 'name' property in %s lookup"),
type);
goto cleanup;
}
@@ -4501,8 +4501,8 @@ esxVI_LookupManagedObjectHelper(esxVI_Context *ctx,
if (candidate == NULL) {
if (occurrence != esxVI_Occurrence_OptionalItem) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not find %s with name '%s'"), type,
name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not find %s with name '%s'"), type,
name);
goto cleanup;
}
diff --git a/src/esx/esx_vi.h b/src/esx/esx_vi.h
index 9560bd2..44ba4d1 100644
--- a/src/esx/esx_vi.h
+++ b/src/esx/esx_vi.h
@@ -35,13 +35,6 @@
# include "esx_util.h"
-
-# define ESX_VI_ERROR(code, ...) \
- virReportErrorHelper(VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
- __LINE__, __VA_ARGS__)
-
-
-
# define ESX_VI__SOAP__REQUEST_HEADER \
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
\
"<soapenv:Envelope\n"
\
diff --git a/src/esx/esx_vi_methods.c b/src/esx/esx_vi_methods.c
index 1f1780f..77588c2 100644
--- a/src/esx/esx_vi_methods.c
+++ b/src/esx/esx_vi_methods.c
@@ -41,7 +41,7 @@
#define ESX_VI__METHOD__CHECK_OUTPUT__NotNone \
if (output == NULL || *output != 0) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument")); \
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument")); \
return -1; \
}
@@ -162,7 +162,7 @@
esxVI_##_type *_this = NULL; \
\
if (ctx->service == NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
call")); \
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
call")); \
return -1; \
} \
\
@@ -183,9 +183,9 @@
*/
#define ESX_VI__METHOD__PARAMETER__REQUIRE(_name) \
if (_name == 0) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- "Required parameter '%s' is missing for call to
%s", \
- #_name, methodName); \
+ virReportError(VIR_ERR_INTERNAL_ERROR, \
+ "Required parameter '%s' is missing for call to
%s", \
+ #_name, methodName); \
return -1; \
}
@@ -237,7 +237,7 @@ esxVI_RetrieveServiceContent(esxVI_Context *ctx,
esxVI_Response *response = NULL;
if (serviceContent == NULL || *serviceContent != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
index bcc310f..850f10e 100644
--- a/src/esx/esx_vi_types.c
+++ b/src/esx/esx_vi_types.c
@@ -81,8 +81,8 @@
\
if (item->_type <= esxVI_Type_Undefined || \
item->_type >= esxVI_Type_Other) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- _("%s object has invalid dynamic type"), typeName);
\
+ virReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("%s object has invalid dynamic type"),
typeName);\
return -1; \
} \
\
@@ -98,8 +98,8 @@
esxVI_##_type##_DeepCopy(esxVI_##_type **dest, esxVI_##_type *src) \
{ \
if (dest == NULL || *dest != NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
\
- _("Invalid argument"));
\
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
\
+ _("Invalid argument"));
\
return -1; \
} \
\
@@ -192,8 +192,8 @@
_dest_type *item ATTRIBUTE_UNUSED; \
\
if (anyType == NULL || ptrptr == NULL || *ptrptr != NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
\
- _("Invalid argument"));
\
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
\
+ _("Invalid argument"));
\
return -1; \
} \
\
@@ -211,9 +211,9 @@
ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE_EXTRA(_type, esxVI_##_type, \
{ \
if (anyType->type != esxVI_Type_##_type) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- _("Call to %s for unexpected type '%s'"),
\
- __FUNCTION__, anyType->other); \
+ virReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("Call to %s for unexpected type '%s'"),
\
+ __FUNCTION__, anyType->other); \
return -1; \
} \
}, /* nothing */)
@@ -224,9 +224,9 @@
ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE_EXTRA(_type, _value_type, \
{ \
if (anyType->type != esxVI_Type_##_type) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- _("Call to %s for unexpected type '%s'"),
\
- __FUNCTION__, anyType->other); \
+ virReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("Call to %s for unexpected type '%s'"),
\
+ __FUNCTION__, anyType->other); \
return -1; \
} \
}, Value)
@@ -239,8 +239,8 @@
const char *element, virBufferPtr output) \
{ \
if (element == NULL || output == NULL ) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
\
- _("Invalid argument"));
\
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
\
+ _("Invalid argument"));
\
return -1; \
} \
\
@@ -281,8 +281,8 @@
_extra1 \
\
if (ptrptr == NULL || *ptrptr != NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
\
- _("Invalid argument"));
\
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
\
+ _("Invalid argument"));
\
return -1; \
} \
\
@@ -295,8 +295,8 @@
for (childNode = node->children; childNode != NULL; \
childNode = childNode->next) { \
if (childNode->type != XML_ELEMENT_NODE) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- _("Wrong XML element type %d"),
childNode->type);\
+ virReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("Wrong XML element type %d"),
childNode->type); \
goto failure; \
} \
\
@@ -334,8 +334,8 @@
long long value; \
\
if (number == NULL || *number != NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
\
- _("Invalid argument"));
\
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
\
+ _("Invalid argument"));
\
return -1; \
} \
\
@@ -346,23 +346,23 @@
string = (char *)xmlNodeListGetString(node->doc, node->children, 1); \
\
if (string == NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- _("XML node doesn't contain text, expecting an %s
" \
- "value"), _xsdType);
\
+ virReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("XML node doesn't contain text, expecting an %s
"\
+ "value"), _xsdType);
\
goto cleanup; \
} \
\
if (virStrToLong_ll(string, NULL, 10, &value) < 0) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- _("Unknown value '%s' for %s"), string,
_xsdType); \
+ virReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("Unknown value '%s' for %s"), string,
_xsdType); \
goto cleanup; \
} \
\
if (((_min) != INT64_MIN && value < (_min))
\
|| ((_max) != INT64_MAX && value > (_max))) {
\
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- _("Value '%s' is not representable as %s"),
\
- string, _xsdType); \
+ virReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("Value '%s' is not representable as %s"),
\
+ string, _xsdType); \
goto cleanup; \
} \
\
@@ -485,9 +485,9 @@
*/
#define ESX_VI__TEMPLATE__PROPERTY__REQUIRE(_name) \
if (item->_name == 0) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- _("%s object is missing the required '%s'
property"), \
- typeName, #_name); \
+ virReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("%s object is missing the required '%s'
property"), \
+ typeName, #_name); \
return -1; \
}
@@ -542,9 +542,9 @@
break; \
\
default: \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- _("Call to %s for unexpected type '%s'"),
__FUNCTION__, \
- esxVI_Type_ToString(_actual_type)); \
+ virReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("Call to %s for unexpected type '%s'"),
__FUNCTION__,\
+ esxVI_Type_ToString(_actual_type)); \
return _error_return; \
}
@@ -604,8 +604,8 @@
esxVI_##__type##_DynamicCast(void *item) \
{ \
if (item == NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
\
- _("Invalid argument"));
\
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
\
+ _("Invalid argument"));
\
return NULL; \
} \
\
@@ -648,9 +648,9 @@
break; \
\
default: \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- _("Call to %s for unexpected type '%s'"),
\
- __FUNCTION__, esxVI_Type_ToString(type)); \
+ virReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("Call to %s for unexpected type '%s'"),
\
+ __FUNCTION__, esxVI_Type_ToString(type)); \
return -1; \
}, \
/* nothing */, \
@@ -666,7 +666,7 @@ esxVI_GetActualObjectType(xmlNodePtr node, esxVI_Type baseType,
char *type = NULL;
if (actualType == NULL || *actualType != esxVI_Type_Undefined) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -675,18 +675,18 @@ esxVI_GetActualObjectType(xmlNodePtr node, esxVI_Type baseType,
BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");
if (type == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("%s is missing 'type' property"),
- esxVI_Type_ToString(baseType));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s is missing 'type' property"),
+ esxVI_Type_ToString(baseType));
return -1;
}
*actualType = esxVI_Type_FromString(type);
if (*actualType == esxVI_Type_Undefined) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Unknown value '%s' for %s 'type'
property"),
- type, esxVI_Type_ToString(baseType));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unknown value '%s' for %s 'type'
property"),
+ type, esxVI_Type_ToString(baseType));
goto cleanup;
}
@@ -709,9 +709,9 @@ esxVI_GetActualObjectType(xmlNodePtr node, esxVI_Type baseType,
* unselected properties. */ \
if (item->_name == 0 &&
\
esxVI_String_ListContainsValue(selectedPropertyNameList, #_name)) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- _("%s object is missing the required '%s'
property"), \
- typeName, #_name); \
+ virReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("%s object is missing the required '%s'
property"), \
+ typeName, #_name); \
return -1; \
}
@@ -726,8 +726,8 @@ esxVI_GetActualObjectType(xmlNodePtr node, esxVI_Type baseType,
\
if (item->_type <= esxVI_Type_Undefined || \
item->_type >= esxVI_Type_Other) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- _("%s object has invalid dynamic type"), typeName);
\
+ virReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("%s object has invalid dynamic type"),
typeName);\
return -1; \
} \
\
@@ -866,10 +866,10 @@ int
esxVI_AnyType_ExpectType(esxVI_AnyType *anyType, esxVI_Type type)
{
if (anyType->type != type) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Expecting type '%s' but found '%s'"),
- esxVI_Type_ToString(type),
- anyType->type != esxVI_Type_Other
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Expecting type '%s' but found
'%s'"),
+ esxVI_Type_ToString(type),
+ anyType->type != esxVI_Type_Other
? esxVI_Type_ToString(anyType->type)
: anyType->other);
return -1;
@@ -882,7 +882,7 @@ int
esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
{
if (dest == NULL || *dest != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -898,8 +898,8 @@ esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
(*dest)->node = xmlCopyNode(src->node, 1);
if ((*dest)->node == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not copy an XML node"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not copy an XML node"));
goto failure;
}
@@ -949,7 +949,7 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
long long int number;
if (anyType == NULL || *anyType != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -960,8 +960,8 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
(*anyType)->node = xmlCopyNode(node, 1);
if ((*anyType)->node == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not copy an XML node"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not copy an XML node"));
goto failure;
}
@@ -971,17 +971,17 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");
if ((*anyType)->other == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("AnyType is missing 'type' property"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("AnyType is missing 'type' property"));
goto failure;
}
(*anyType)->type = esxVI_Type_FromString((*anyType)->other);
if ((*anyType)->type == esxVI_Type_Undefined) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Unknown value '%s' for AnyType 'type'
property"),
- (*anyType)->other);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unknown value '%s' for AnyType 'type'
property"),
+ (*anyType)->other);
goto failure;
}
@@ -1000,17 +1000,17 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType
**anyType)
#define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max) \
do { \
if (virStrToLong_ll((*anyType)->value, NULL, 10, &number) < 0) {
\
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- _("Unknown value '%s' for %s"),
\
- (*anyType)->value, _xsdType); \
+ virReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("Unknown value '%s' for %s"),
\
+ (*anyType)->value, _xsdType); \
goto failure; \
} \
\
if (((_min) != INT64_MIN && number < (_min))
\
|| ((_max) != INT64_MAX && number > (_max))) {
\
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- _("Value '%s' is out of %s range"),
\
- (*anyType)->value, _xsdType); \
+ virReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("Value '%s' is out of %s range"),
\
+ (*anyType)->value, _xsdType); \
goto failure; \
} \
\
@@ -1024,9 +1024,9 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
} else if (STREQ((*anyType)->value, "false")) {
(*anyType)->boolean = esxVI_Boolean_False;
} else {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Unknown value '%s' for xsd:boolean"),
- (*anyType)->value);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unknown value '%s' for xsd:boolean"),
+ (*anyType)->value);
goto failure;
}
@@ -1170,7 +1170,7 @@ int
esxVI_String_DeepCopyValue(char **dest, const char *src)
{
if (dest == NULL || *dest != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1210,7 +1210,7 @@ esxVI_String_SerializeValue(const char *value, const char *element,
virBufferPtr output)
{
if (element == NULL || output == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1240,7 +1240,7 @@ int
esxVI_String_DeserializeValue(xmlNodePtr node, char **value)
{
if (value == NULL || *value != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1374,7 +1374,7 @@ int
esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime)
{
if (dateTime == NULL || *dateTime != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1386,9 +1386,9 @@ esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime
**dateTime)
(char *)xmlNodeListGetString(node->doc, node->children, 1);
if ((*dateTime)->value == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("XML node doesn't contain text, expecting an "
- "xsd:dateTime value"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("XML node doesn't contain text, expecting an "
+ "xsd:dateTime value"));
goto failure;
}
@@ -1414,14 +1414,14 @@ esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime,
int tz_offset = 0;
if (dateTime == NULL || secondsSinceEpoch == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
if (virStrcpyStatic(value, dateTime->value) == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("xsd:dateTime value '%s' too long for
destination"),
- dateTime->value);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("xsd:dateTime value '%s' too long for
destination"),
+ dateTime->value);
return -1;
}
@@ -1441,9 +1441,9 @@ esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime,
tmp = strptime(value, "%Y-%m-%dT%H:%M:%S", &tm);
if (tmp == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("xsd:dateTime value '%s' has unexpected
format"),
- dateTime->value);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("xsd:dateTime value '%s' has unexpected
format"),
+ dateTime->value);
return -1;
}
@@ -1451,9 +1451,9 @@ esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime,
/* skip .ssssss part if present */
if (*tmp == '.' &&
virStrToLong_i(tmp + 1, &tmp, 10, &milliseconds) < 0) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("xsd:dateTime value '%s' has unexpected
format"),
- dateTime->value);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("xsd:dateTime value '%s' has unexpected
format"),
+ dateTime->value);
return -1;
}
@@ -1464,9 +1464,9 @@ esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime,
if (virStrToLong_i(tmp + 1, &tmp, 10, &tz_hours) < 0 ||
*tmp != ':' ||
virStrToLong_i(tmp + 1, NULL, 10, &tz_minutes) < 0) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("xsd:dateTime value '%s' has unexpected
format"),
- dateTime->value);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("xsd:dateTime value '%s' has unexpected
format"),
+ dateTime->value);
return -1;
}
@@ -1478,9 +1478,9 @@ esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime,
} else if (STREQ(tmp, "Z")) {
/* Z refers to UTC. tz_offset is already initialized to zero */
} else {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("xsd:dateTime value '%s' has unexpected
format"),
- dateTime->value);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("xsd:dateTime value '%s' has unexpected
format"),
+ dateTime->value);
return -1;
}
}
@@ -1548,7 +1548,7 @@ int
esxVI_MethodFault_Deserialize(xmlNodePtr node, esxVI_MethodFault **methodFault)
{
if (methodFault == NULL || *methodFault != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1561,8 +1561,8 @@ esxVI_MethodFault_Deserialize(xmlNodePtr node, esxVI_MethodFault
**methodFault)
BAD_CAST
"http://www.w3.org/2001/XMLSchema-instance");
if ((*methodFault)->_actualType == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("MethodFault is missing 'type' property"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("MethodFault is missing 'type' property"));
goto failure;
}
@@ -1614,7 +1614,7 @@ esxVI_ManagedObjectReference_Serialize
const char *element, virBufferPtr output)
{
if (element == NULL || output == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1644,7 +1644,7 @@ esxVI_ManagedObjectReference_Deserialize
(xmlNodePtr node, esxVI_ManagedObjectReference **managedObjectReference)
{
if (managedObjectReference == NULL || *managedObjectReference != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
return -1;
}
@@ -1656,8 +1656,8 @@ esxVI_ManagedObjectReference_Deserialize
(char *)xmlGetNoNsProp(node, BAD_CAST "type");
if ((*managedObjectReference)->type == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("ManagedObjectReference is missing 'type'
property"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("ManagedObjectReference is missing 'type'
property"));
goto failure;
}
@@ -1734,9 +1734,9 @@ ESX_VI__TEMPLATE__DESERIALIZE_EXTRA(Event, /* nothing */,
BAD_CAST
"http://www.w3.org/2001/XMLSchema-instance");
if ((*ptrptr)->_actualType == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("%s is missing 'type' property"),
- esxVI_Type_ToString((*ptrptr)->_type));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s is missing 'type' property"),
+ esxVI_Type_ToString((*ptrptr)->_type));
goto failure;
}
},
--
1.7.10.4