提交 854111f9 编写于 作者: M Matthias Bolte

esx: Stop passing around virConnectPtr for error reporting

上级 9757e10d
此差异已折叠。
......@@ -37,9 +37,9 @@
#define VIR_FROM_THIS VIR_FROM_ESX
#define ESX_ERROR(conn, code, fmt...) \
virReportErrorHelper (conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, fmt)
#define ESX_ERROR(code, fmt...) \
virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, fmt)
/* AI_ADDRCONFIG is missing on some systems. */
#ifndef AI_ADDRCONFIG
......@@ -132,7 +132,7 @@ esxUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
int
esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
esxUtil_ParseQuery(xmlURIPtr uri, char **transport, char **vCenter,
int *noVerify, int *autoAnswer)
{
int result = 0;
......@@ -157,9 +157,9 @@ esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
}
#ifdef HAVE_XMLURI_QUERY_RAW
queryParamSet = qparam_query_parse(conn->uri->query_raw);
queryParamSet = qparam_query_parse(uri->query_raw);
#else
queryParamSet = qparam_query_parse(conn->uri->query);
queryParamSet = qparam_query_parse(uri->query);
#endif
if (queryParamSet == NULL) {
......@@ -177,12 +177,12 @@ esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
*transport = strdup(queryParam->value);
if (*transport == NULL) {
virReportOOMError(conn);
virReportOOMError(NULL);
goto failure;
}
if (STRNEQ(*transport, "http") && STRNEQ(*transport, "https")) {
ESX_ERROR(conn, VIR_ERR_INVALID_ARG,
ESX_ERROR(VIR_ERR_INVALID_ARG,
"Query parameter 'transport' has unexpected value "
"'%s' (should be http|https)", *transport);
goto failure;
......@@ -195,7 +195,7 @@ esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
*vCenter = strdup(queryParam->value);
if (*vCenter == NULL) {
virReportOOMError(conn);
virReportOOMError(NULL);
goto failure;
}
} else if (STRCASEEQ(queryParam->name, "no_verify")) {
......@@ -205,7 +205,7 @@ esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
if (virStrToLong_i(queryParam->value, NULL, 10, noVerify) < 0 ||
(*noVerify != 0 && *noVerify != 1)) {
ESX_ERROR(conn, VIR_ERR_INVALID_ARG,
ESX_ERROR(VIR_ERR_INVALID_ARG,
"Query parameter 'no_verify' has unexpected value "
"'%s' (should be 0 or 1)", queryParam->value);
goto failure;
......@@ -217,7 +217,7 @@ esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
if (virStrToLong_i(queryParam->value, NULL, 10, autoAnswer) < 0 ||
(*autoAnswer != 0 && *autoAnswer != 1)) {
ESX_ERROR(conn, VIR_ERR_INVALID_ARG,
ESX_ERROR(VIR_ERR_INVALID_ARG,
"Query parameter 'auto_answer' has unexpected value "
"'%s' (should be 0 or 1)", queryParam->value);
goto failure;
......@@ -232,7 +232,7 @@ esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
*transport = strdup("https");
if (*transport == NULL) {
virReportOOMError(conn);
virReportOOMError(NULL);
goto failure;
}
}
......@@ -284,8 +284,7 @@ esxUtil_ParseVirtualMachineIDString(const char *id_string, int *id)
int
esxUtil_ParseDatastoreRelatedPath(virConnectPtr conn,
const char *datastoreRelatedPath,
esxUtil_ParseDatastoreRelatedPath(const char *datastoreRelatedPath,
char **datastoreName,
char **directoryName, char **fileName)
{
......@@ -296,7 +295,7 @@ esxUtil_ParseDatastoreRelatedPath(virConnectPtr conn,
if (datastoreName == NULL || *datastoreName != NULL ||
directoryName == NULL || *directoryName != NULL ||
fileName == NULL || *fileName != NULL) {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
......@@ -316,7 +315,7 @@ esxUtil_ParseDatastoreRelatedPath(virConnectPtr conn,
*/
if (sscanf(datastoreRelatedPath, "[%a[^]%]] %a[^\n]", datastoreName,
&directoryAndFileName) != 2) {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Datastore related path '%s' doesn't have expected format "
"'[<datastore>] <path>'", datastoreRelatedPath);
goto failure;
......@@ -332,7 +331,7 @@ esxUtil_ParseDatastoreRelatedPath(virConnectPtr conn,
directoryAndFileName = NULL;
if (*separator == '\0') {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Datastore related path '%s' doesn't reference a file",
datastoreRelatedPath);
goto failure;
......@@ -341,7 +340,7 @@ esxUtil_ParseDatastoreRelatedPath(virConnectPtr conn,
*fileName = strdup(separator);
if (*fileName == NULL) {
virReportOOMError(conn);
virReportOOMError(NULL);
goto failure;
}
} else {
......@@ -367,7 +366,7 @@ esxUtil_ParseDatastoreRelatedPath(virConnectPtr conn,
int
esxUtil_ResolveHostname(virConnectPtr conn, const char *hostname,
esxUtil_ResolveHostname(const char *hostname,
char *ipAddress, size_t ipAddress_length)
{
struct addrinfo hints;
......@@ -384,14 +383,14 @@ esxUtil_ResolveHostname(virConnectPtr conn, const char *hostname,
errcode = getaddrinfo(hostname, NULL, &hints, &result);
if (errcode != 0) {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"IP address lookup for host '%s' failed: %s", hostname,
gai_strerror(errcode));
return -1;
}
if (result == NULL) {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"No IP address for host '%s' found: %s", hostname,
gai_strerror(errcode));
return -1;
......@@ -401,7 +400,7 @@ esxUtil_ResolveHostname(virConnectPtr conn, const char *hostname,
ipAddress_length, NULL, 0, NI_NUMERICHOST);
if (errcode != 0) {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Formating IP address for host '%s' failed: %s", hostname,
gai_strerror(errcode));
freeaddrinfo(result);
......@@ -416,8 +415,8 @@ esxUtil_ResolveHostname(virConnectPtr conn, const char *hostname,
int
esxUtil_GetConfigString(virConnectPtr conn, virConfPtr conf, const char *name,
char **string, int optional)
esxUtil_GetConfigString(virConfPtr conf, const char *name, char **string,
int optional)
{
virConfValuePtr value;
......@@ -429,13 +428,13 @@ esxUtil_GetConfigString(virConnectPtr conn, virConfPtr conf, const char *name,
return 0;
}
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing essential config entry '%s'", name);
return -1;
}
if (value->type != VIR_CONF_STRING) {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Config entry '%s' must be a string", name);
return -1;
}
......@@ -445,7 +444,7 @@ esxUtil_GetConfigString(virConnectPtr conn, virConfPtr conf, const char *name,
return 0;
}
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing essential config entry '%s'", name);
return -1;
}
......@@ -453,7 +452,7 @@ esxUtil_GetConfigString(virConnectPtr conn, virConfPtr conf, const char *name,
*string = strdup(value->str);
if (*string == NULL) {
virReportOOMError(conn);
virReportOOMError(NULL);
return -1;
}
......@@ -463,8 +462,8 @@ esxUtil_GetConfigString(virConnectPtr conn, virConfPtr conf, const char *name,
int
esxUtil_GetConfigUUID(virConnectPtr conn, virConfPtr conf, const char *name,
unsigned char *uuid, int optional)
esxUtil_GetConfigUUID(virConfPtr conf, const char *name, unsigned char *uuid,
int optional)
{
virConfValuePtr value;
......@@ -474,14 +473,14 @@ esxUtil_GetConfigUUID(virConnectPtr conn, virConfPtr conf, const char *name,
if (optional) {
return 0;
} else {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing essential config entry '%s'", name);
return -1;
}
}
if (value->type != VIR_CONF_STRING) {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Config entry '%s' must be a string", name);
return -1;
}
......@@ -490,14 +489,14 @@ esxUtil_GetConfigUUID(virConnectPtr conn, virConfPtr conf, const char *name,
if (optional) {
return 0;
} else {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing essential config entry '%s'", name);
return -1;
}
}
if (virUUIDParse(value->str, uuid) < 0) {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not parse UUID from string '%s'", value->str);
return -1;
}
......@@ -508,8 +507,8 @@ esxUtil_GetConfigUUID(virConnectPtr conn, virConfPtr conf, const char *name,
int
esxUtil_GetConfigLong(virConnectPtr conn, virConfPtr conf, const char *name,
long long *number, long long default_, int optional)
esxUtil_GetConfigLong(virConfPtr conf, const char *name, long long *number,
long long default_, int optional)
{
virConfValuePtr value;
......@@ -520,7 +519,7 @@ esxUtil_GetConfigLong(virConnectPtr conn, virConfPtr conf, const char *name,
if (optional) {
return 0;
} else {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing essential config entry '%s'", name);
return -1;
}
......@@ -531,7 +530,7 @@ esxUtil_GetConfigLong(virConnectPtr conn, virConfPtr conf, const char *name,
if (optional) {
return 0;
} else {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing essential config entry '%s'", name);
return -1;
}
......@@ -540,13 +539,13 @@ esxUtil_GetConfigLong(virConnectPtr conn, virConfPtr conf, const char *name,
if (STREQ(value->str, "unlimited")) {
*number = -1;
} else if (virStrToLong_ll(value->str, NULL, 10, number) < 0) {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Config entry '%s' must represent an integer value",
name);
return -1;
}
} else {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Config entry '%s' must be a string", name);
return -1;
}
......@@ -557,9 +556,8 @@ esxUtil_GetConfigLong(virConnectPtr conn, virConfPtr conf, const char *name,
int
esxUtil_GetConfigBoolean(virConnectPtr conn, virConfPtr conf,
const char *name, int *boolean_, int default_,
int optional)
esxUtil_GetConfigBoolean(virConfPtr conf, const char *name, int *boolean_,
int default_, int optional)
{
virConfValuePtr value;
......@@ -570,7 +568,7 @@ esxUtil_GetConfigBoolean(virConnectPtr conn, virConfPtr conf,
if (optional) {
return 0;
} else {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing essential config entry '%s'", name);
return -1;
}
......@@ -581,7 +579,7 @@ esxUtil_GetConfigBoolean(virConnectPtr conn, virConfPtr conf,
if (optional) {
return 0;
} else {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing essential config entry '%s'", name);
return -1;
}
......@@ -592,13 +590,13 @@ esxUtil_GetConfigBoolean(virConnectPtr conn, virConfPtr conf,
} else if (STRCASEEQ(value->str, "false")) {
*boolean_ = 0;
} else {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Config entry '%s' must represent a boolean value "
"(true|false)", name);
return -1;
}
} else {
ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Config entry '%s' must be a string", name);
return -1;
}
......
......@@ -23,7 +23,7 @@
#ifndef __ESX_UTIL_H__
#define __ESX_UTIL_H__
#include <libxml/tree.h>
#include <libxml/uri.h>
#include "internal.h"
#include "conf.h"
......@@ -35,30 +35,28 @@ char *esxUtil_RequestUsername(virConnectAuthPtr auth,
char *esxUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
const char *hostname);
int esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
int esxUtil_ParseQuery(xmlURIPtr uri, char **transport, char **vCenter,
int *noVerify, int *autoAnswer);
int esxUtil_ParseVirtualMachineIDString(const char *id_string, int *id);
int esxUtil_ParseDatastoreRelatedPath(virConnectPtr conn,
const char *datastoreRelatedPath,
int esxUtil_ParseDatastoreRelatedPath(const char *datastoreRelatedPath,
char **datastoreName,
char **directoryName, char **fileName);
int esxUtil_ResolveHostname(virConnectPtr conn, const char *hostname,
int esxUtil_ResolveHostname(const char *hostname,
char *ipAddress, size_t ipAddress_length);
int esxUtil_GetConfigString(virConnectPtr conn, virConfPtr conf,
const char *name, char **string, int optional);
int esxUtil_GetConfigString(virConfPtr conf, const char *name, char **string,
int optional);
int esxUtil_GetConfigUUID(virConnectPtr conn, virConfPtr conf, const char *name,
int esxUtil_GetConfigUUID(virConfPtr conf, const char *name,
unsigned char *uuid, int optional);
int esxUtil_GetConfigLong(virConnectPtr conn, virConfPtr conf, const char *name,
long long *number, long long default_, int optional);
int esxUtil_GetConfigLong(virConfPtr conf, const char *name, long long *number,
long long default_, int optional);
int esxUtil_GetConfigBoolean(virConnectPtr conn, virConfPtr conf,
const char *name, int *boolean_, int default_,
int optional);
int esxUtil_GetConfigBoolean(virConfPtr conf, const char *name, int *boolean_,
int default_, int optional);
#endif /* __ESX_UTIL_H__ */
此差异已折叠。
......@@ -90,19 +90,18 @@ struct _esxVI_Context {
esxVI_SelectionSpec *fullTraversalSpecList;
};
int esxVI_Context_Alloc(virConnectPtr conn, esxVI_Context **ctx);
int esxVI_Context_Alloc(esxVI_Context **ctx);
void esxVI_Context_Free(esxVI_Context **ctx);
int esxVI_Context_Connect(virConnectPtr conn, esxVI_Context *ctx,
const char *ipAddress, const char *url,
const char *username, const char *password,
int noVerify);
int esxVI_Context_DownloadFile(virConnectPtr conn, esxVI_Context *ctx,
const char *url, char **content);
int esxVI_Context_UploadFile(virConnectPtr conn, esxVI_Context *ctx,
const char *url, const char *content);
int esxVI_Context_Execute(virConnectPtr conn, esxVI_Context *ctx,
const char *methodName, const char *request,
esxVI_Response **response, esxVI_Occurrence occurrence);
int esxVI_Context_Connect(esxVI_Context *ctx, const char *ipAddress,
const char *url, const char *username,
const char *password, int noVerify);
int esxVI_Context_DownloadFile(esxVI_Context *ctx, const char *url,
char **content);
int esxVI_Context_UploadFile(esxVI_Context *ctx, const char *url,
const char *content);
int esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
const char *request, esxVI_Response **response,
esxVI_Occurrence occurrence);
......@@ -117,7 +116,7 @@ struct _esxVI_Response {
xmlNodePtr node; /* optional, list */
};
int esxVI_Response_Alloc(virConnectPtr conn, esxVI_Response **response);
int esxVI_Response_Alloc(esxVI_Response **response);
void esxVI_Response_Free(esxVI_Response **response);
......@@ -136,15 +135,12 @@ struct _esxVI_Enumeration {
esxVI_EnumerationValue values[10];
};
int esxVI_Enumeration_CastFromAnyType(virConnectPtr conn,
const esxVI_Enumeration *enumeration,
int esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration *enumeration,
esxVI_AnyType *anyType, int *value);
int esxVI_Enumeration_Serialize(virConnectPtr conn,
const esxVI_Enumeration *enumeration,
int esxVI_Enumeration_Serialize(const esxVI_Enumeration *enumeration,
int value, const char *element,
virBufferPtr output, esxVI_Boolean required);
int esxVI_Enumeration_Deserialize(virConnectPtr conn,
const esxVI_Enumeration *enumeration,
int esxVI_Enumeration_Deserialize(const esxVI_Enumeration *enumeration,
xmlNodePtr node, int *value);
......@@ -158,33 +154,25 @@ struct _esxVI_List {
};
typedef int (*esxVI_List_FreeFunc) (esxVI_List **item);
typedef int (*esxVI_List_DeepCopyFunc) (virConnectPtr conn, esxVI_List **dest,
esxVI_List *src);
typedef int (*esxVI_List_CastFromAnyTypeFunc) (virConnectPtr conn,
esxVI_AnyType *anyType,
typedef int (*esxVI_List_DeepCopyFunc) (esxVI_List **dest, esxVI_List *src);
typedef int (*esxVI_List_CastFromAnyTypeFunc) (esxVI_AnyType *anyType,
esxVI_List **item);
typedef int (*esxVI_List_SerializeFunc) (virConnectPtr conn, esxVI_List *item,
const char *element,
typedef int (*esxVI_List_SerializeFunc) (esxVI_List *item, const char *element,
virBufferPtr output,
esxVI_Boolean required);
typedef int (*esxVI_List_DeserializeFunc) (virConnectPtr conn, xmlNodePtr node,
esxVI_List **item);
typedef int (*esxVI_List_DeserializeFunc) (xmlNodePtr node, esxVI_List **item);
int esxVI_List_Append(virConnectPtr conn, esxVI_List **list, esxVI_List *item);
int esxVI_List_DeepCopy(virConnectPtr conn, esxVI_List **destList,
esxVI_List *srcList,
int esxVI_List_Append(esxVI_List **list, esxVI_List *item);
int esxVI_List_DeepCopy(esxVI_List **destList, esxVI_List *srcList,
esxVI_List_DeepCopyFunc deepCopyFunc,
esxVI_List_FreeFunc freeFunc);
int esxVI_List_CastFromAnyType(virConnectPtr conn, esxVI_AnyType *anyType,
esxVI_List **list,
int esxVI_List_CastFromAnyType(esxVI_AnyType *anyType, esxVI_List **list,
esxVI_List_CastFromAnyTypeFunc castFromAnyTypeFunc,
esxVI_List_FreeFunc freeFunc);
int esxVI_List_Serialize(virConnectPtr conn, esxVI_List *list,
const char *element, virBufferPtr output,
esxVI_Boolean required,
int esxVI_List_Serialize(esxVI_List *list, const char *element,
virBufferPtr output, esxVI_Boolean required,
esxVI_List_SerializeFunc serializeFunc);
int esxVI_List_Deserialize(virConnectPtr conn, xmlNodePtr node,
esxVI_List **list,
int esxVI_List_Deserialize(xmlNodePtr node, esxVI_List **list,
esxVI_List_DeserializeFunc deserializeFunc,
esxVI_List_FreeFunc freeFunc);
......@@ -198,22 +186,21 @@ int esxVI_List_Deserialize(virConnectPtr conn, xmlNodePtr node,
* - 'get' functions get information from a local object
*/
int esxVI_Alloc(virConnectPtr conn, void **ptrptr, size_t size);
int esxVI_Alloc(void **ptrptr, size_t size);
int esxVI_CheckSerializationNecessity(virConnectPtr conn, const char *element,
int esxVI_CheckSerializationNecessity(const char *element,
esxVI_Boolean required);
int esxVI_BuildFullTraversalSpecItem
(virConnectPtr conn, esxVI_SelectionSpec **fullTraversalSpecList,
const char *name, const char *type, const char *path,
const char *selectSetNames);
(esxVI_SelectionSpec **fullTraversalSpecList, const char *name,
const char *type, const char *path, const char *selectSetNames);
int esxVI_BuildFullTraversalSpecList
(virConnectPtr conn, esxVI_SelectionSpec **fullTraversalSpecList);
(esxVI_SelectionSpec **fullTraversalSpecList);
int esxVI_EnsureSession(virConnectPtr conn, esxVI_Context *ctx);
int esxVI_EnsureSession(esxVI_Context *ctx);
int esxVI_LookupObjectContentByType(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_LookupObjectContentByType(esxVI_Context *ctx,
esxVI_ManagedObjectReference *root,
const char *type,
esxVI_String *propertyNameList,
......@@ -221,86 +208,80 @@ int esxVI_LookupObjectContentByType(virConnectPtr conn, esxVI_Context *ctx,
esxVI_ObjectContent **objectContentList);
int esxVI_GetManagedEntityStatus
(virConnectPtr conn, esxVI_ObjectContent *objectContent,
const char *propertyName,
(esxVI_ObjectContent *objectContent, const char *propertyName,
esxVI_ManagedEntityStatus *managedEntityStatus);
int esxVI_GetVirtualMachinePowerState
(virConnectPtr conn, esxVI_ObjectContent *virtualMachine,
(esxVI_ObjectContent *virtualMachine,
esxVI_VirtualMachinePowerState *powerState);
int esxVI_GetVirtualMachineQuestionInfo
(virConnectPtr conn, esxVI_ObjectContent *virtualMachine,
(esxVI_ObjectContent *virtualMachine,
esxVI_VirtualMachineQuestionInfo **questionInfo);
int esxVI_LookupNumberOfDomainsByPowerState
(virConnectPtr conn, esxVI_Context *ctx,
esxVI_VirtualMachinePowerState powerState, esxVI_Boolean inverse);
(esxVI_Context *ctx, esxVI_VirtualMachinePowerState powerState,
esxVI_Boolean inverse);
int esxVI_GetVirtualMachineIdentity(virConnectPtr conn,
esxVI_ObjectContent *virtualMachine,
int esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
int *id, char **name, unsigned char *uuid);
int esxVI_LookupResourcePoolByHostSystem
(virConnectPtr conn, esxVI_Context *ctx, esxVI_ObjectContent *hostSystem,
(esxVI_Context *ctx, esxVI_ObjectContent *hostSystem,
esxVI_ManagedObjectReference **resourcePool);
int esxVI_LookupHostSystemByIp(virConnectPtr conn, esxVI_Context *ctx,
const char *ipAddress,
int esxVI_LookupHostSystemByIp(esxVI_Context *ctx, const char *ipAddress,
esxVI_String *propertyNameList,
esxVI_ObjectContent **hostSystem);
int esxVI_LookupVirtualMachineByUuid(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_LookupVirtualMachineByUuid(esxVI_Context *ctx,
const unsigned char *uuid,
esxVI_String *propertyNameList,
esxVI_ObjectContent **virtualMachine,
esxVI_Occurrence occurrence);
int esxVI_LookupVirtualMachineByUuidAndPrepareForTask
(virConnectPtr conn, esxVI_Context *ctx, const unsigned char *uuid,
(esxVI_Context *ctx, const unsigned char *uuid,
esxVI_String *propertyNameList, esxVI_ObjectContent **virtualMachine,
esxVI_Boolean autoAnswer);
int esxVI_LookupDatastoreByName(virConnectPtr conn, esxVI_Context *ctx,
const char *name,
int esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name,
esxVI_String *propertyNameList,
esxVI_ObjectContent **datastore,
esxVI_Occurrence occurrence);
int esxVI_LookupTaskInfoByTask(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_LookupTaskInfoByTask(esxVI_Context *ctx,
esxVI_ManagedObjectReference *task,
esxVI_TaskInfo **taskInfo);
int esxVI_LookupPendingTaskInfoListByVirtualMachine
(virConnectPtr conn, esxVI_Context *ctx,
esxVI_ObjectContent *virtualMachine,
(esxVI_Context *ctx, esxVI_ObjectContent *virtualMachine,
esxVI_TaskInfo **pendingTaskInfoList);
int esxVI_LookupAndHandleVirtualMachineQuestion(virConnectPtr conn,
esxVI_Context *ctx,
int esxVI_LookupAndHandleVirtualMachineQuestion(esxVI_Context *ctx,
const unsigned char *uuid,
esxVI_Boolean autoAnswer);
int esxVI_StartVirtualMachineTask(virConnectPtr conn, esxVI_Context *ctx,
const char *name, const char *request,
int esxVI_StartVirtualMachineTask(esxVI_Context *ctx, const char *name,
const char *request,
esxVI_ManagedObjectReference **task);
int esxVI_StartSimpleVirtualMachineTask
(virConnectPtr conn, esxVI_Context *ctx, const char *name,
(esxVI_Context *ctx, const char *name,
esxVI_ManagedObjectReference *virtualMachine,
esxVI_ManagedObjectReference **task);
int esxVI_SimpleVirtualMachineMethod
(virConnectPtr conn, esxVI_Context *ctx, const char *name,
(esxVI_Context *ctx, const char *name,
esxVI_ManagedObjectReference *virtualMachine);
int esxVI_HandleVirtualMachineQuestion
(virConnectPtr conn, esxVI_Context *ctx,
(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine,
esxVI_VirtualMachineQuestionInfo *questionInfo,
esxVI_Boolean autoAnswer);
int esxVI_WaitForTaskCompletion(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_WaitForTaskCompletion(esxVI_Context *ctx,
esxVI_ManagedObjectReference *task,
const unsigned char *virtualMachineUuid,
esxVI_Boolean autoAnswer,
......
此差异已折叠。
......@@ -32,47 +32,45 @@
* VI Methods
*/
int esxVI_RetrieveServiceContent(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_RetrieveServiceContent(esxVI_Context *ctx,
esxVI_ServiceContent **serviceContent);
int esxVI_Login(virConnectPtr conn, esxVI_Context *ctx,
const char *userName, const char *password,
int esxVI_Login(esxVI_Context *ctx, const char *userName, const char *password,
esxVI_UserSession **userSession);
int esxVI_Logout(virConnectPtr conn, esxVI_Context *ctx);
int esxVI_Logout(esxVI_Context *ctx);
int esxVI_SessionIsActive(virConnectPtr conn, esxVI_Context *ctx,
const char *sessionID, const char *userName,
esxVI_Boolean *active);
int esxVI_SessionIsActive(esxVI_Context *ctx, const char *sessionID,
const char *userName, esxVI_Boolean *active);
int esxVI_RetrieveProperties(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_RetrieveProperties(esxVI_Context *ctx,
esxVI_PropertyFilterSpec *propertyFilterSpecList,
esxVI_ObjectContent **objectContentList);
int esxVI_PowerOnVM_Task(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_PowerOnVM_Task(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine,
esxVI_ManagedObjectReference **task);
int esxVI_PowerOffVM_Task(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_PowerOffVM_Task(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine,
esxVI_ManagedObjectReference **task);
int esxVI_SuspendVM_Task(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_SuspendVM_Task(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine,
esxVI_ManagedObjectReference **task);
int esxVI_MigrateVM_Task(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_MigrateVM_Task(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine,
esxVI_ManagedObjectReference *resourcePool,
esxVI_ManagedObjectReference *hostSystem,
esxVI_ManagedObjectReference **task);
int esxVI_ReconfigVM_Task(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_ReconfigVM_Task(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine,
esxVI_VirtualMachineConfigSpec *spec,
esxVI_ManagedObjectReference **task);
int esxVI_RegisterVM_Task(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_RegisterVM_Task(esxVI_Context *ctx,
esxVI_ManagedObjectReference *folder,
const char *path, const char *name,
esxVI_Boolean asTemplate,
......@@ -80,34 +78,33 @@ int esxVI_RegisterVM_Task(virConnectPtr conn, esxVI_Context *ctx,
esxVI_ManagedObjectReference *hostSystem,
esxVI_ManagedObjectReference **task);
int esxVI_CancelTask(virConnectPtr conn, esxVI_Context *ctx,
esxVI_ManagedObjectReference *task);
int esxVI_CancelTask(esxVI_Context *ctx, esxVI_ManagedObjectReference *task);
int esxVI_UnregisterVM(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_UnregisterVM(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine);
int esxVI_AnswerVM(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_AnswerVM(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine,
const char *questionId, const char *answerChoice);
int esxVI_CreateFilter(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_CreateFilter(esxVI_Context *ctx,
esxVI_PropertyFilterSpec *propertyFilterSpec,
esxVI_Boolean partialUpdates,
esxVI_ManagedObjectReference **propertyFilter);
int esxVI_DestroyPropertyFilter(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_DestroyPropertyFilter(esxVI_Context *ctx,
esxVI_ManagedObjectReference *propertyFilter);
int esxVI_WaitForUpdates(virConnectPtr conn, esxVI_Context *ctx,
const char *version, esxVI_UpdateSet **updateSet);
int esxVI_WaitForUpdates(esxVI_Context *ctx, const char *version,
esxVI_UpdateSet **updateSet);
int esxVI_RebootGuest(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_RebootGuest(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine);
int esxVI_ShutdownGuest(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_ShutdownGuest(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine);
int esxVI_ValidateMigration(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_ValidateMigration(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachineList,
esxVI_VirtualMachinePowerState powerState,
esxVI_String *testTypeList, // FIXME: see ValidateMigrationTestType
......@@ -115,29 +112,26 @@ int esxVI_ValidateMigration(virConnectPtr conn, esxVI_Context *ctx,
esxVI_ManagedObjectReference *hostSystem,
esxVI_Event **eventList);
int esxVI_FindByIp(virConnectPtr conn, esxVI_Context *ctx,
esxVI_ManagedObjectReference *datacenter,
int esxVI_FindByIp(esxVI_Context *ctx, esxVI_ManagedObjectReference *datacenter,
const char *ip, esxVI_Boolean vmSearch,
esxVI_ManagedObjectReference **managedObjectReference);
int esxVI_FindByUuid(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_FindByUuid(esxVI_Context *ctx,
esxVI_ManagedObjectReference *datacenter,
const unsigned char *uuid, esxVI_Boolean vmSearch,
esxVI_ManagedObjectReference **managedObjectReference);
int esxVI_QueryAvailablePerfMetric(virConnectPtr conn, esxVI_Context *ctx,
int esxVI_QueryAvailablePerfMetric(esxVI_Context *ctx,
esxVI_ManagedObjectReference *entity,
esxVI_DateTime *beginTime,
esxVI_DateTime *endTime,
esxVI_Int *intervalId,
esxVI_PerfMetricId **perfMetricIdList);
int esxVI_QueryPerfCounter(virConnectPtr conn, esxVI_Context *ctx,
esxVI_Int *counterIdList,
int esxVI_QueryPerfCounter(esxVI_Context *ctx, esxVI_Int *counterIdList,
esxVI_PerfCounterInfo **perfCounterInfoList);
int esxVI_QueryPerf(virConnectPtr conn, esxVI_Context *ctx,
esxVI_PerfQuerySpec *querySpecList,
int esxVI_QueryPerf(esxVI_Context *ctx, esxVI_PerfQuerySpec *querySpecList,
esxVI_PerfEntityMetric **perfEntityMetricList);
#endif /* __ESX_VI_METHODS_H__ */
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -29,24 +29,20 @@
#include "esx_vi.h"
int
esxVMX_SCSIDiskNameToControllerAndID(virConnectPtr conn, const char *name,
int *controller, int *id);
esxVMX_SCSIDiskNameToControllerAndID(const char *name, int *controller, int *id);
int
esxVMX_IDEDiskNameToControllerAndID(virConnectPtr conn, const char *name,
int *controller, int *id);
esxVMX_IDEDiskNameToControllerAndID(const char *name, int *controller, int *id);
int
esxVMX_FloppyDiskNameToController(virConnectPtr conn, const char *name,
int *controller);
esxVMX_FloppyDiskNameToController(const char *name, int *controller);
int
esxVMX_GatherSCSIControllers(virConnectPtr conn, virDomainDefPtr conf,
char *virtualDev[4], int present[4]);
esxVMX_GatherSCSIControllers(virDomainDefPtr conf, char *virtualDev[4],
int present[4]);
char *
esxVMX_AbsolutePathToDatastoreRelatedPath(virConnectPtr conn,
esxVI_Context *ctx,
esxVMX_AbsolutePathToDatastoreRelatedPath(esxVI_Context *ctx,
const char *absolutePath);
......@@ -56,40 +52,38 @@ esxVMX_AbsolutePathToDatastoreRelatedPath(virConnectPtr conn,
*/
char *
esxVMX_ParseFileName(virConnectPtr conn, esxVI_Context *ctx,
const char *fileName, const char *datastoreName,
const char *directoryName);
esxVMX_ParseFileName(esxVI_Context *ctx, const char *fileName,
const char *datastoreName, const char *directoryName);
virDomainDefPtr
esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
const char *datastoreName, const char *directoryName,
esxVI_APIVersion apiVersion);
int
esxVMX_ParseVNC(virConnectPtr conn, virConfPtr conf, virDomainGraphicsDefPtr *def);
esxVMX_ParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def);
int
esxVMX_ParseSCSIController(virConnectPtr conn, virConfPtr conf,
int controller, int *present, char **virtualDev);
esxVMX_ParseSCSIController(virConfPtr conf, int controller, int *present,
char **virtualDev);
int
esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
int device, int bus, int controller, int id,
const char *virtualDev, const char *datastoreName,
const char *directoryName, virDomainDiskDefPtr *def);
esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
int controller, int id, const char *virtualDev,
const char *datastoreName, const char *directoryName,
virDomainDiskDefPtr *def);
int
esxVMX_ParseEthernet(virConnectPtr conn, virConfPtr conf, int controller,
virDomainNetDefPtr *def);
esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def);
int
esxVMX_ParseSerial(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
int port, const char *datastoreName,
const char *directoryName, virDomainChrDefPtr *def);
esxVMX_ParseSerial(esxVI_Context *ctx, virConfPtr conf, int port,
const char *datastoreName, const char *directoryName,
virDomainChrDefPtr *def);
int
esxVMX_ParseParallel(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
int port, const char *datastoreName,
const char *directoryName, virDomainChrDefPtr *def);
esxVMX_ParseParallel(esxVI_Context *ctx, virConfPtr conf, int port,
const char *datastoreName, const char *directoryName,
virDomainChrDefPtr *def);
......@@ -98,37 +92,37 @@ esxVMX_ParseParallel(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
*/
char *
esxVMX_FormatFileName(virConnectPtr conn, esxVI_Context *ctx, const char *src);
esxVMX_FormatFileName(esxVI_Context *ctx, const char *src);
char *
esxVMX_FormatConfig(virConnectPtr conn, esxVI_Context *ctx,
virDomainDefPtr def, esxVI_APIVersion apiVersion);
esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
esxVI_APIVersion apiVersion);
int
esxVMX_FormatVNC(virConnectPtr conn, virDomainGraphicsDefPtr def, virBufferPtr buffer);
esxVMX_FormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer);
int
esxVMX_FormatHardDisk(virConnectPtr conn, esxVI_Context *ctx,
virDomainDiskDefPtr def, virBufferPtr buffer);
esxVMX_FormatHardDisk(esxVI_Context *ctx, virDomainDiskDefPtr def,
virBufferPtr buffer);
int
esxVMX_FormatCDROM(virConnectPtr conn, esxVI_Context *ctx,
virDomainDiskDefPtr def, virBufferPtr buffer);
esxVMX_FormatCDROM(esxVI_Context *ctx, virDomainDiskDefPtr def,
virBufferPtr buffer);
int
esxVMX_FormatFloppy(virConnectPtr conn, esxVI_Context *ctx,
virDomainDiskDefPtr def, virBufferPtr buffer);
esxVMX_FormatFloppy(esxVI_Context *ctx, virDomainDiskDefPtr def,
virBufferPtr buffer);
int
esxVMX_FormatEthernet(virConnectPtr conn, virDomainNetDefPtr def,
int controller, virBufferPtr buffer);
esxVMX_FormatEthernet(virDomainNetDefPtr def, int controller,
virBufferPtr buffer);
int
esxVMX_FormatSerial(virConnectPtr conn, esxVI_Context *ctx,
virDomainChrDefPtr def, virBufferPtr buffer);
esxVMX_FormatSerial(esxVI_Context *ctx, virDomainChrDefPtr def,
virBufferPtr buffer);
int
esxVMX_FormatParallel(virConnectPtr conn, esxVI_Context *ctx,
virDomainChrDefPtr def, virBufferPtr buffer);
esxVMX_FormatParallel(esxVI_Context *ctx, virDomainChrDefPtr def,
virBufferPtr buffer);
#endif /* __ESX_VMX_H__ */
......@@ -122,8 +122,7 @@ testParseDatastoreRelatedPath(const void *data ATTRIBUTE_UNUSED)
VIR_FREE(directoryName);
VIR_FREE(fileName);
if (esxUtil_ParseDatastoreRelatedPath(NULL,
paths[i].datastoreRelatedPath,
if (esxUtil_ParseDatastoreRelatedPath(paths[i].datastoreRelatedPath,
&datastoreName, &directoryName,
&fileName) != paths[i].result) {
goto failure;
......
......@@ -35,7 +35,7 @@ testCompareFiles(const char *vmx, const char *xml, esxVI_APIVersion apiVersion)
goto failure;
}
def = esxVMX_ParseConfig(NULL, NULL, vmxData, "datastore", "directory",
def = esxVMX_ParseConfig(NULL, vmxData, "datastore", "directory",
apiVersion);
if (def == NULL) {
......
......@@ -89,7 +89,7 @@ testCompareFiles(const char *xml, const char *vmx, esxVI_APIVersion apiVersion)
goto failure;
}
formatted = esxVMX_FormatConfig(NULL, NULL, def, apiVersion);
formatted = esxVMX_FormatConfig(NULL, def, apiVersion);
if (formatted == NULL) {
goto failure;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册