提交 cf8cff03 编写于 作者: D Daniel P. Berrange

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: NDaniel P. Berrange <berrange@redhat.com>
上级 7f4ed3ec
...@@ -506,8 +506,6 @@ sc_avoid_attribute_unused_in_header: ...@@ -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
......
此差异已折叠。
...@@ -28,10 +28,6 @@ ...@@ -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, ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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, ...@@ -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, ...@@ -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) ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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) ...@@ -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;
} }
......
此差异已折叠。
...@@ -35,13 +35,6 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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, ...@@ -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;
} }
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册