# |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
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;
}
}
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;
}
}
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;
}
}
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;
}
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;
}
"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;
}
}
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;
}
} 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;
}
}
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;
}
: 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;
}
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;
}
}
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;
}
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;
}
}
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;
}
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;
}
}
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;
}
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;
}
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;
}
/* 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;
}
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 {
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;
}
}
}
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;
}
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;
}
}
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;
}
}
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;
}
}
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;
}
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 {
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;
}
}
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:
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
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;
}
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;
}
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;
}
}
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;
}
}
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;
}
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;
}
}
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;
}
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;
}
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;
}
}
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;
}
}
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;
}
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;
}
* 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;
}
}
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;
}
}
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;
}
}
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;
}
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;
}
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;
}
}
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;
}
}
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;
}
}
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;
}
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;
}
}
}
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;
}
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;
}
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;
}
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;
}
* 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;
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
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;
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
# 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;
} 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;
}
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;
}
} 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) {
* 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;
}
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;
}
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;
}
}
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;
}
}
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;
}
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;
}
*/
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;
}
}
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;
}
}
}
} 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;
}
}
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;
}
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;
}
}
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;
}
}
}
} 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;
}
}
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;
}
}
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;
}
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;
}
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;
}
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")) {
} 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;
}
} 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;
}
} 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;
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;
}
&(*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;
}
}
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;
}
/* 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;
}
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;
}
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;
}
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;
}
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;
}
&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;
}
&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;
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;
}
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;
}
}
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;
}
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;
}
* small things such as VMX of VMDK metadata files.
*/
if (*length > INT32_MAX / 2) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Download length it too large"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Download length it too large"));
return -1;
}
if (responseCode < 0) {
goto cleanup;
} else if (responseCode != 200 && responseCode != 206) {
- 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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
}
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;
}
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;
}
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;
}
}
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;
}
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;
}
}
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;
}
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;
}
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") ||
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")) {
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;
}
}
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;
}
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;
}
}
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;
}
/* 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;
}
}
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;
}
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;
}
}
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;
}
}
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;
}
}
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;
}
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;
}
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]]]]",
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
}
}
- 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;
}
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;
}
}
if (name == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
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;
}
}
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);
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;
}
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;
}
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;
}
}
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;
}
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;
}
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;
}
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;
}
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;
}
* 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;
}
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;
}
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;
}
}
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;
}
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") ||
} 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")) {
} 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;
}
}
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;
}
}
}
- 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;
}
}
}
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Missing 'runtime.powerState' property"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Missing 'runtime.powerState' property"));
return -1;
}
esxVI_DynamicProperty *dynamicProperty;
if (questionInfo == NULL || *questionInfo != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
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;
}
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;
}
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;
}
}
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;
}
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;
}
}
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;
}
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;
}
}
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;
}
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;
}
}
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;
}
}
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;
}
}
}
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 {
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;
}
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;
}
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;
}
}
}
- 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;
}
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;
}
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;
}
}
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;
}
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;
}
}
}
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;
}
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;
}
}
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;
}
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;
}
}
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;
}
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;
}
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
}
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;
}
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;
}
}
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;
}
}
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;
}
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;
}
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;
}
}
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;
}
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;
}
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;
}
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;
}
} 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;
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;
}
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;
}
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;
}
}
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;
}
}
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; \
} \
\
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;
}
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;
}
# 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" \
#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; \
}
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; \
} \
\
*/
#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; \
}
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;
}
\
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; \
} \
\
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; \
} \
\
_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; \
} \
\
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 */)
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)
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; \
} \
\
_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; \
} \
\
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; \
} \
\
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; \
} \
\
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; \
} \
\
*/
#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; \
}
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; \
}
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; \
} \
\
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 */, \
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;
}
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;
}
* 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; \
}
\
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; \
} \
\
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;
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;
}
(*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;
}
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;
}
(*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;
}
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;
}
#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; \
} \
\
} 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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
(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;
}
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;
}
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;
}
/* 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;
}
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;
}
} 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;
}
}
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;
}
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;
}
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;
}
(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;
}
(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;
}
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;
}
},