mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
Replace use of ESX_ERROR & ESX_VI_ERROR with virReportError
Update the ESX driver to use virReportError instead of the ESX_ERROR & ESX_VI_ERROR custom macros Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
7f4ed3ec99
commit
cf8cff035c
2
cfg.mk
2
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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
630
src/esx/esx_vi.c
630
src/esx/esx_vi.c
File diff suppressed because it is too large
Load Diff
@ -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" \
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
@ -1231,7 +1231,7 @@ int
|
||||
esxVI_String_Deserialize(xmlNodePtr node, esxVI_String **string)
|
||||
{
|
||||
if (string == NULL || *string != NULL) {
|
||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1255,7 +1255,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;
|
||||
}
|
||||
|
||||
@ -1389,7 +1389,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;
|
||||
}
|
||||
|
||||
@ -1401,9 +1401,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;
|
||||
}
|
||||
|
||||
@ -1429,14 +1429,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;
|
||||
}
|
||||
|
||||
@ -1456,9 +1456,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;
|
||||
}
|
||||
|
||||
@ -1466,9 +1466,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;
|
||||
}
|
||||
|
||||
@ -1479,9 +1479,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;
|
||||
}
|
||||
|
||||
@ -1493,9 +1493,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;
|
||||
}
|
||||
}
|
||||
@ -1563,7 +1563,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;
|
||||
}
|
||||
|
||||
@ -1576,8 +1576,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;
|
||||
}
|
||||
|
||||
@ -1629,7 +1629,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;
|
||||
}
|
||||
|
||||
@ -1659,7 +1659,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;
|
||||
}
|
||||
|
||||
@ -1671,8 +1671,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;
|
||||
}
|
||||
|
||||
@ -1749,9 +1749,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;
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user