vSphere Guest API Error
Codes
Each vSphere Guest API function returns an
error code. If successful, the returned error code is
VMGUESTLIB_ERROR_SUCCESS
. If the
function is unable to complete its task, the error code provides information
for diagnosing the problem.
Use the
VMGuestLib_GetErrorText
function to retrieve the error text associated with a particular error code.
When you call the function, pass the error code to the function;
VMGuestLib_GetErrorText
returns a pointer to a string containing the error text.
vm-guest-api-error-codes.html#GUID-B2C98AB2-65B6-4375-AC9C-0D2F9693CF3D-en_ID-3875-0000035B shows error handling. The C code
fragment declares a guest library handle and calls the function
VMGuestLib_OpenHandle
. If the
call is not successful, the code calls
VMGuestLib_GetErrorText
and
displays the error text.
Error Handling
VMGuestLibHandle glHandle; glError = VMGuestLib_OpenHandle(&glHandle); if (glError != VMGUESTLIB_ERROR_SUCCESS) { printf("OpenHandle failed: %s\n", VMGuestLib_GetErrorText(glError)); }
Table 1 lists all error codes defined for
the vSphere Guest API.
Error Code
| Description
|
VMGUESTLIB_ERROR_SUCCESS
| The function has
completed successfully.
|
VMGUESTLIB_ERROR_OTHER
| An error has occurred. No
additional information about the type of error is available.
|
VMGUESTLIB_ERROR_NOT_RUNNING_IN_VM
| The program making this
call is not running on a VMware virtual machine.
|
VMGUESTLIB_ERROR_NOT_ENABLED
| The vSphere Guest API is
not enabled on this host, so these functions cannot be used. For information
about how to enable the library, see
Calling Context Functions.
|
VMGUESTLIB_ERROR_NOT_AVAILABLE
| The information requested
is not available on this host.
|
VMGUESTLIB_ERROR_NO_INFO
| The handle data structure
does not contain any information. You must call
VMGuestLib_UpdateInfo to
update the data structure.
|
VMGUESTLIB_ERROR_MEMORY
| There is not enough
memory available to complete the call.
|
VMGUESTLIB_ERROR_BUFFER_TOO_SMALL
| The buffer is too small
to accommodate the function call. For example, when you call
VMGuestLib_GetResourcePoolPath , if the path
buffer is too small for the resulting resource pool path, the function returns
this error. To resolve this error, allocate a larger buffer.
|
VMGUESTLIB_ERROR_INVALID_HANDLE
| The handle that you used
is invalid. Make sure that you have the correct handle and that it is open. It
might be necessary to create a new handle using
VMGuestLib_OpenHandle .
|
VMGUESTLIB_ERROR_INVALID_ARG
| One or more of the
arguments passed to the function were invalid.
|
VMGUESTLIB_ERROR_UNSUPPORTED_VERSION
| The host does not support
the requested statistic.
|