mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
esx: improve some of the virErrorNumber used
A lot of virReportError() calls use VIR_ERR_INTERNAL_ERROR to represent the number of the error, even in cases where there is one fitting more. Hence, replace some of them with better virErrorNumber values. Signed-off-by: Pino Toscano <ptoscano@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
8508799f2d
commit
8c16f81eb9
@ -355,7 +355,7 @@ esxNetworkDefineXML(virConnectPtr conn, const char *xml)
|
||||
for (hostPortGroup = hostPortGroupList; hostPortGroup;
|
||||
hostPortGroup = hostPortGroup->_next) {
|
||||
if (STREQ(def->portGroups[i].name, hostPortGroup->spec->name)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_NETWORK_EXIST,
|
||||
_("HostPortGroup with name '%s' exists already"),
|
||||
def->portGroups[i].name);
|
||||
goto cleanup;
|
||||
@ -388,7 +388,7 @@ esxNetworkDefineXML(virConnectPtr conn, const char *xml)
|
||||
|
||||
if (def->forward.ifs[i].type !=
|
||||
VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_NETDEV) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_NO_SUPPORT,
|
||||
_("unsupported device type in network %s "
|
||||
"interface pool"),
|
||||
def->name);
|
||||
|
@ -321,7 +321,7 @@ esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
|
||||
|
||||
if (!target) {
|
||||
/* pool not found */
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
_("Could not find storage pool with name '%s'"),
|
||||
pool->name);
|
||||
goto cleanup;
|
||||
@ -699,7 +699,7 @@ esxStorageVolGetXMLDesc(virStorageVolPtr volume,
|
||||
}
|
||||
|
||||
if (!scsiLun) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("Could find volume with name: %s"), volume->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -897,7 +897,7 @@ esxStorageVolCreateXML(virStoragePoolPtr pool,
|
||||
goto cleanup;
|
||||
|
||||
if (def->type != VIR_STORAGE_VOL_FILE) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
virReportError(VIR_ERR_NO_SUPPORT, "%s",
|
||||
_("Creating non-file volumes is not supported"));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -913,7 +913,7 @@ esxStorageVolCreateXML(virStoragePoolPtr pool,
|
||||
}
|
||||
|
||||
if (!virStringHasCaseSuffix(def->name, ".vmdk")) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_NO_SUPPORT,
|
||||
_("Volume name '%s' has unsupported suffix, "
|
||||
"expecting '.vmdk'"), def->name);
|
||||
goto cleanup;
|
||||
@ -1032,7 +1032,7 @@ esxStorageVolCreateXML(virStoragePoolPtr pool,
|
||||
key = g_strdup(datastorePath);
|
||||
}
|
||||
} else {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_NO_SUPPORT,
|
||||
_("Creation of %s volumes is not supported"),
|
||||
virStorageFileFormatTypeToString(def->target.format));
|
||||
goto cleanup;
|
||||
@ -1111,7 +1111,7 @@ esxStorageVolCreateXMLFrom(virStoragePoolPtr pool,
|
||||
goto cleanup;
|
||||
|
||||
if (def->type != VIR_STORAGE_VOL_FILE) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
virReportError(VIR_ERR_NO_SUPPORT, "%s",
|
||||
_("Creating non-file volumes is not supported"));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -1127,7 +1127,7 @@ esxStorageVolCreateXMLFrom(virStoragePoolPtr pool,
|
||||
}
|
||||
|
||||
if (!virStringHasCaseSuffix(def->name, ".vmdk")) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_NO_SUPPORT,
|
||||
_("Volume name '%s' has unsupported suffix, "
|
||||
"expecting '.vmdk'"), def->name);
|
||||
goto cleanup;
|
||||
@ -1212,7 +1212,7 @@ esxStorageVolCreateXMLFrom(virStoragePoolPtr pool,
|
||||
key = g_strdup(datastorePath);
|
||||
}
|
||||
} else {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_NO_SUPPORT,
|
||||
_("Creation of %s volumes is not supported"),
|
||||
virStorageFileFormatTypeToString(def->target.format));
|
||||
goto cleanup;
|
||||
|
@ -226,7 +226,7 @@ esxUtil_ParseDatastorePath(const char *datastorePath, char **datastoreName,
|
||||
/* Expected format: '[<datastore>] <path>' where <path> is optional */
|
||||
if (!(tmp = STRSKIP(copyOfDatastorePath, "[")) || *tmp == ']' ||
|
||||
!(preliminaryDatastoreName = strtok_r(tmp, "]", &saveptr))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("Datastore path '%s' doesn't have expected format "
|
||||
"'[<datastore>] <path>'"), datastorePath);
|
||||
goto cleanup;
|
||||
|
@ -1390,7 +1390,7 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_HTTP_ERROR,
|
||||
_("HTTP response code %d for call to '%s'"),
|
||||
(*response)->responseCode, methodName);
|
||||
goto cleanup;
|
||||
|
Loading…
Reference in New Issue
Block a user