mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Replace use of ESX_ERROR & ESX_VI_ERROR with virReportError
Update the ESX driver to use virReportError instead of the ESX_ERROR & ESX_VI_ERROR custom macros Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
7f4ed3ec99
commit
cf8cff035c
2
cfg.mk
2
cfg.mk
@ -506,8 +506,6 @@ sc_avoid_attribute_unused_in_header:
|
|||||||
# |grep -vE '^(qsort|if|close|assert|fputc|free|N_|vir.*GetName|.*Unlock|virNodeListDevices|virHashRemoveEntry|freeaddrinfo|.*[fF]ree|xdrmem_create|xmlXPathFreeObject|virUUIDFormat|openvzSetProgramSentinal|polkit_action_unref)$'
|
# |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 =
|
||||||
msg_gen_function += ESX_ERROR
|
|
||||||
msg_gen_function += ESX_VI_ERROR
|
|
||||||
msg_gen_function += HYPERV_ERROR
|
msg_gen_function += HYPERV_ERROR
|
||||||
msg_gen_function += PHYP_ERROR
|
msg_gen_function += PHYP_ERROR
|
||||||
msg_gen_function += VIR_ERROR
|
msg_gen_function += VIR_ERROR
|
||||||
|
@ -213,9 +213,9 @@ esxParseVMXFileName(const char *fileName, void *opaque)
|
|||||||
if ((tmp = STRSKIP(copyOfFileName, "/vmfs/volumes/")) == NULL ||
|
if ((tmp = STRSKIP(copyOfFileName, "/vmfs/volumes/")) == NULL ||
|
||||||
(datastoreName = strtok_r(tmp, "/", &saveptr)) == NULL ||
|
(datastoreName = strtok_r(tmp, "/", &saveptr)) == NULL ||
|
||||||
(directoryAndFileName = strtok_r(NULL, "", &saveptr)) == NULL) {
|
(directoryAndFileName = strtok_r(NULL, "", &saveptr)) == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("File name '%s' doesn't have expected format "
|
_("File name '%s' doesn't have expected format "
|
||||||
"'/vmfs/volumes/<datastore>/<path>'"), fileName);
|
"'/vmfs/volumes/<datastore>/<path>'"), fileName);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,9 +228,9 @@ esxParseVMXFileName(const char *fileName, void *opaque)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (datastoreList == NULL) {
|
if (datastoreList == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("File name '%s' refers to non-existing datastore '%s'"),
|
_("File name '%s' refers to non-existing datastore '%s'"),
|
||||||
fileName, datastoreName);
|
fileName, datastoreName);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,8 +250,8 @@ esxParseVMXFileName(const char *fileName, void *opaque)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not handle file name '%s'"), fileName);
|
_("Could not handle file name '%s'"), fileName);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -352,8 +352,8 @@ esxFormatVMXFileName(const char *fileName, void *opaque)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not handle file name '%s'"), fileName);
|
_("Could not handle file name '%s'"), fileName);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -407,8 +407,8 @@ esxAutodetectSCSIControllerModel(virDomainDiskDefPtr def, int *model,
|
|||||||
vmDiskFileInfo = esxVI_VmDiskFileInfo_DynamicCast(fileInfo);
|
vmDiskFileInfo = esxVI_VmDiskFileInfo_DynamicCast(fileInfo);
|
||||||
|
|
||||||
if (vmDiskFileInfo == NULL || vmDiskFileInfo->controllerType == NULL) {
|
if (vmDiskFileInfo == NULL || vmDiskFileInfo->controllerType == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not lookup controller model for '%s'"), def->src);
|
_("Could not lookup controller model for '%s'"), def->src);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,9 +425,9 @@ esxAutodetectSCSIControllerModel(virDomainDiskDefPtr def, int *model,
|
|||||||
"ParaVirtualSCSIController")) {
|
"ParaVirtualSCSIController")) {
|
||||||
*model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI;
|
*model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI;
|
||||||
} else {
|
} else {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Found unexpected controller model '%s' for disk '%s'"),
|
_("Found unexpected controller model '%s' for disk '%s'"),
|
||||||
vmDiskFileInfo->controllerType, def->src);
|
vmDiskFileInfo->controllerType, def->src);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,8 +468,8 @@ esxSupportsLongMode(esxPrivate *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hostSystem == NULL) {
|
if (hostSystem == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Could not retrieve the HostSystem object"));
|
_("Could not retrieve the HostSystem object"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,11 +496,11 @@ esxSupportsLongMode(esxPrivate *priv)
|
|||||||
} else if (edxLongModeBit == '0') {
|
} else if (edxLongModeBit == '0') {
|
||||||
priv->supportsLongMode = esxVI_Boolean_False;
|
priv->supportsLongMode = esxVI_Boolean_False;
|
||||||
} else {
|
} else {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Bit 29 (Long Mode) of HostSystem property "
|
_("Bit 29 (Long Mode) of HostSystem property "
|
||||||
"'hardware.cpuFeature[].edx' with value '%s' "
|
"'hardware.cpuFeature[].edx' with value '%s' "
|
||||||
"has unexpected value '%c', expecting '0' "
|
"has unexpected value '%c', expecting '0' "
|
||||||
"or '1'"), hostCpuIdInfo->edx, edxLongModeBit);
|
"or '1'"), hostCpuIdInfo->edx, edxLongModeBit);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,8 +548,8 @@ esxLookupHostSystemBiosUuid(esxPrivate *priv, unsigned char *uuid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hostSystem == NULL) {
|
if (hostSystem == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Could not retrieve the HostSystem object"));
|
_("Could not retrieve the HostSystem object"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -686,7 +686,7 @@ esxConnectToHost(virConnectPtr conn,
|
|||||||
: esxVI_ProductVersion_GSX;
|
: esxVI_ProductVersion_GSX;
|
||||||
|
|
||||||
if (vCenterIpAddress == NULL || *vCenterIpAddress != NULL) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,7 +705,7 @@ esxConnectToHost(virConnectPtr conn,
|
|||||||
username = virAuthGetUsername(conn, auth, "esx", "root", conn->uri->server);
|
username = virAuthGetUsername(conn, auth, "esx", "root", conn->uri->server);
|
||||||
|
|
||||||
if (username == NULL) {
|
if (username == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed"));
|
virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -713,7 +713,7 @@ esxConnectToHost(virConnectPtr conn,
|
|||||||
unescapedPassword = virAuthGetPassword(conn, auth, "esx", username, conn->uri->server);
|
unescapedPassword = virAuthGetPassword(conn, auth, "esx", username, conn->uri->server);
|
||||||
|
|
||||||
if (unescapedPassword == NULL) {
|
if (unescapedPassword == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed"));
|
virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -743,15 +743,15 @@ esxConnectToHost(virConnectPtr conn,
|
|||||||
priv->host->productVersion != esxVI_ProductVersion_ESX4x &&
|
priv->host->productVersion != esxVI_ProductVersion_ESX4x &&
|
||||||
priv->host->productVersion != esxVI_ProductVersion_ESX50 &&
|
priv->host->productVersion != esxVI_ProductVersion_ESX50 &&
|
||||||
priv->host->productVersion != esxVI_ProductVersion_ESX5x) {
|
priv->host->productVersion != esxVI_ProductVersion_ESX5x) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("%s is neither an ESX 3.5, 4.x nor 5.x host"),
|
_("%s is neither an ESX 3.5, 4.x nor 5.x host"),
|
||||||
conn->uri->server);
|
conn->uri->server);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else { /* GSX */
|
} else { /* GSX */
|
||||||
if (priv->host->productVersion != esxVI_ProductVersion_GSX20) {
|
if (priv->host->productVersion != esxVI_ProductVersion_GSX20) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("%s isn't a GSX 2.0 host"), conn->uri->server);
|
_("%s isn't a GSX 2.0 host"), conn->uri->server);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -816,8 +816,8 @@ esxConnectToVCenter(virConnectPtr conn,
|
|||||||
|
|
||||||
if (hostSystemIpAddress == NULL &&
|
if (hostSystemIpAddress == NULL &&
|
||||||
(priv->parsedUri->path == NULL || STREQ(priv->parsedUri->path, "/"))) {
|
(priv->parsedUri->path == NULL || STREQ(priv->parsedUri->path, "/"))) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("Path has to specify the datacenter and compute resource"));
|
_("Path has to specify the datacenter and compute resource"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -836,7 +836,7 @@ esxConnectToVCenter(virConnectPtr conn,
|
|||||||
username = virAuthGetUsername(conn, auth, "esx", "administrator", hostname);
|
username = virAuthGetUsername(conn, auth, "esx", "administrator", hostname);
|
||||||
|
|
||||||
if (username == NULL) {
|
if (username == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed"));
|
virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -844,7 +844,7 @@ esxConnectToVCenter(virConnectPtr conn,
|
|||||||
unescapedPassword = virAuthGetPassword(conn, auth, "esx", username, hostname);
|
unescapedPassword = virAuthGetPassword(conn, auth, "esx", username, hostname);
|
||||||
|
|
||||||
if (unescapedPassword == NULL) {
|
if (unescapedPassword == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed"));
|
virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -872,9 +872,9 @@ esxConnectToVCenter(virConnectPtr conn,
|
|||||||
priv->vCenter->productVersion != esxVI_ProductVersion_VPX4x &&
|
priv->vCenter->productVersion != esxVI_ProductVersion_VPX4x &&
|
||||||
priv->vCenter->productVersion != esxVI_ProductVersion_VPX50 &&
|
priv->vCenter->productVersion != esxVI_ProductVersion_VPX50 &&
|
||||||
priv->vCenter->productVersion != esxVI_ProductVersion_VPX5x) {
|
priv->vCenter->productVersion != esxVI_ProductVersion_VPX5x) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("%s is neither a vCenter 2.5, 4.x nor 5.x server"),
|
_("%s is neither a vCenter 2.5, 4.x nor 5.x server"),
|
||||||
hostname);
|
hostname);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -982,9 +982,9 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Transport '%s' in URI scheme is not supported, try again "
|
_("Transport '%s' in URI scheme is not supported, try again "
|
||||||
"without the transport part"), plus + 1);
|
"without the transport part"), plus + 1);
|
||||||
return VIR_DRV_OPEN_ERROR;
|
return VIR_DRV_OPEN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -996,15 +996,15 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
|
|
||||||
/* Require server part */
|
/* Require server part */
|
||||||
if (conn->uri->server == NULL) {
|
if (conn->uri->server == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("URI is missing the server part"));
|
_("URI is missing the server part"));
|
||||||
return VIR_DRV_OPEN_ERROR;
|
return VIR_DRV_OPEN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Require auth */
|
/* Require auth */
|
||||||
if (auth == NULL || auth->cb == NULL) {
|
if (auth == NULL || auth->cb == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("Missing or invalid auth pointer"));
|
_("Missing or invalid auth pointer"));
|
||||||
return VIR_DRV_OPEN_ERROR;
|
return VIR_DRV_OPEN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1060,16 +1060,16 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
if (priv->parsedUri->vCenter != NULL) {
|
if (priv->parsedUri->vCenter != NULL) {
|
||||||
if (STREQ(priv->parsedUri->vCenter, "*")) {
|
if (STREQ(priv->parsedUri->vCenter, "*")) {
|
||||||
if (potentialVCenterIpAddress == NULL) {
|
if (potentialVCenterIpAddress == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("This host is not managed by a vCenter"));
|
_("This host is not managed by a vCenter"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virStrcpyStatic(vCenterIpAddress,
|
if (virStrcpyStatic(vCenterIpAddress,
|
||||||
potentialVCenterIpAddress) == NULL) {
|
potentialVCenterIpAddress) == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("vCenter IP address %s too big for destination"),
|
_("vCenter IP address %s too big for destination"),
|
||||||
potentialVCenterIpAddress);
|
potentialVCenterIpAddress);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1080,12 +1080,12 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
|
|
||||||
if (potentialVCenterIpAddress != NULL &&
|
if (potentialVCenterIpAddress != NULL &&
|
||||||
STRNEQ(vCenterIpAddress, potentialVCenterIpAddress)) {
|
STRNEQ(vCenterIpAddress, potentialVCenterIpAddress)) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("This host is managed by a vCenter with IP "
|
_("This host is managed by a vCenter with IP "
|
||||||
"address %s, but a mismachting vCenter '%s' "
|
"address %s, but a mismachting vCenter '%s' "
|
||||||
"(%s) has been specified"),
|
"(%s) has been specified"),
|
||||||
potentialVCenterIpAddress, priv->parsedUri->vCenter,
|
potentialVCenterIpAddress, priv->parsedUri->vCenter,
|
||||||
vCenterIpAddress);
|
vCenterIpAddress);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1181,8 +1181,8 @@ esxSupportsVMotion(esxPrivate *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hostSystem == NULL) {
|
if (hostSystem == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Could not retrieve the HostSystem object"));
|
_("Could not retrieve the HostSystem object"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1245,9 +1245,9 @@ esxGetVersion(virConnectPtr conn, unsigned long *version)
|
|||||||
|
|
||||||
if (virParseVersionString(priv->primary->service->about->version,
|
if (virParseVersionString(priv->primary->service->about->version,
|
||||||
version, false) < 0) {
|
version, false) < 0) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not parse version number from '%s'"),
|
_("Could not parse version number from '%s'"),
|
||||||
priv->primary->service->about->version);
|
priv->primary->service->about->version);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1282,8 +1282,8 @@ esxGetHostname(virConnectPtr conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hostSystem == NULL) {
|
if (hostSystem == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Could not retrieve the HostSystem object"));
|
_("Could not retrieve the HostSystem object"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1311,8 +1311,8 @@ esxGetHostname(virConnectPtr conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hostName == NULL || strlen(hostName) < 1) {
|
if (hostName == NULL || strlen(hostName) < 1) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Missing or empty 'hostName' property"));
|
_("Missing or empty 'hostName' property"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1380,8 +1380,8 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hostSystem == NULL) {
|
if (hostSystem == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Could not retrieve the HostSystem object"));
|
_("Could not retrieve the HostSystem object"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1461,9 +1461,9 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
|
|||||||
if (virStrncpy(nodeinfo->model, dynamicProperty->val->string,
|
if (virStrncpy(nodeinfo->model, dynamicProperty->val->string,
|
||||||
sizeof(nodeinfo->model) - 1,
|
sizeof(nodeinfo->model) - 1,
|
||||||
sizeof(nodeinfo->model)) == NULL) {
|
sizeof(nodeinfo->model)) == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("CPU Model %s too long for destination"),
|
_("CPU Model %s too long for destination"),
|
||||||
dynamicProperty->val->string);
|
dynamicProperty->val->string);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1550,9 +1550,9 @@ esxListDomains(virConnectPtr conn, int *ids, int maxids)
|
|||||||
if (esxUtil_ParseVirtualMachineIDString(virtualMachine->obj->value,
|
if (esxUtil_ParseVirtualMachineIDString(virtualMachine->obj->value,
|
||||||
&ids[count]) < 0 ||
|
&ids[count]) < 0 ||
|
||||||
ids[count] <= 0) {
|
ids[count] <= 0) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Failed to parse positive integer from '%s'"),
|
_("Failed to parse positive integer from '%s'"),
|
||||||
virtualMachine->obj->value);
|
virtualMachine->obj->value);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1652,7 +1652,7 @@ esxDomainLookupByID(virConnectPtr conn, int id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (domain == NULL) {
|
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:
|
cleanup:
|
||||||
@ -1740,7 +1740,7 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (virtualMachine == NULL) {
|
if (virtualMachine == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_NO_DOMAIN, _("No domain with name '%s'"), name);
|
virReportError(VIR_ERR_NO_DOMAIN, _("No domain with name '%s'"), name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1797,8 +1797,8 @@ esxDomainSuspend(virDomainPtr domain)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
|
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
|
||||||
ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
_("Domain is not powered on"));
|
_("Domain is not powered on"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1811,8 +1811,8 @@ esxDomainSuspend(virDomainPtr domain)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not suspend domain: %s"),
|
virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not suspend domain: %s"),
|
||||||
taskInfoErrorMessage);
|
taskInfoErrorMessage);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1855,7 +1855,7 @@ esxDomainResume(virDomainPtr domain)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (powerState != esxVI_VirtualMachinePowerState_Suspended) {
|
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;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1869,8 +1869,8 @@ esxDomainResume(virDomainPtr domain)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not resume domain: %s"),
|
virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not resume domain: %s"),
|
||||||
taskInfoErrorMessage);
|
taskInfoErrorMessage);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1912,8 +1912,8 @@ esxDomainShutdownFlags(virDomainPtr domain, unsigned int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
|
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
|
||||||
ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
_("Domain is not powered on"));
|
_("Domain is not powered on"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1963,8 +1963,8 @@ esxDomainReboot(virDomainPtr domain, unsigned int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
|
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
|
||||||
ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
_("Domain is not powered on"));
|
_("Domain is not powered on"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2019,8 +2019,8 @@ esxDomainDestroyFlags(virDomainPtr domain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
|
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
|
||||||
ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
_("Domain is not powered on"));
|
_("Domain is not powered on"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2033,8 +2033,8 @@ esxDomainDestroyFlags(virDomainPtr domain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not destroy domain: %s"),
|
virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not destroy domain: %s"),
|
||||||
taskInfoErrorMessage);
|
taskInfoErrorMessage);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2103,9 +2103,9 @@ esxDomainGetMaxMemory(virDomainPtr domain)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dynamicProperty->val->int32 < 0) {
|
if (dynamicProperty->val->int32 < 0) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Got invalid memory size %d"),
|
_("Got invalid memory size %d"),
|
||||||
dynamicProperty->val->int32);
|
dynamicProperty->val->int32);
|
||||||
} else {
|
} else {
|
||||||
memoryMB = dynamicProperty->val->int32;
|
memoryMB = dynamicProperty->val->int32;
|
||||||
}
|
}
|
||||||
@ -2152,8 +2152,8 @@ esxDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
|
if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
|
||||||
ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
_("Domain is not powered off"));
|
_("Domain is not powered off"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2176,9 +2176,9 @@ esxDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not set max-memory to %lu kilobytes: %s"), memory,
|
_("Could not set max-memory to %lu kilobytes: %s"), memory,
|
||||||
taskInfoErrorMessage);
|
taskInfoErrorMessage);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2233,9 +2233,9 @@ esxDomainSetMemory(virDomainPtr domain, unsigned long memory)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not set memory to %lu kilobytes: %s"), memory,
|
_("Could not set memory to %lu kilobytes: %s"), memory,
|
||||||
taskInfoErrorMessage);
|
taskInfoErrorMessage);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2469,9 +2469,9 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
|
|||||||
esxVI_PerfEntityMetric_DynamicCast(perfEntityMetricBase);
|
esxVI_PerfEntityMetric_DynamicCast(perfEntityMetricBase);
|
||||||
|
|
||||||
if (perfEntityMetric == NULL) {
|
if (perfEntityMetric == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("QueryPerf returned object with unexpected type '%s'"),
|
_("QueryPerf returned object with unexpected type '%s'"),
|
||||||
esxVI_Type_ToString(perfEntityMetricBase->_type));
|
esxVI_Type_ToString(perfEntityMetricBase->_type));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2479,9 +2479,9 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
|
|||||||
esxVI_PerfMetricIntSeries_DynamicCast(perfEntityMetric->value);
|
esxVI_PerfMetricIntSeries_DynamicCast(perfEntityMetric->value);
|
||||||
|
|
||||||
if (perfMetricIntSeries == NULL) {
|
if (perfMetricIntSeries == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("QueryPerf returned object with unexpected type '%s'"),
|
_("QueryPerf returned object with unexpected type '%s'"),
|
||||||
esxVI_Type_ToString(perfEntityMetric->value->_type));
|
esxVI_Type_ToString(perfEntityMetric->value->_type));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2597,13 +2597,13 @@ esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
|
|||||||
char *taskInfoErrorMessage = NULL;
|
char *taskInfoErrorMessage = NULL;
|
||||||
|
|
||||||
if (flags != VIR_DOMAIN_AFFECT_LIVE) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nvcpus < 1) {
|
if (nvcpus < 1) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("Requested number of virtual CPUs must at least be 1"));
|
_("Requested number of virtual CPUs must at least be 1"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2618,10 +2618,10 @@ esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nvcpus > maxVcpus) {
|
if (nvcpus > maxVcpus) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Requested number of virtual CPUs is greater than max "
|
_("Requested number of virtual CPUs is greater than max "
|
||||||
"allowable number of virtual CPUs for the domain: %d > %d"),
|
"allowable number of virtual CPUs for the domain: %d > %d"),
|
||||||
nvcpus, maxVcpus);
|
nvcpus, maxVcpus);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2645,9 +2645,9 @@ esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not set number of virtual CPUs to %d: %s"), nvcpus,
|
_("Could not set number of virtual CPUs to %d: %s"), nvcpus,
|
||||||
taskInfoErrorMessage);
|
taskInfoErrorMessage);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2681,7 +2681,7 @@ esxDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
|||||||
esxVI_DynamicProperty *dynamicProperty = NULL;
|
esxVI_DynamicProperty *dynamicProperty = NULL;
|
||||||
|
|
||||||
if (flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2703,8 +2703,8 @@ esxDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hostSystem == NULL) {
|
if (hostSystem == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Could not retrieve the HostSystem object"));
|
_("Could not retrieve the HostSystem object"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2873,8 +2873,8 @@ esxDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat,
|
|||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
|
|
||||||
if (STRNEQ(nativeFormat, "vmware-vmx")) {
|
if (STRNEQ(nativeFormat, "vmware-vmx")) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Unsupported config format '%s'"), nativeFormat);
|
_("Unsupported config format '%s'"), nativeFormat);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2916,8 +2916,8 @@ esxDomainXMLToNative(virConnectPtr conn, const char *nativeFormat,
|
|||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
|
|
||||||
if (STRNEQ(nativeFormat, "vmware-vmx")) {
|
if (STRNEQ(nativeFormat, "vmware-vmx")) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Unsupported config format '%s'"), nativeFormat);
|
_("Unsupported config format '%s'"), nativeFormat);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3069,8 +3069,8 @@ esxDomainCreateWithFlags(virDomainPtr domain, unsigned int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
|
if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
|
||||||
ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
_("Domain is not powered off"));
|
_("Domain is not powered off"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3084,8 +3084,8 @@ esxDomainCreateWithFlags(virDomainPtr domain, unsigned int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not start domain: %s"),
|
virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not start domain: %s"),
|
||||||
taskInfoErrorMessage);
|
taskInfoErrorMessage);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3167,9 +3167,9 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
|
|||||||
|
|
||||||
if (virtualMachine != NULL) {
|
if (virtualMachine != NULL) {
|
||||||
/* FIXME */
|
/* FIXME */
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Domain already exists, editing existing domains is not "
|
_("Domain already exists, editing existing domains is not "
|
||||||
"supported yet"));
|
"supported yet"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3203,9 +3203,9 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
|
|||||||
* datastore isn't perfect but should work in the majority of cases.
|
* datastore isn't perfect but should work in the majority of cases.
|
||||||
*/
|
*/
|
||||||
if (def->ndisks < 1) {
|
if (def->ndisks < 1) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Domain XML doesn't contain any disks, cannot deduce "
|
_("Domain XML doesn't contain any disks, cannot deduce "
|
||||||
"datastore and path for VMX file"));
|
"datastore and path for VMX file"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3218,16 +3218,16 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (disk == NULL) {
|
if (disk == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Domain XML doesn't contain any file-based harddisks, "
|
_("Domain XML doesn't contain any file-based harddisks, "
|
||||||
"cannot deduce datastore and path for VMX file"));
|
"cannot deduce datastore and path for VMX file"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disk->src == NULL) {
|
if (disk->src == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("First file-based harddisk has no source, cannot deduce "
|
_("First file-based harddisk has no source, cannot deduce "
|
||||||
"datastore and path for VMX file"));
|
"datastore and path for VMX file"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3237,9 +3237,9 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! virFileHasSuffix(disk->src, ".vmdk")) {
|
if (! virFileHasSuffix(disk->src, ".vmdk")) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Expecting source '%s' of first file-based harddisk to "
|
_("Expecting source '%s' of first file-based harddisk to "
|
||||||
"be a VMDK image"), disk->src);
|
"be a VMDK image"), disk->src);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3308,8 +3308,8 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not define domain: %s"),
|
virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not define domain: %s"),
|
||||||
taskInfoErrorMessage);
|
taskInfoErrorMessage);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3382,8 +3382,8 @@ esxDomainUndefineFlags(virDomainPtr domain,
|
|||||||
|
|
||||||
if (powerState != esxVI_VirtualMachinePowerState_Suspended &&
|
if (powerState != esxVI_VirtualMachinePowerState_Suspended &&
|
||||||
powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
|
powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
|
||||||
ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
_("Domain is not suspended or powered off"));
|
_("Domain is not suspended or powered off"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3528,9 +3528,9 @@ esxDomainSetAutostart(virDomainPtr domain, int autostart)
|
|||||||
for (powerInfo = powerInfoList; powerInfo != NULL;
|
for (powerInfo = powerInfoList; powerInfo != NULL;
|
||||||
powerInfo = powerInfo->_next) {
|
powerInfo = powerInfo->_next) {
|
||||||
if (STRNEQ(powerInfo->key->value, virtualMachine->obj->value)) {
|
if (STRNEQ(powerInfo->key->value, virtualMachine->obj->value)) {
|
||||||
ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
_("Cannot enable general autostart option "
|
_("Cannot enable general autostart option "
|
||||||
"without affecting other domains"));
|
"without affecting other domains"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3735,9 +3735,9 @@ esxDomainGetSchedulerParametersFlags(virDomainPtr domain,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Shares level has unknown value %d"),
|
_("Shares level has unknown value %d"),
|
||||||
(int)sharesInfo->level);
|
(int)sharesInfo->level);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3813,9 +3813,9 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (params[i].value.l < 0) {
|
if (params[i].value.l < 0) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Could not set reservation to %lld MHz, expecting "
|
_("Could not set reservation to %lld MHz, expecting "
|
||||||
"positive value"), params[i].value.l);
|
"positive value"), params[i].value.l);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3826,10 +3826,10 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (params[i].value.l < -1) {
|
if (params[i].value.l < -1) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Could not set limit to %lld MHz, expecting "
|
_("Could not set limit to %lld MHz, expecting "
|
||||||
"positive value or -1 (unlimited)"),
|
"positive value or -1 (unlimited)"),
|
||||||
params[i].value.l);
|
params[i].value.l);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3865,10 +3865,10 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Could not set shares to %d, expecting positive "
|
_("Could not set shares to %d, expecting positive "
|
||||||
"value or -1 (low), -2 (normal) or -3 (high)"),
|
"value or -1 (low), -2 (normal) or -3 (high)"),
|
||||||
params[i].value.i);
|
params[i].value.i);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3885,9 +3885,9 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not change scheduler parameters: %s"),
|
_("Could not change scheduler parameters: %s"),
|
||||||
taskInfoErrorMessage);
|
taskInfoErrorMessage);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3971,14 +3971,14 @@ esxDomainMigratePerform(virDomainPtr domain,
|
|||||||
virCheckFlags(ESX_MIGRATION_FLAGS, -1);
|
virCheckFlags(ESX_MIGRATION_FLAGS, -1);
|
||||||
|
|
||||||
if (priv->vCenter == NULL) {
|
if (priv->vCenter == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("Migration not possible without a vCenter"));
|
_("Migration not possible without a vCenter"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dname != NULL) {
|
if (dname != NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("Renaming domains on migration not supported"));
|
_("Renaming domains on migration not supported"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3991,15 +3991,15 @@ esxDomainMigratePerform(virDomainPtr domain,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (parsedUri->scheme == NULL || STRCASENEQ(parsedUri->scheme, "vpxmigr")) {
|
if (parsedUri->scheme == NULL || STRCASENEQ(parsedUri->scheme, "vpxmigr")) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("Only vpxmigr:// migration URIs are supported"));
|
_("Only vpxmigr:// migration URIs are supported"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (STRCASENEQ(priv->vCenter->ipAddress, parsedUri->server)) {
|
if (STRCASENEQ(priv->vCenter->ipAddress, parsedUri->server)) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("Migration source and destination have to refer to "
|
_("Migration source and destination have to refer to "
|
||||||
"the same vCenter"));
|
"the same vCenter"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4007,8 +4007,8 @@ esxDomainMigratePerform(virDomainPtr domain,
|
|||||||
path_hostSystem = strtok_r(NULL, "", &saveptr);
|
path_hostSystem = strtok_r(NULL, "", &saveptr);
|
||||||
|
|
||||||
if (path_resourcePool == NULL || path_hostSystem == NULL) {
|
if (path_resourcePool == NULL || path_hostSystem == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("Migration URI has to specify resource pool and host system"));
|
_("Migration URI has to specify resource pool and host system"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4042,13 +4042,13 @@ esxDomainMigratePerform(virDomainPtr domain,
|
|||||||
* to the first event for now.
|
* to the first event for now.
|
||||||
*/
|
*/
|
||||||
if (eventList->fullFormattedMessage != NULL) {
|
if (eventList->fullFormattedMessage != NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not migrate domain, validation reported a "
|
_("Could not migrate domain, validation reported a "
|
||||||
"problem: %s"), eventList->fullFormattedMessage);
|
"problem: %s"), eventList->fullFormattedMessage);
|
||||||
} else {
|
} else {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Could not migrate domain, validation reported a "
|
_("Could not migrate domain, validation reported a "
|
||||||
"problem"));
|
"problem"));
|
||||||
}
|
}
|
||||||
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -4068,10 +4068,10 @@ esxDomainMigratePerform(virDomainPtr domain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not migrate domain, migration task finished with "
|
_("Could not migrate domain, migration task finished with "
|
||||||
"an error: %s"),
|
"an error: %s"),
|
||||||
taskInfoErrorMessage);
|
taskInfoErrorMessage);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4143,8 +4143,8 @@ esxNodeGetFreeMemory(virConnectPtr conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (resourcePoolResourceUsage == NULL) {
|
if (resourcePoolResourceUsage == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Could not retrieve memory usage of resource pool"));
|
_("Could not retrieve memory usage of resource pool"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4324,8 +4324,8 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (def->ndisks) {
|
if (def->ndisks) {
|
||||||
ESX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("disk snapshots not supported yet"));
|
_("disk snapshots not supported yet"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4341,8 +4341,8 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (snapshotTree != NULL) {
|
if (snapshotTree != NULL) {
|
||||||
ESX_ERROR(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
_("Snapshot '%s' already exists"), def->name);
|
_("Snapshot '%s' already exists"), def->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4358,8 +4358,8 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not create snapshot: %s"),
|
virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not create snapshot: %s"),
|
||||||
taskInfoErrorMessage);
|
taskInfoErrorMessage);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4486,7 +4486,7 @@ esxDomainSnapshotListNames(virDomainPtr domain, char **names, int nameslen,
|
|||||||
leaves = (flags & VIR_DOMAIN_SNAPSHOT_LIST_LEAVES) != 0;
|
leaves = (flags & VIR_DOMAIN_SNAPSHOT_LIST_LEAVES) != 0;
|
||||||
|
|
||||||
if (names == NULL || nameslen < 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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4579,7 +4579,7 @@ esxDomainSnapshotListChildrenNames(virDomainSnapshotPtr snapshot,
|
|||||||
leaves = (flags & VIR_DOMAIN_SNAPSHOT_LIST_LEAVES) != 0;
|
leaves = (flags & VIR_DOMAIN_SNAPSHOT_LIST_LEAVES) != 0;
|
||||||
|
|
||||||
if (names == NULL || nameslen < 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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4701,9 +4701,9 @@ esxDomainSnapshotGetParent(virDomainSnapshotPtr snapshot, unsigned int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!snapshotTreeParent) {
|
if (!snapshotTreeParent) {
|
||||||
ESX_ERROR(VIR_ERR_NO_DOMAIN_SNAPSHOT,
|
virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
|
||||||
_("snapshot '%s' does not have a parent"),
|
_("snapshot '%s' does not have a parent"),
|
||||||
snapshotTree->name);
|
snapshotTree->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4849,9 +4849,9 @@ esxDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, unsigned int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not revert to snapshot '%s': %s"), snapshot->name,
|
_("Could not revert to snapshot '%s': %s"), snapshot->name,
|
||||||
taskInfoErrorMessage);
|
taskInfoErrorMessage);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4915,9 +4915,9 @@ esxDomainSnapshotDelete(virDomainSnapshotPtr snapshot, unsigned int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not delete snapshot '%s': %s"), snapshot->name,
|
_("Could not delete snapshot '%s': %s"), snapshot->name,
|
||||||
taskInfoErrorMessage);
|
taskInfoErrorMessage);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4986,9 +4986,9 @@ esxDomainSetMemoryParameters(virDomainPtr domain, virTypedParameterPtr params,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not change memory parameters: %s"),
|
_("Could not change memory parameters: %s"),
|
||||||
taskInfoErrorMessage);
|
taskInfoErrorMessage);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,10 +28,6 @@
|
|||||||
# include "capabilities.h"
|
# include "capabilities.h"
|
||||||
# include "esx_vi.h"
|
# include "esx_vi.h"
|
||||||
|
|
||||||
# define ESX_ERROR(code, ...) \
|
|
||||||
virReportErrorHelper(VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
|
|
||||||
__LINE__, __VA_ARGS__)
|
|
||||||
|
|
||||||
typedef struct _esxPrivate {
|
typedef struct _esxPrivate {
|
||||||
esxVI_Context *primary; /* points to host or vCenter */
|
esxVI_Context *primary; /* points to host or vCenter */
|
||||||
esxVI_Context *host;
|
esxVI_Context *host;
|
||||||
|
@ -84,8 +84,8 @@ esxStoragePoolLookupType(esxVI_Context *ctx, const char *poolName,
|
|||||||
} else if (esxVI_VmfsDatastoreInfo_DynamicCast(datastoreInfo) != NULL) {
|
} else if (esxVI_VmfsDatastoreInfo_DynamicCast(datastoreInfo) != NULL) {
|
||||||
*poolType = VIR_STORAGE_POOL_FS;
|
*poolType = VIR_STORAGE_POOL_FS;
|
||||||
} else {
|
} else {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("DatastoreInfo has unexpected type"));
|
_("DatastoreInfo has unexpected type"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,9 +336,9 @@ esxStoragePoolLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
|
|||||||
if (datastore == NULL) {
|
if (datastore == NULL) {
|
||||||
virUUIDFormat(uuid, uuid_string);
|
virUUIDFormat(uuid, uuid_string);
|
||||||
|
|
||||||
ESX_VI_ERROR(VIR_ERR_NO_STORAGE_POOL,
|
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||||
_("Could not find datastore with UUID '%s'"),
|
_("Could not find datastore with UUID '%s'"),
|
||||||
uuid_string);
|
uuid_string);
|
||||||
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -557,9 +557,9 @@ esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
|
|||||||
} else if (STRCASEEQ(nasInfo->nas->type, "CIFS")) {
|
} else if (STRCASEEQ(nasInfo->nas->type, "CIFS")) {
|
||||||
def.source.format = VIR_STORAGE_POOL_NETFS_CIFS;
|
def.source.format = VIR_STORAGE_POOL_NETFS_CIFS;
|
||||||
} else {
|
} else {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Datastore has unexpected type '%s'"),
|
_("Datastore has unexpected type '%s'"),
|
||||||
nasInfo->nas->type);
|
nasInfo->nas->type);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else if (esxVI_VmfsDatastoreInfo_DynamicCast(info) != NULL) {
|
} else if (esxVI_VmfsDatastoreInfo_DynamicCast(info) != NULL) {
|
||||||
@ -569,8 +569,8 @@ esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
|
|||||||
* VMFS based datastore in libvirt terms
|
* VMFS based datastore in libvirt terms
|
||||||
*/
|
*/
|
||||||
} else {
|
} else {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("DatastoreInfo has unexpected type"));
|
_("DatastoreInfo has unexpected type"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -607,8 +607,8 @@ esxStoragePoolSetAutostart(virStoragePoolPtr pool ATTRIBUTE_UNUSED,
|
|||||||
autostart = (autostart != 0);
|
autostart = (autostart != 0);
|
||||||
|
|
||||||
if (! autostart) {
|
if (! autostart) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Cannot deactivate storage pool autostart"));
|
_("Cannot deactivate storage pool autostart"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -670,7 +670,7 @@ esxStoragePoolListStorageVolumes(virStoragePoolPtr pool, char **const names,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (names == NULL || maxnames < 0) {
|
if (names == NULL || maxnames < 0) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", _("Invalid argument"));
|
virReportError(VIR_ERR_INVALID_ARG, "%s", _("Invalid argument"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -837,9 +837,9 @@ esxStorageVolumeLookupByKey(virConnectPtr conn, const char *key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!priv->primary->hasQueryVirtualDiskUuid) {
|
if (!priv->primary->hasQueryVirtualDiskUuid) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("QueryVirtualDiskUuid not available, cannot lookup storage "
|
_("QueryVirtualDiskUuid not available, cannot lookup storage "
|
||||||
"volume by UUID"));
|
"volume by UUID"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -999,8 +999,8 @@ esxStorageVolumeCreateXML(virStoragePoolPtr pool, const char *xmldesc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (def->type != VIR_STORAGE_VOL_FILE) {
|
if (def->type != VIR_STORAGE_VOL_FILE) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Creating non-file volumes is not supported"));
|
_("Creating non-file volumes is not supported"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1008,16 +1008,16 @@ esxStorageVolumeCreateXML(virStoragePoolPtr pool, const char *xmldesc,
|
|||||||
tmp = strrchr(def->name, '/');
|
tmp = strrchr(def->name, '/');
|
||||||
|
|
||||||
if (tmp == NULL || *def->name == '/' || tmp[1] == '\0') {
|
if (tmp == NULL || *def->name == '/' || tmp[1] == '\0') {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Volume name '%s' doesn't have expected format "
|
_("Volume name '%s' doesn't have expected format "
|
||||||
"'<directory>/<file>'"), def->name);
|
"'<directory>/<file>'"), def->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! virFileHasSuffix(def->name, ".vmdk")) {
|
if (! virFileHasSuffix(def->name, ".vmdk")) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Volume name '%s' has unsupported suffix, expecting '.vmdk'"),
|
_("Volume name '%s' has unsupported suffix, expecting '.vmdk'"),
|
||||||
def->name);
|
def->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1095,8 +1095,8 @@ esxStorageVolumeCreateXML(virStoragePoolPtr pool, const char *xmldesc,
|
|||||||
*/
|
*/
|
||||||
virtualDiskSpec->diskType = (char *)"thin";
|
virtualDiskSpec->diskType = (char *)"thin";
|
||||||
} else {
|
} else {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Unsupported capacity-to-allocation relation"));
|
_("Unsupported capacity-to-allocation relation"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1122,8 +1122,8 @@ esxStorageVolumeCreateXML(virStoragePoolPtr pool, const char *xmldesc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not create volume: %s"),
|
virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not create volume: %s"),
|
||||||
taskInfoErrorMessage);
|
taskInfoErrorMessage);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1149,9 +1149,9 @@ esxStorageVolumeCreateXML(virStoragePoolPtr pool, const char *xmldesc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Creation of %s volumes is not supported"),
|
_("Creation of %s volumes is not supported"),
|
||||||
virStorageFileFormatTypeToString(def->target.format));
|
virStorageFileFormatTypeToString(def->target.format));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1233,8 +1233,8 @@ esxStorageVolumeCreateXMLFrom(virStoragePoolPtr pool, const char *xmldesc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (def->type != VIR_STORAGE_VOL_FILE) {
|
if (def->type != VIR_STORAGE_VOL_FILE) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Creating non-file volumes is not supported"));
|
_("Creating non-file volumes is not supported"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1242,16 +1242,16 @@ esxStorageVolumeCreateXMLFrom(virStoragePoolPtr pool, const char *xmldesc,
|
|||||||
tmp = strrchr(def->name, '/');
|
tmp = strrchr(def->name, '/');
|
||||||
|
|
||||||
if (tmp == NULL || *def->name == '/' || tmp[1] == '\0') {
|
if (tmp == NULL || *def->name == '/' || tmp[1] == '\0') {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Volume name '%s' doesn't have expected format "
|
_("Volume name '%s' doesn't have expected format "
|
||||||
"'<directory>/<file>'"), def->name);
|
"'<directory>/<file>'"), def->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! virFileHasSuffix(def->name, ".vmdk")) {
|
if (! virFileHasSuffix(def->name, ".vmdk")) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Volume name '%s' has unsupported suffix, expecting '.vmdk'"),
|
_("Volume name '%s' has unsupported suffix, expecting '.vmdk'"),
|
||||||
def->name);
|
def->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1324,8 +1324,8 @@ esxStorageVolumeCreateXMLFrom(virStoragePoolPtr pool, const char *xmldesc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not copy volume: %s"),
|
virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not copy volume: %s"),
|
||||||
taskInfoErrorMessage);
|
taskInfoErrorMessage);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1351,9 +1351,9 @@ esxStorageVolumeCreateXMLFrom(virStoragePoolPtr pool, const char *xmldesc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Creation of %s volumes is not supported"),
|
_("Creation of %s volumes is not supported"),
|
||||||
virStorageFileFormatTypeToString(def->target.format));
|
virStorageFileFormatTypeToString(def->target.format));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1412,8 +1412,8 @@ esxStorageVolumeDelete(virStorageVolPtr volume, unsigned int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not delete volume: %s"),
|
virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not delete volume: %s"),
|
||||||
taskInfoErrorMessage);
|
taskInfoErrorMessage);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1461,8 +1461,8 @@ esxStorageVolumeWipe(virStorageVolPtr volume, unsigned int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
if (taskInfoState != esxVI_TaskInfoState_Success) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not wipe volume: %s"),
|
virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not wipe volume: %s"),
|
||||||
taskInfoErrorMessage);
|
taskInfoErrorMessage);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1595,8 +1595,8 @@ esxStorageVolumeGetXMLDesc(virStorageVolPtr volume, unsigned int flags)
|
|||||||
|
|
||||||
def.target.format = VIR_STORAGE_FILE_RAW;
|
def.target.format = VIR_STORAGE_FILE_RAW;
|
||||||
} else {
|
} else {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("File '%s' has unknown type"), datastorePath);
|
_("File '%s' has unknown type"), datastorePath);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
|
|||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
if (parsedUri == NULL || *parsedUri != NULL) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,10 +74,10 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
|
|||||||
|
|
||||||
if (STRNEQ((*parsedUri)->transport, "http") &&
|
if (STRNEQ((*parsedUri)->transport, "http") &&
|
||||||
STRNEQ((*parsedUri)->transport, "https")) {
|
STRNEQ((*parsedUri)->transport, "https")) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Query parameter 'transport' has unexpected value "
|
_("Query parameter 'transport' has unexpected value "
|
||||||
"'%s' (should be http|https)"),
|
"'%s' (should be http|https)"),
|
||||||
(*parsedUri)->transport);
|
(*parsedUri)->transport);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else if (STRCASEEQ(queryParam->name, "vcenter")) {
|
} else if (STRCASEEQ(queryParam->name, "vcenter")) {
|
||||||
@ -92,9 +92,9 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
|
|||||||
} else if (STRCASEEQ(queryParam->name, "no_verify")) {
|
} else if (STRCASEEQ(queryParam->name, "no_verify")) {
|
||||||
if (virStrToLong_i(queryParam->value, NULL, 10, &noVerify) < 0 ||
|
if (virStrToLong_i(queryParam->value, NULL, 10, &noVerify) < 0 ||
|
||||||
(noVerify != 0 && noVerify != 1)) {
|
(noVerify != 0 && noVerify != 1)) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Query parameter 'no_verify' has unexpected value "
|
_("Query parameter 'no_verify' has unexpected value "
|
||||||
"'%s' (should be 0 or 1)"), queryParam->value);
|
"'%s' (should be 0 or 1)"), queryParam->value);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,9 +102,9 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
|
|||||||
} else if (STRCASEEQ(queryParam->name, "auto_answer")) {
|
} else if (STRCASEEQ(queryParam->name, "auto_answer")) {
|
||||||
if (virStrToLong_i(queryParam->value, NULL, 10, &autoAnswer) < 0 ||
|
if (virStrToLong_i(queryParam->value, NULL, 10, &autoAnswer) < 0 ||
|
||||||
(autoAnswer != 0 && autoAnswer != 1)) {
|
(autoAnswer != 0 && autoAnswer != 1)) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Query parameter 'auto_answer' has unexpected "
|
_("Query parameter 'auto_answer' has unexpected "
|
||||||
"value '%s' (should be 0 or 1)"), queryParam->value);
|
"value '%s' (should be 0 or 1)"), queryParam->value);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,10 +128,10 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
|
|||||||
} else if ((tmp = strstr(queryParam->value, "://")) != NULL) {
|
} else if ((tmp = strstr(queryParam->value, "://")) != NULL) {
|
||||||
*tmp = '\0';
|
*tmp = '\0';
|
||||||
|
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Query parameter 'proxy' contains unexpected "
|
_("Query parameter 'proxy' contains unexpected "
|
||||||
"type '%s' (should be (http|socks(|4|4a|5))"),
|
"type '%s' (should be (http|socks(|4|4a|5))"),
|
||||||
queryParam->value);
|
queryParam->value);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else {
|
} else {
|
||||||
tmp = queryParam->value;
|
tmp = queryParam->value;
|
||||||
@ -146,9 +146,9 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
|
|||||||
|
|
||||||
if ((tmp = strchr((*parsedUri)->proxy_hostname, ':')) != NULL) {
|
if ((tmp = strchr((*parsedUri)->proxy_hostname, ':')) != NULL) {
|
||||||
if (tmp == (*parsedUri)->proxy_hostname) {
|
if (tmp == (*parsedUri)->proxy_hostname) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("Query parameter 'proxy' doesn't contain a "
|
_("Query parameter 'proxy' doesn't contain a "
|
||||||
"hostname"));
|
"hostname"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,9 +158,9 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
|
|||||||
&(*parsedUri)->proxy_port) < 0 ||
|
&(*parsedUri)->proxy_port) < 0 ||
|
||||||
(*parsedUri)->proxy_port < 1 ||
|
(*parsedUri)->proxy_port < 1 ||
|
||||||
(*parsedUri)->proxy_port > 65535) {
|
(*parsedUri)->proxy_port > 65535) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Query parameter 'proxy' has unexpected port"
|
_("Query parameter 'proxy' has unexpected port"
|
||||||
"value '%s' (should be [1..65535])"), tmp);
|
"value '%s' (should be [1..65535])"), tmp);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -255,7 +255,7 @@ esxUtil_ParseDatastorePath(const char *datastorePath, char **datastoreName,
|
|||||||
if ((datastoreName != NULL && *datastoreName != NULL) ||
|
if ((datastoreName != NULL && *datastoreName != NULL) ||
|
||||||
(directoryName != NULL && *directoryName != NULL) ||
|
(directoryName != NULL && *directoryName != NULL) ||
|
||||||
(directoryAndFileName != NULL && *directoryAndFileName != NULL)) {
|
(directoryAndFileName != NULL && *directoryAndFileName != NULL)) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,9 +266,9 @@ esxUtil_ParseDatastorePath(const char *datastorePath, char **datastoreName,
|
|||||||
/* Expected format: '[<datastore>] <path>' where <path> is optional */
|
/* Expected format: '[<datastore>] <path>' where <path> is optional */
|
||||||
if ((tmp = STRSKIP(copyOfDatastorePath, "[")) == NULL || *tmp == ']' ||
|
if ((tmp = STRSKIP(copyOfDatastorePath, "[")) == NULL || *tmp == ']' ||
|
||||||
(preliminaryDatastoreName = strtok_r(tmp, "]", &saveptr)) == NULL) {
|
(preliminaryDatastoreName = strtok_r(tmp, "]", &saveptr)) == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Datastore path '%s' doesn't have expected format "
|
_("Datastore path '%s' doesn't have expected format "
|
||||||
"'[<datastore>] <path>'"), datastorePath);
|
"'[<datastore>] <path>'"), datastorePath);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,16 +349,16 @@ esxUtil_ResolveHostname(const char *hostname,
|
|||||||
errcode = getaddrinfo(hostname, NULL, &hints, &result);
|
errcode = getaddrinfo(hostname, NULL, &hints, &result);
|
||||||
|
|
||||||
if (errcode != 0) {
|
if (errcode != 0) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("IP address lookup for host '%s' failed: %s"), hostname,
|
_("IP address lookup for host '%s' failed: %s"), hostname,
|
||||||
gai_strerror(errcode));
|
gai_strerror(errcode));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("No IP address for host '%s' found: %s"), hostname,
|
_("No IP address for host '%s' found: %s"), hostname,
|
||||||
gai_strerror(errcode));
|
gai_strerror(errcode));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,9 +366,9 @@ esxUtil_ResolveHostname(const char *hostname,
|
|||||||
ipAddress_length, NULL, 0, NI_NUMERICHOST);
|
ipAddress_length, NULL, 0, NI_NUMERICHOST);
|
||||||
|
|
||||||
if (errcode != 0) {
|
if (errcode != 0) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Formatting IP address for host '%s' failed: %s"), hostname,
|
_("Formatting IP address for host '%s' failed: %s"), hostname,
|
||||||
gai_strerror(errcode));
|
gai_strerror(errcode));
|
||||||
freeaddrinfo(result);
|
freeaddrinfo(result);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -386,9 +386,9 @@ esxUtil_ReformatUuid(const char *input, char *output)
|
|||||||
unsigned char uuid[VIR_UUID_BUFLEN];
|
unsigned char uuid[VIR_UUID_BUFLEN];
|
||||||
|
|
||||||
if (virUUIDParse(input, uuid) < 0) {
|
if (virUUIDParse(input, uuid) < 0) {
|
||||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not parse UUID from string '%s'"),
|
_("Could not parse UUID from string '%s'"),
|
||||||
input);
|
input);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
630
src/esx/esx_vi.c
630
src/esx/esx_vi.c
File diff suppressed because it is too large
Load Diff
@ -35,13 +35,6 @@
|
|||||||
# include "esx_util.h"
|
# 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 \
|
# define ESX_VI__SOAP__REQUEST_HEADER \
|
||||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
|
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
|
||||||
"<soapenv:Envelope\n" \
|
"<soapenv:Envelope\n" \
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
#define ESX_VI__METHOD__CHECK_OUTPUT__NotNone \
|
#define ESX_VI__METHOD__CHECK_OUTPUT__NotNone \
|
||||||
if (output == NULL || *output != 0) { \
|
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; \
|
return -1; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +162,7 @@
|
|||||||
esxVI_##_type *_this = NULL; \
|
esxVI_##_type *_this = NULL; \
|
||||||
\
|
\
|
||||||
if (ctx->service == 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; \
|
return -1; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
@ -183,9 +183,9 @@
|
|||||||
*/
|
*/
|
||||||
#define ESX_VI__METHOD__PARAMETER__REQUIRE(_name) \
|
#define ESX_VI__METHOD__PARAMETER__REQUIRE(_name) \
|
||||||
if (_name == 0) { \
|
if (_name == 0) { \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
|
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||||
"Required parameter '%s' is missing for call to %s", \
|
"Required parameter '%s' is missing for call to %s", \
|
||||||
#_name, methodName); \
|
#_name, methodName); \
|
||||||
return -1; \
|
return -1; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ esxVI_RetrieveServiceContent(esxVI_Context *ctx,
|
|||||||
esxVI_Response *response = NULL;
|
esxVI_Response *response = NULL;
|
||||||
|
|
||||||
if (serviceContent == NULL || *serviceContent != NULL) {
|
if (serviceContent == NULL || *serviceContent != NULL) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,8 +81,8 @@
|
|||||||
\
|
\
|
||||||
if (item->_type <= esxVI_Type_Undefined || \
|
if (item->_type <= esxVI_Type_Undefined || \
|
||||||
item->_type >= esxVI_Type_Other) { \
|
item->_type >= esxVI_Type_Other) { \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
|
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||||
_("%s object has invalid dynamic type"), typeName); \
|
_("%s object has invalid dynamic type"), typeName);\
|
||||||
return -1; \
|
return -1; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
@ -98,8 +98,8 @@
|
|||||||
esxVI_##_type##_DeepCopy(esxVI_##_type **dest, esxVI_##_type *src) \
|
esxVI_##_type##_DeepCopy(esxVI_##_type **dest, esxVI_##_type *src) \
|
||||||
{ \
|
{ \
|
||||||
if (dest == NULL || *dest != NULL) { \
|
if (dest == NULL || *dest != NULL) { \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \
|
||||||
_("Invalid argument")); \
|
_("Invalid argument")); \
|
||||||
return -1; \
|
return -1; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
@ -192,8 +192,8 @@
|
|||||||
_dest_type *item ATTRIBUTE_UNUSED; \
|
_dest_type *item ATTRIBUTE_UNUSED; \
|
||||||
\
|
\
|
||||||
if (anyType == NULL || ptrptr == NULL || *ptrptr != NULL) { \
|
if (anyType == NULL || ptrptr == NULL || *ptrptr != NULL) { \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \
|
||||||
_("Invalid argument")); \
|
_("Invalid argument")); \
|
||||||
return -1; \
|
return -1; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
@ -211,9 +211,9 @@
|
|||||||
ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE_EXTRA(_type, esxVI_##_type, \
|
ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE_EXTRA(_type, esxVI_##_type, \
|
||||||
{ \
|
{ \
|
||||||
if (anyType->type != esxVI_Type_##_type) { \
|
if (anyType->type != esxVI_Type_##_type) { \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
|
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||||
_("Call to %s for unexpected type '%s'"), \
|
_("Call to %s for unexpected type '%s'"), \
|
||||||
__FUNCTION__, anyType->other); \
|
__FUNCTION__, anyType->other); \
|
||||||
return -1; \
|
return -1; \
|
||||||
} \
|
} \
|
||||||
}, /* nothing */)
|
}, /* nothing */)
|
||||||
@ -224,9 +224,9 @@
|
|||||||
ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE_EXTRA(_type, _value_type, \
|
ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE_EXTRA(_type, _value_type, \
|
||||||
{ \
|
{ \
|
||||||
if (anyType->type != esxVI_Type_##_type) { \
|
if (anyType->type != esxVI_Type_##_type) { \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
|
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||||
_("Call to %s for unexpected type '%s'"), \
|
_("Call to %s for unexpected type '%s'"), \
|
||||||
__FUNCTION__, anyType->other); \
|
__FUNCTION__, anyType->other); \
|
||||||
return -1; \
|
return -1; \
|
||||||
} \
|
} \
|
||||||
}, Value)
|
}, Value)
|
||||||
@ -239,8 +239,8 @@
|
|||||||
const char *element, virBufferPtr output) \
|
const char *element, virBufferPtr output) \
|
||||||
{ \
|
{ \
|
||||||
if (element == NULL || output == NULL ) { \
|
if (element == NULL || output == NULL ) { \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \
|
||||||
_("Invalid argument")); \
|
_("Invalid argument")); \
|
||||||
return -1; \
|
return -1; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
@ -281,8 +281,8 @@
|
|||||||
_extra1 \
|
_extra1 \
|
||||||
\
|
\
|
||||||
if (ptrptr == NULL || *ptrptr != NULL) { \
|
if (ptrptr == NULL || *ptrptr != NULL) { \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \
|
||||||
_("Invalid argument")); \
|
_("Invalid argument")); \
|
||||||
return -1; \
|
return -1; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
@ -295,8 +295,8 @@
|
|||||||
for (childNode = node->children; childNode != NULL; \
|
for (childNode = node->children; childNode != NULL; \
|
||||||
childNode = childNode->next) { \
|
childNode = childNode->next) { \
|
||||||
if (childNode->type != XML_ELEMENT_NODE) { \
|
if (childNode->type != XML_ELEMENT_NODE) { \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
|
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||||
_("Wrong XML element type %d"), childNode->type);\
|
_("Wrong XML element type %d"), childNode->type); \
|
||||||
goto failure; \
|
goto failure; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
@ -334,8 +334,8 @@
|
|||||||
long long value; \
|
long long value; \
|
||||||
\
|
\
|
||||||
if (number == NULL || *number != NULL) { \
|
if (number == NULL || *number != NULL) { \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \
|
||||||
_("Invalid argument")); \
|
_("Invalid argument")); \
|
||||||
return -1; \
|
return -1; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
@ -346,23 +346,23 @@
|
|||||||
string = (char *)xmlNodeListGetString(node->doc, node->children, 1); \
|
string = (char *)xmlNodeListGetString(node->doc, node->children, 1); \
|
||||||
\
|
\
|
||||||
if (string == NULL) { \
|
if (string == NULL) { \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
|
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||||
_("XML node doesn't contain text, expecting an %s " \
|
_("XML node doesn't contain text, expecting an %s "\
|
||||||
"value"), _xsdType); \
|
"value"), _xsdType); \
|
||||||
goto cleanup; \
|
goto cleanup; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
if (virStrToLong_ll(string, NULL, 10, &value) < 0) { \
|
if (virStrToLong_ll(string, NULL, 10, &value) < 0) { \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
|
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||||
_("Unknown value '%s' for %s"), string, _xsdType); \
|
_("Unknown value '%s' for %s"), string, _xsdType); \
|
||||||
goto cleanup; \
|
goto cleanup; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
if (((_min) != INT64_MIN && value < (_min)) \
|
if (((_min) != INT64_MIN && value < (_min)) \
|
||||||
|| ((_max) != INT64_MAX && value > (_max))) { \
|
|| ((_max) != INT64_MAX && value > (_max))) { \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
|
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||||
_("Value '%s' is not representable as %s"), \
|
_("Value '%s' is not representable as %s"), \
|
||||||
string, _xsdType); \
|
string, _xsdType); \
|
||||||
goto cleanup; \
|
goto cleanup; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
@ -485,9 +485,9 @@
|
|||||||
*/
|
*/
|
||||||
#define ESX_VI__TEMPLATE__PROPERTY__REQUIRE(_name) \
|
#define ESX_VI__TEMPLATE__PROPERTY__REQUIRE(_name) \
|
||||||
if (item->_name == 0) { \
|
if (item->_name == 0) { \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
|
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||||
_("%s object is missing the required '%s' property"), \
|
_("%s object is missing the required '%s' property"), \
|
||||||
typeName, #_name); \
|
typeName, #_name); \
|
||||||
return -1; \
|
return -1; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,9 +542,9 @@
|
|||||||
break; \
|
break; \
|
||||||
\
|
\
|
||||||
default: \
|
default: \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
|
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||||
_("Call to %s for unexpected type '%s'"), __FUNCTION__, \
|
_("Call to %s for unexpected type '%s'"), __FUNCTION__,\
|
||||||
esxVI_Type_ToString(_actual_type)); \
|
esxVI_Type_ToString(_actual_type)); \
|
||||||
return _error_return; \
|
return _error_return; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -604,8 +604,8 @@
|
|||||||
esxVI_##__type##_DynamicCast(void *item) \
|
esxVI_##__type##_DynamicCast(void *item) \
|
||||||
{ \
|
{ \
|
||||||
if (item == NULL) { \
|
if (item == NULL) { \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \
|
||||||
_("Invalid argument")); \
|
_("Invalid argument")); \
|
||||||
return NULL; \
|
return NULL; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
@ -648,9 +648,9 @@
|
|||||||
break; \
|
break; \
|
||||||
\
|
\
|
||||||
default: \
|
default: \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
|
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||||
_("Call to %s for unexpected type '%s'"), \
|
_("Call to %s for unexpected type '%s'"), \
|
||||||
__FUNCTION__, esxVI_Type_ToString(type)); \
|
__FUNCTION__, esxVI_Type_ToString(type)); \
|
||||||
return -1; \
|
return -1; \
|
||||||
}, \
|
}, \
|
||||||
/* nothing */, \
|
/* nothing */, \
|
||||||
@ -666,7 +666,7 @@ esxVI_GetActualObjectType(xmlNodePtr node, esxVI_Type baseType,
|
|||||||
char *type = NULL;
|
char *type = NULL;
|
||||||
|
|
||||||
if (actualType == NULL || *actualType != esxVI_Type_Undefined) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -675,18 +675,18 @@ esxVI_GetActualObjectType(xmlNodePtr node, esxVI_Type baseType,
|
|||||||
BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");
|
BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");
|
||||||
|
|
||||||
if (type == NULL) {
|
if (type == NULL) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("%s is missing 'type' property"),
|
_("%s is missing 'type' property"),
|
||||||
esxVI_Type_ToString(baseType));
|
esxVI_Type_ToString(baseType));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*actualType = esxVI_Type_FromString(type);
|
*actualType = esxVI_Type_FromString(type);
|
||||||
|
|
||||||
if (*actualType == esxVI_Type_Undefined) {
|
if (*actualType == esxVI_Type_Undefined) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unknown value '%s' for %s 'type' property"),
|
_("Unknown value '%s' for %s 'type' property"),
|
||||||
type, esxVI_Type_ToString(baseType));
|
type, esxVI_Type_ToString(baseType));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -709,9 +709,9 @@ esxVI_GetActualObjectType(xmlNodePtr node, esxVI_Type baseType,
|
|||||||
* unselected properties. */ \
|
* unselected properties. */ \
|
||||||
if (item->_name == 0 && \
|
if (item->_name == 0 && \
|
||||||
esxVI_String_ListContainsValue(selectedPropertyNameList, #_name)) { \
|
esxVI_String_ListContainsValue(selectedPropertyNameList, #_name)) { \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
|
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||||
_("%s object is missing the required '%s' property"), \
|
_("%s object is missing the required '%s' property"), \
|
||||||
typeName, #_name); \
|
typeName, #_name); \
|
||||||
return -1; \
|
return -1; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -726,8 +726,8 @@ esxVI_GetActualObjectType(xmlNodePtr node, esxVI_Type baseType,
|
|||||||
\
|
\
|
||||||
if (item->_type <= esxVI_Type_Undefined || \
|
if (item->_type <= esxVI_Type_Undefined || \
|
||||||
item->_type >= esxVI_Type_Other) { \
|
item->_type >= esxVI_Type_Other) { \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
|
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||||
_("%s object has invalid dynamic type"), typeName); \
|
_("%s object has invalid dynamic type"), typeName);\
|
||||||
return -1; \
|
return -1; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
@ -866,10 +866,10 @@ int
|
|||||||
esxVI_AnyType_ExpectType(esxVI_AnyType *anyType, esxVI_Type type)
|
esxVI_AnyType_ExpectType(esxVI_AnyType *anyType, esxVI_Type type)
|
||||||
{
|
{
|
||||||
if (anyType->type != type) {
|
if (anyType->type != type) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Expecting type '%s' but found '%s'"),
|
_("Expecting type '%s' but found '%s'"),
|
||||||
esxVI_Type_ToString(type),
|
esxVI_Type_ToString(type),
|
||||||
anyType->type != esxVI_Type_Other
|
anyType->type != esxVI_Type_Other
|
||||||
? esxVI_Type_ToString(anyType->type)
|
? esxVI_Type_ToString(anyType->type)
|
||||||
: anyType->other);
|
: anyType->other);
|
||||||
return -1;
|
return -1;
|
||||||
@ -882,7 +882,7 @@ int
|
|||||||
esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
|
esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
|
||||||
{
|
{
|
||||||
if (dest == NULL || *dest != NULL) {
|
if (dest == NULL || *dest != NULL) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -898,8 +898,8 @@ esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
|
|||||||
(*dest)->node = xmlCopyNode(src->node, 1);
|
(*dest)->node = xmlCopyNode(src->node, 1);
|
||||||
|
|
||||||
if ((*dest)->node == NULL) {
|
if ((*dest)->node == NULL) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Could not copy an XML node"));
|
_("Could not copy an XML node"));
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -949,7 +949,7 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
|
|||||||
long long int number;
|
long long int number;
|
||||||
|
|
||||||
if (anyType == NULL || *anyType != NULL) {
|
if (anyType == NULL || *anyType != NULL) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -960,8 +960,8 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
|
|||||||
(*anyType)->node = xmlCopyNode(node, 1);
|
(*anyType)->node = xmlCopyNode(node, 1);
|
||||||
|
|
||||||
if ((*anyType)->node == NULL) {
|
if ((*anyType)->node == NULL) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Could not copy an XML node"));
|
_("Could not copy an XML node"));
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -971,17 +971,17 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
|
|||||||
BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");
|
BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");
|
||||||
|
|
||||||
if ((*anyType)->other == NULL) {
|
if ((*anyType)->other == NULL) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("AnyType is missing 'type' property"));
|
_("AnyType is missing 'type' property"));
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*anyType)->type = esxVI_Type_FromString((*anyType)->other);
|
(*anyType)->type = esxVI_Type_FromString((*anyType)->other);
|
||||||
|
|
||||||
if ((*anyType)->type == esxVI_Type_Undefined) {
|
if ((*anyType)->type == esxVI_Type_Undefined) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unknown value '%s' for AnyType 'type' property"),
|
_("Unknown value '%s' for AnyType 'type' property"),
|
||||||
(*anyType)->other);
|
(*anyType)->other);
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1000,17 +1000,17 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
|
|||||||
#define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max) \
|
#define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max) \
|
||||||
do { \
|
do { \
|
||||||
if (virStrToLong_ll((*anyType)->value, NULL, 10, &number) < 0) { \
|
if (virStrToLong_ll((*anyType)->value, NULL, 10, &number) < 0) { \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
|
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||||
_("Unknown value '%s' for %s"), \
|
_("Unknown value '%s' for %s"), \
|
||||||
(*anyType)->value, _xsdType); \
|
(*anyType)->value, _xsdType); \
|
||||||
goto failure; \
|
goto failure; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
if (((_min) != INT64_MIN && number < (_min)) \
|
if (((_min) != INT64_MIN && number < (_min)) \
|
||||||
|| ((_max) != INT64_MAX && number > (_max))) { \
|
|| ((_max) != INT64_MAX && number > (_max))) { \
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
|
virReportError(VIR_ERR_INTERNAL_ERROR, \
|
||||||
_("Value '%s' is out of %s range"), \
|
_("Value '%s' is out of %s range"), \
|
||||||
(*anyType)->value, _xsdType); \
|
(*anyType)->value, _xsdType); \
|
||||||
goto failure; \
|
goto failure; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
@ -1024,9 +1024,9 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
|
|||||||
} else if (STREQ((*anyType)->value, "false")) {
|
} else if (STREQ((*anyType)->value, "false")) {
|
||||||
(*anyType)->boolean = esxVI_Boolean_False;
|
(*anyType)->boolean = esxVI_Boolean_False;
|
||||||
} else {
|
} else {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unknown value '%s' for xsd:boolean"),
|
_("Unknown value '%s' for xsd:boolean"),
|
||||||
(*anyType)->value);
|
(*anyType)->value);
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1170,7 +1170,7 @@ int
|
|||||||
esxVI_String_DeepCopyValue(char **dest, const char *src)
|
esxVI_String_DeepCopyValue(char **dest, const char *src)
|
||||||
{
|
{
|
||||||
if (dest == NULL || *dest != NULL) {
|
if (dest == NULL || *dest != NULL) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1210,7 +1210,7 @@ esxVI_String_SerializeValue(const char *value, const char *element,
|
|||||||
virBufferPtr output)
|
virBufferPtr output)
|
||||||
{
|
{
|
||||||
if (element == NULL || output == NULL) {
|
if (element == NULL || output == NULL) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1231,7 +1231,7 @@ int
|
|||||||
esxVI_String_Deserialize(xmlNodePtr node, esxVI_String **string)
|
esxVI_String_Deserialize(xmlNodePtr node, esxVI_String **string)
|
||||||
{
|
{
|
||||||
if (string == NULL || *string != NULL) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1255,7 +1255,7 @@ int
|
|||||||
esxVI_String_DeserializeValue(xmlNodePtr node, char **value)
|
esxVI_String_DeserializeValue(xmlNodePtr node, char **value)
|
||||||
{
|
{
|
||||||
if (value == NULL || *value != NULL) {
|
if (value == NULL || *value != NULL) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1389,7 +1389,7 @@ int
|
|||||||
esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime)
|
esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime)
|
||||||
{
|
{
|
||||||
if (dateTime == NULL || *dateTime != NULL) {
|
if (dateTime == NULL || *dateTime != NULL) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1401,9 +1401,9 @@ esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime)
|
|||||||
(char *)xmlNodeListGetString(node->doc, node->children, 1);
|
(char *)xmlNodeListGetString(node->doc, node->children, 1);
|
||||||
|
|
||||||
if ((*dateTime)->value == NULL) {
|
if ((*dateTime)->value == NULL) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("XML node doesn't contain text, expecting an "
|
_("XML node doesn't contain text, expecting an "
|
||||||
"xsd:dateTime value"));
|
"xsd:dateTime value"));
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1429,14 +1429,14 @@ esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime,
|
|||||||
int tz_offset = 0;
|
int tz_offset = 0;
|
||||||
|
|
||||||
if (dateTime == NULL || secondsSinceEpoch == NULL) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virStrcpyStatic(value, dateTime->value) == NULL) {
|
if (virStrcpyStatic(value, dateTime->value) == NULL) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("xsd:dateTime value '%s' too long for destination"),
|
_("xsd:dateTime value '%s' too long for destination"),
|
||||||
dateTime->value);
|
dateTime->value);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1456,9 +1456,9 @@ esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime,
|
|||||||
tmp = strptime(value, "%Y-%m-%dT%H:%M:%S", &tm);
|
tmp = strptime(value, "%Y-%m-%dT%H:%M:%S", &tm);
|
||||||
|
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("xsd:dateTime value '%s' has unexpected format"),
|
_("xsd:dateTime value '%s' has unexpected format"),
|
||||||
dateTime->value);
|
dateTime->value);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1466,9 +1466,9 @@ esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime,
|
|||||||
/* skip .ssssss part if present */
|
/* skip .ssssss part if present */
|
||||||
if (*tmp == '.' &&
|
if (*tmp == '.' &&
|
||||||
virStrToLong_i(tmp + 1, &tmp, 10, &milliseconds) < 0) {
|
virStrToLong_i(tmp + 1, &tmp, 10, &milliseconds) < 0) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("xsd:dateTime value '%s' has unexpected format"),
|
_("xsd:dateTime value '%s' has unexpected format"),
|
||||||
dateTime->value);
|
dateTime->value);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1479,9 +1479,9 @@ esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime,
|
|||||||
if (virStrToLong_i(tmp + 1, &tmp, 10, &tz_hours) < 0 ||
|
if (virStrToLong_i(tmp + 1, &tmp, 10, &tz_hours) < 0 ||
|
||||||
*tmp != ':' ||
|
*tmp != ':' ||
|
||||||
virStrToLong_i(tmp + 1, NULL, 10, &tz_minutes) < 0) {
|
virStrToLong_i(tmp + 1, NULL, 10, &tz_minutes) < 0) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("xsd:dateTime value '%s' has unexpected format"),
|
_("xsd:dateTime value '%s' has unexpected format"),
|
||||||
dateTime->value);
|
dateTime->value);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1493,9 +1493,9 @@ esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime,
|
|||||||
} else if (STREQ(tmp, "Z")) {
|
} else if (STREQ(tmp, "Z")) {
|
||||||
/* Z refers to UTC. tz_offset is already initialized to zero */
|
/* Z refers to UTC. tz_offset is already initialized to zero */
|
||||||
} else {
|
} else {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("xsd:dateTime value '%s' has unexpected format"),
|
_("xsd:dateTime value '%s' has unexpected format"),
|
||||||
dateTime->value);
|
dateTime->value);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1563,7 +1563,7 @@ int
|
|||||||
esxVI_MethodFault_Deserialize(xmlNodePtr node, esxVI_MethodFault **methodFault)
|
esxVI_MethodFault_Deserialize(xmlNodePtr node, esxVI_MethodFault **methodFault)
|
||||||
{
|
{
|
||||||
if (methodFault == NULL || *methodFault != NULL) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1576,8 +1576,8 @@ esxVI_MethodFault_Deserialize(xmlNodePtr node, esxVI_MethodFault **methodFault)
|
|||||||
BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");
|
BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");
|
||||||
|
|
||||||
if ((*methodFault)->_actualType == NULL) {
|
if ((*methodFault)->_actualType == NULL) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("MethodFault is missing 'type' property"));
|
_("MethodFault is missing 'type' property"));
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1629,7 +1629,7 @@ esxVI_ManagedObjectReference_Serialize
|
|||||||
const char *element, virBufferPtr output)
|
const char *element, virBufferPtr output)
|
||||||
{
|
{
|
||||||
if (element == NULL || output == NULL) {
|
if (element == NULL || output == NULL) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1659,7 +1659,7 @@ esxVI_ManagedObjectReference_Deserialize
|
|||||||
(xmlNodePtr node, esxVI_ManagedObjectReference **managedObjectReference)
|
(xmlNodePtr node, esxVI_ManagedObjectReference **managedObjectReference)
|
||||||
{
|
{
|
||||||
if (managedObjectReference == NULL || *managedObjectReference != NULL) {
|
if (managedObjectReference == NULL || *managedObjectReference != NULL) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1671,8 +1671,8 @@ esxVI_ManagedObjectReference_Deserialize
|
|||||||
(char *)xmlGetNoNsProp(node, BAD_CAST "type");
|
(char *)xmlGetNoNsProp(node, BAD_CAST "type");
|
||||||
|
|
||||||
if ((*managedObjectReference)->type == NULL) {
|
if ((*managedObjectReference)->type == NULL) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("ManagedObjectReference is missing 'type' property"));
|
_("ManagedObjectReference is missing 'type' property"));
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1749,9 +1749,9 @@ ESX_VI__TEMPLATE__DESERIALIZE_EXTRA(Event, /* nothing */,
|
|||||||
BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");
|
BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");
|
||||||
|
|
||||||
if ((*ptrptr)->_actualType == NULL) {
|
if ((*ptrptr)->_actualType == NULL) {
|
||||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("%s is missing 'type' property"),
|
_("%s is missing 'type' property"),
|
||||||
esxVI_Type_ToString((*ptrptr)->_type));
|
esxVI_Type_ToString((*ptrptr)->_type));
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user