#define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_ERROR(conn, code, fmt...) \
- virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+#define ESX_ERROR(code, fmt...) \
+ virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, fmt)
static int esxDomainGetMaxVcpus(virDomainPtr domain);
static esxVI_Boolean
-esxSupportsLongMode(virConnectPtr conn)
+esxSupportsLongMode(esxPrivate *priv)
{
- esxPrivate *priv = (esxPrivate *)conn->privateData;
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *hostSystem = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL;
return priv->supportsLongMode;
}
- if (esxVI_EnsureSession(conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueToList(conn, &propertyNameList,
+ if (esxVI_String_AppendValueToList(&propertyNameList,
"hardware.cpuFeature") < 0 ||
- esxVI_LookupObjectContentByType(conn, priv->host,
- priv->host->hostFolder,
+ esxVI_LookupObjectContentByType(priv->host, priv->host->hostFolder,
"HostSystem", propertyNameList,
esxVI_Boolean_True, &hostSystem) < 0) {
goto failure;
}
if (hostSystem == NULL) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not retrieve the HostSystem object");
goto failure;
}
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "hardware.cpuFeature")) {
if (esxVI_HostCpuIdInfo_CastListFromAnyType
- (conn, dynamicProperty->val, &hostCpuIdInfoList) < 0) {
+ (dynamicProperty->val, &hostCpuIdInfoList) < 0) {
goto failure;
}
if (sscanf(hostCpuIdInfo->edx,
"%*c%*c%c%*c:"_SKIP12":"_SKIP12":%*c%*c%*c%c",
&edxLongModeBit, &edxFirstBit) != 2) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"HostSystem property 'hardware.cpuFeature[].edx' "
"with value '%s' doesn't have expected format "
"'----:----:----:----:----:----:----:----'",
} else if (edxLongModeBit == '0') {
priv->supportsLongMode = esxVI_Boolean_False;
} else {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Bit 29 (Long Mode) of HostSystem property "
"'hardware.cpuFeature[].edx' with value '%s' "
"has unexpected value '%c', expecting '0' "
static virCapsPtr
-esxCapsInit(virConnectPtr conn)
+esxCapsInit(esxPrivate *priv)
{
- esxVI_Boolean supportsLongMode = esxSupportsLongMode(conn);
+ esxVI_Boolean supportsLongMode = esxSupportsLongMode(priv);
virCapsPtr caps = NULL;
virCapsGuestPtr guest = NULL;
}
if (caps == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
return NULL;
}
/* Allocate per-connection private data */
if (VIR_ALLOC(priv) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
priv->autoAnswer = esxVI_Boolean_False;
priv->usedCpuTimeCounterId = -1;
- if (esxUtil_ParseQuery(conn, &priv->transport, &vCenter, &noVerify,
+ if (esxUtil_ParseQuery(conn->uri, &priv->transport, &vCenter, &noVerify,
&autoAnswer) < 0) {
goto failure;
}
}
/* Login to host */
- if (esxUtil_ResolveHostname(conn, conn->uri->server, hostIpAddress,
+ if (esxUtil_ResolveHostname(conn->uri->server, hostIpAddress,
NI_MAXHOST) < 0) {
goto failure;
}
if (virAsprintf(&url, "%s://%s:%d/sdk", priv->transport,
conn->uri->server, conn->uri->port) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
username = strdup(conn->uri->user);
if (username == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
} else {
username = esxUtil_RequestUsername(auth, "root", conn->uri->server);
if (username == NULL) {
- ESX_ERROR(conn, VIR_ERR_AUTH_FAILED, "Username request failed");
+ ESX_ERROR(VIR_ERR_AUTH_FAILED, "Username request failed");
goto failure;
}
}
- if (esxVI_Context_Alloc(conn, &priv->host) < 0) {
+ if (esxVI_Context_Alloc(&priv->host) < 0) {
goto failure;
}
password = esxUtil_RequestPassword(auth, username, conn->uri->server);
if (password == NULL) {
- ESX_ERROR(conn, VIR_ERR_AUTH_FAILED, "Password request failed");
+ ESX_ERROR(VIR_ERR_AUTH_FAILED, "Password request failed");
goto failure;
}
- if (esxVI_Context_Connect(conn, priv->host, url, hostIpAddress,
- username, password, noVerify) < 0) {
+ if (esxVI_Context_Connect(priv->host, url, hostIpAddress, username,
+ password, noVerify) < 0) {
goto failure;
}
if (STRCASEEQ(conn->uri->scheme, "esx")) {
if (priv->host->productVersion != esxVI_ProductVersion_ESX35 &&
priv->host->productVersion != esxVI_ProductVersion_ESX40) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"%s is neither an ESX 3.5 host nor an ESX 4.0 host",
conn->uri->server);
goto failure;
}
} else { /* GSX */
if (priv->host->productVersion != esxVI_ProductVersion_GSX20) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"%s isn't a GSX 2.0 host", conn->uri->server);
goto failure;
}
}
/* Query the host for maintenance mode and vCenter IP address */
- if (esxVI_String_AppendValueListToList(conn, &propertyNameList,
+ if (esxVI_String_AppendValueListToList(&propertyNameList,
"runtime.inMaintenanceMode\0"
"summary.managementServerIp\0") < 0 ||
- esxVI_LookupHostSystemByIp(conn, priv->host, hostIpAddress,
- propertyNameList, &hostSystem) < 0) {
+ esxVI_LookupHostSystemByIp(priv->host, hostIpAddress, propertyNameList,
+ &hostSystem) < 0) {
goto failure;
}
for (dynamicProperty = hostSystem->propSet; dynamicProperty != NULL;
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "runtime.inMaintenanceMode")) {
- if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_Boolean) < 0) {
goto failure;
}
/* If a vCenter is specified resolve the hostname */
if (STRNEQ(vCenter, "*") &&
- esxUtil_ResolveHostname(conn, vCenter, vCenterIpAddress,
+ esxUtil_ResolveHostname(vCenter, vCenterIpAddress,
NI_MAXHOST) < 0) {
goto failure;
}
for (dynamicProperty = hostSystem->propSet; dynamicProperty != NULL;
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "summary.managementServerIp")) {
- if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_String) < 0) {
goto failure;
}
vCenter = strdup(dynamicProperty->val->string);
if (vCenter == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
if (virStrcpyStatic(vCenterIpAddress,
dynamicProperty->val->string) == NULL) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"vCenter IP address %s too big for "
"destination", dynamicProperty->val->string);
goto failure;
}
} else if (STRNEQ(vCenterIpAddress,
dynamicProperty->val->string)) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"This host is managed by a vCenter with IP "
"address %s, but a mismachting vCenter '%s' "
"(%s) has been specified",
}
if (STREQ(vCenter, "*")) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"This host is not managed by a vCenter");
goto failure;
}
if (virAsprintf(&url, "%s://%s/sdk", priv->transport,
vCenter) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
- if (esxVI_Context_Alloc(conn, &priv->vCenter) < 0) {
+ if (esxVI_Context_Alloc(&priv->vCenter) < 0) {
goto failure;
}
username = esxUtil_RequestUsername(auth, "administrator", vCenter);
if (username == NULL) {
- ESX_ERROR(conn, VIR_ERR_AUTH_FAILED,
- "Username request failed");
+ ESX_ERROR(VIR_ERR_AUTH_FAILED, "Username request failed");
goto failure;
}
password = esxUtil_RequestPassword(auth, username, vCenter);
if (password == NULL) {
- ESX_ERROR(conn, VIR_ERR_AUTH_FAILED,
- "Password request failed");
+ ESX_ERROR(VIR_ERR_AUTH_FAILED, "Password request failed");
goto failure;
}
- if (esxVI_Context_Connect(conn, priv->vCenter, url,
- vCenterIpAddress, username, password,
- noVerify) < 0) {
+ if (esxVI_Context_Connect(priv->vCenter, url, vCenterIpAddress,
+ username, password, noVerify) < 0) {
goto failure;
}
if (priv->vCenter->productVersion != esxVI_ProductVersion_VPX25 &&
priv->vCenter->productVersion != esxVI_ProductVersion_VPX40) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"%s is neither a vCenter 2.5 server nor a vCenter "
- "4.0 server",
- conn->uri->server);
+ "4.0 server", conn->uri->server);
goto failure;
}
}
conn->privateData = priv;
/* Setup capabilities */
- priv->caps = esxCapsInit(conn);
+ priv->caps = esxCapsInit(priv);
if (priv->caps == NULL) {
goto failure;
{
esxPrivate *priv = (esxPrivate *)conn->privateData;
- esxVI_EnsureSession(conn, priv->host);
+ esxVI_EnsureSession(priv->host);
- esxVI_Logout(conn, priv->host);
+ esxVI_Logout(priv->host);
esxVI_Context_Free(&priv->host);
if (priv->vCenter != NULL) {
- esxVI_EnsureSession(conn, priv->vCenter);
+ esxVI_EnsureSession(priv->vCenter);
- esxVI_Logout(conn, priv->vCenter);
+ esxVI_Logout(priv->vCenter);
esxVI_Context_Free(&priv->vCenter);
}
static esxVI_Boolean
-esxSupportsVMotion(virConnectPtr conn)
+esxSupportsVMotion(esxPrivate *priv)
{
- esxPrivate *priv = (esxPrivate *)conn->privateData;
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *hostSystem = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL;
return priv->supportsVMotion;
}
- if (esxVI_EnsureSession(conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueToList(conn, &propertyNameList,
+ if (esxVI_String_AppendValueToList(&propertyNameList,
"capability.vmotionSupported") < 0 ||
- esxVI_LookupObjectContentByType(conn, priv->host,
- priv->host->hostFolder,
+ esxVI_LookupObjectContentByType(priv->host, priv->host->hostFolder,
"HostSystem", propertyNameList,
esxVI_Boolean_True, &hostSystem) < 0) {
goto failure;
}
if (hostSystem == NULL) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not retrieve the HostSystem object");
goto failure;
}
for (dynamicProperty = hostSystem->propSet; dynamicProperty != NULL;
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "capability.vmotionSupported")) {
- if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_Boolean) < 0) {
goto failure;
}
switch (feature) {
case VIR_DRV_FEATURE_MIGRATION_V1:
- supportsVMotion = esxSupportsVMotion(conn);
+ supportsVMotion = esxSupportsVMotion(priv);
if (supportsVMotion == esxVI_Boolean_Undefined) {
return -1;
return 0;
failure:
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting version to match 'major.minor.release', but got '%s'",
priv->host->service->about->version);
const char *domainName = NULL;
char *complete = NULL;
- if (esxVI_EnsureSession(conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
if (esxVI_String_AppendValueListToList
- (conn, &propertyNameList,
+ (&propertyNameList,
"config.network.dnsConfig.hostName\0"
"config.network.dnsConfig.domainName\0") < 0 ||
- esxVI_LookupObjectContentByType(conn, priv->host,
- priv->host->hostFolder,
+ esxVI_LookupObjectContentByType(priv->host, priv->host->hostFolder,
"HostSystem", propertyNameList,
esxVI_Boolean_True, &hostSystem) < 0) {
goto failure;
}
if (hostSystem == NULL) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not retrieve the HostSystem object");
goto failure;
}
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name,
"config.network.dnsConfig.hostName")) {
- if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_String) < 0) {
goto failure;
}
hostName = dynamicProperty->val->string;
} else if (STREQ(dynamicProperty->name,
"config.network.dnsConfig.domainName")) {
- if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_String) < 0) {
goto failure;
}
}
if (hostName == NULL || strlen(hostName) < 1) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing or empty 'hostName' property");
goto failure;
}
complete = strdup(hostName);
if (complete == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
} else {
if (virAsprintf(&complete, "%s.%s", hostName, domainName) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
}
memset(nodeinfo, 0, sizeof(virNodeInfo));
- if (esxVI_EnsureSession(conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueListToList(conn, &propertyNameList,
+ if (esxVI_String_AppendValueListToList(&propertyNameList,
"hardware.cpuInfo.hz\0"
"hardware.cpuInfo.numCpuCores\0"
"hardware.cpuInfo.numCpuPackages\0"
"hardware.memorySize\0"
"hardware.numaInfo.numNodes\0"
"summary.hardware.cpuModel\0") < 0 ||
- esxVI_LookupObjectContentByType(conn, priv->host,
- priv->host->hostFolder,
+ esxVI_LookupObjectContentByType(priv->host, priv->host->hostFolder,
"HostSystem", propertyNameList,
esxVI_Boolean_True, &hostSystem) < 0) {
goto failure;
}
if (hostSystem == NULL) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not retrieve the HostSystem object");
goto failure;
}
for (dynamicProperty = hostSystem->propSet; dynamicProperty != NULL;
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "hardware.cpuInfo.hz")) {
- if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_Long) < 0) {
goto failure;
}
cpuInfo_hz = dynamicProperty->val->int64;
} else if (STREQ(dynamicProperty->name,
"hardware.cpuInfo.numCpuCores")) {
- if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_Short) < 0) {
goto failure;
}
cpuInfo_numCpuCores = dynamicProperty->val->int16;
} else if (STREQ(dynamicProperty->name,
"hardware.cpuInfo.numCpuPackages")) {
- if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_Short) < 0) {
goto failure;
}
cpuInfo_numCpuPackages = dynamicProperty->val->int16;
} else if (STREQ(dynamicProperty->name,
"hardware.cpuInfo.numCpuThreads")) {
- if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_Short) < 0) {
goto failure;
}
cpuInfo_numCpuThreads = dynamicProperty->val->int16;
} else if (STREQ(dynamicProperty->name, "hardware.memorySize")) {
- if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_Long) < 0) {
goto failure;
}
memorySize = dynamicProperty->val->int64;
} else if (STREQ(dynamicProperty->name,
"hardware.numaInfo.numNodes")) {
- if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_Int) < 0) {
goto failure;
}
numaInfo_numNodes = dynamicProperty->val->int32;
} else if (STREQ(dynamicProperty->name,
"summary.hardware.cpuModel")) {
- if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_String) < 0) {
goto failure;
}
if (virStrncpy(nodeinfo->model, dynamicProperty->val->string,
sizeof(nodeinfo->model) - 1,
sizeof(nodeinfo->model)) == NULL) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"CPU Model %s too long for destination",
dynamicProperty->val->string);
goto failure;
char *xml = virCapabilitiesFormatXML(priv->caps);
if (xml == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
return NULL;
}
return 0;
}
- if (esxVI_EnsureSession(conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueToList(conn, &propertyNameList,
+ if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
- esxVI_LookupObjectContentByType(conn, priv->host, priv->host->vmFolder,
+ esxVI_LookupObjectContentByType(priv->host, priv->host->vmFolder,
"VirtualMachine", propertyNameList,
esxVI_Boolean_True,
&virtualMachineList) < 0) {
for (virtualMachine = virtualMachineList; virtualMachine != NULL;
virtualMachine = virtualMachine->_next) {
- if (esxVI_GetVirtualMachinePowerState(conn, virtualMachine,
+ if (esxVI_GetVirtualMachinePowerState(virtualMachine,
&powerState) < 0) {
goto failure;
}
if (esxUtil_ParseVirtualMachineIDString(virtualMachine->obj->value,
&ids[count]) < 0 ||
ids[count] <= 0) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Failed to parse positive integer from '%s'",
virtualMachine->obj->value);
goto failure;
{
esxPrivate *priv = (esxPrivate *)conn->privateData;
- if (esxVI_EnsureSession(conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
return -1;
}
return esxVI_LookupNumberOfDomainsByPowerState
- (conn, priv->host, esxVI_VirtualMachinePowerState_PoweredOn,
+ (priv->host, esxVI_VirtualMachinePowerState_PoweredOn,
esxVI_Boolean_False);
}
unsigned char uuid_candidate[VIR_UUID_BUFLEN];
virDomainPtr domain = NULL;
- if (esxVI_EnsureSession(conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueListToList(conn, &propertyNameList,
+ if (esxVI_String_AppendValueListToList(&propertyNameList,
"configStatus\0"
"name\0"
"runtime.powerState\0"
"config.uuid\0") < 0 ||
- esxVI_LookupObjectContentByType(conn, priv->host, priv->host->vmFolder,
+ esxVI_LookupObjectContentByType(priv->host, priv->host->vmFolder,
"VirtualMachine", propertyNameList,
esxVI_Boolean_True,
&virtualMachineList) < 0) {
for (virtualMachine = virtualMachineList; virtualMachine != NULL;
virtualMachine = virtualMachine->_next) {
- if (esxVI_GetVirtualMachinePowerState(conn, virtualMachine,
+ if (esxVI_GetVirtualMachinePowerState(virtualMachine,
&powerState) < 0) {
goto failure;
}
VIR_FREE(name_candidate);
- if (esxVI_GetVirtualMachineIdentity(conn, virtualMachine,
+ if (esxVI_GetVirtualMachineIdentity(virtualMachine,
&id_candidate, &name_candidate,
uuid_candidate) < 0) {
goto failure;
}
if (domain == NULL) {
- ESX_ERROR(conn, VIR_ERR_NO_DOMAIN, "No domain with ID %d", id);
+ ESX_ERROR(VIR_ERR_NO_DOMAIN, "No domain with ID %d", id);
}
cleanup:
char *name = NULL;
virDomainPtr domain = NULL;
- if (esxVI_EnsureSession(conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueListToList(conn, &propertyNameList,
+ if (esxVI_String_AppendValueListToList(&propertyNameList,
"name\0"
"runtime.powerState\0") < 0 ||
- esxVI_LookupVirtualMachineByUuid(conn, priv->host, uuid,
- propertyNameList, &virtualMachine,
+ esxVI_LookupVirtualMachineByUuid(priv->host, uuid, propertyNameList,
+ &virtualMachine,
esxVI_Occurrence_RequiredItem) < 0 ||
- esxVI_GetVirtualMachineIdentity(conn, virtualMachine,
- &id, &name, NULL) < 0 ||
- esxVI_GetVirtualMachinePowerState(conn, virtualMachine,
- &powerState) < 0) {
+ esxVI_GetVirtualMachineIdentity(virtualMachine, &id, &name, NULL) < 0 ||
+ esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0) {
goto failure;
}
unsigned char uuid_candidate[VIR_UUID_BUFLEN];
virDomainPtr domain = NULL;
- if (esxVI_EnsureSession(conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueListToList(conn, &propertyNameList,
+ if (esxVI_String_AppendValueListToList(&propertyNameList,
"configStatus\0"
"name\0"
"runtime.powerState\0"
"config.uuid\0") < 0 ||
- esxVI_LookupObjectContentByType(conn, priv->host, priv->host->vmFolder,
+ esxVI_LookupObjectContentByType(priv->host, priv->host->vmFolder,
"VirtualMachine", propertyNameList,
esxVI_Boolean_True,
&virtualMachineList) < 0) {
virtualMachine = virtualMachine->_next) {
VIR_FREE(name_candidate);
- if (esxVI_GetVirtualMachineIdentity(conn, virtualMachine,
+ if (esxVI_GetVirtualMachineIdentity(virtualMachine,
&id_candidate, &name_candidate,
uuid_candidate) < 0) {
goto failure;
continue;
}
- if (esxVI_GetVirtualMachinePowerState(conn, virtualMachine,
+ if (esxVI_GetVirtualMachinePowerState(virtualMachine,
&powerState) < 0) {
goto failure;
}
}
if (domain == NULL) {
- ESX_ERROR(conn, VIR_ERR_NO_DOMAIN, "No domain with name '%s'", name);
+ ESX_ERROR(VIR_ERR_NO_DOMAIN, "No domain with name '%s'", name);
}
cleanup:
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+ if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
esxVI_LookupVirtualMachineByUuidAndPrepareForTask
- (domain->conn, priv->host, domain->uuid, propertyNameList,
- &virtualMachine, priv->autoAnswer) < 0 ||
- esxVI_GetVirtualMachinePowerState(domain->conn, virtualMachine,
- &powerState) < 0) {
+ (priv->host, domain->uuid, propertyNameList, &virtualMachine,
+ priv->autoAnswer) < 0 ||
+ esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0) {
goto failure;
}
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
- ESX_ERROR(domain->conn, VIR_ERR_OPERATION_INVALID,
- "Domain is not powered on");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered on");
goto failure;
}
- if (esxVI_SuspendVM_Task(domain->conn, priv->host, virtualMachine->obj,
- &task) < 0 ||
- esxVI_WaitForTaskCompletion(domain->conn, priv->host, task,
- domain->uuid, priv->autoAnswer,
- &taskInfoState) < 0) {
+ if (esxVI_SuspendVM_Task(priv->host, virtualMachine->obj, &task) < 0 ||
+ esxVI_WaitForTaskCompletion(priv->host, task, domain->uuid,
+ priv->autoAnswer, &taskInfoState) < 0) {
goto failure;
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
- "Could not suspend domain");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not suspend domain");
goto failure;
}
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+ if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
esxVI_LookupVirtualMachineByUuidAndPrepareForTask
- (domain->conn, priv->host, domain->uuid, propertyNameList,
- &virtualMachine, priv->autoAnswer) < 0 ||
- esxVI_GetVirtualMachinePowerState(domain->conn, virtualMachine,
- &powerState) < 0) {
+ (priv->host, domain->uuid, propertyNameList, &virtualMachine,
+ priv->autoAnswer) < 0 ||
+ esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0) {
goto failure;
}
if (powerState != esxVI_VirtualMachinePowerState_Suspended) {
- ESX_ERROR(domain->conn, VIR_ERR_OPERATION_INVALID,
- "Domain is not suspended");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not suspended");
goto failure;
}
- if (esxVI_PowerOnVM_Task(domain->conn, priv->host, virtualMachine->obj,
- &task) < 0 ||
- esxVI_WaitForTaskCompletion(domain->conn, priv->host, task,
- domain->uuid, priv->autoAnswer,
- &taskInfoState) < 0) {
+ if (esxVI_PowerOnVM_Task(priv->host, virtualMachine->obj, &task) < 0 ||
+ esxVI_WaitForTaskCompletion(priv->host, task, domain->uuid,
+ priv->autoAnswer, &taskInfoState) < 0) {
goto failure;
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
- "Could not resume domain");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not resume domain");
goto failure;
}
esxVI_String *propertyNameList = NULL;
esxVI_VirtualMachinePowerState powerState;
- if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+ if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
- esxVI_LookupVirtualMachineByUuid(domain->conn, priv->host,
- domain->uuid, propertyNameList,
- &virtualMachine,
+ esxVI_LookupVirtualMachineByUuid(priv->host, domain->uuid,
+ propertyNameList, &virtualMachine,
esxVI_Occurrence_RequiredItem) < 0 ||
- esxVI_GetVirtualMachinePowerState(domain->conn, virtualMachine,
- &powerState) < 0) {
+ esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0) {
goto failure;
}
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
- ESX_ERROR(domain->conn, VIR_ERR_OPERATION_INVALID,
- "Domain is not powered on");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered on");
goto failure;
}
- if (esxVI_ShutdownGuest(domain->conn, priv->host,
- virtualMachine->obj) < 0) {
+ if (esxVI_ShutdownGuest(priv->host, virtualMachine->obj) < 0) {
goto failure;
}
esxVI_String *propertyNameList = NULL;
esxVI_VirtualMachinePowerState powerState;
- if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+ if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
- esxVI_LookupVirtualMachineByUuid(domain->conn, priv->host,
- domain->uuid, propertyNameList,
- &virtualMachine,
+ esxVI_LookupVirtualMachineByUuid(priv->host, domain->uuid,
+ propertyNameList, &virtualMachine,
esxVI_Occurrence_RequiredItem) < 0 ||
- esxVI_GetVirtualMachinePowerState(domain->conn, virtualMachine,
- &powerState) < 0) {
+ esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0) {
goto failure;
}
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
- ESX_ERROR(domain->conn, VIR_ERR_OPERATION_INVALID,
- "Domain is not powered on");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered on");
goto failure;
}
- if (esxVI_RebootGuest(domain->conn, priv->host, virtualMachine->obj) < 0) {
+ if (esxVI_RebootGuest(priv->host, virtualMachine->obj) < 0) {
goto failure;
}
ctx = priv->host;
}
- if (esxVI_EnsureSession(domain->conn, ctx) < 0) {
+ if (esxVI_EnsureSession(ctx) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+ if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
esxVI_LookupVirtualMachineByUuidAndPrepareForTask
- (domain->conn, ctx, domain->uuid, propertyNameList, &virtualMachine,
+ (ctx, domain->uuid, propertyNameList, &virtualMachine,
priv->autoAnswer) < 0 ||
- esxVI_GetVirtualMachinePowerState(domain->conn, virtualMachine,
- &powerState) < 0) {
+ esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0) {
goto failure;
}
if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
- ESX_ERROR(domain->conn, VIR_ERR_OPERATION_INVALID,
- "Domain is not powered on");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered on");
goto failure;
}
- if (esxVI_PowerOffVM_Task(domain->conn, ctx, virtualMachine->obj,
- &task) < 0 ||
- esxVI_WaitForTaskCompletion(domain->conn, ctx, task, domain->uuid,
- priv->autoAnswer, &taskInfoState) < 0) {
+ if (esxVI_PowerOffVM_Task(ctx, virtualMachine->obj, &task) < 0 ||
+ esxVI_WaitForTaskCompletion(ctx, task, domain->uuid, priv->autoAnswer,
+ &taskInfoState) < 0) {
goto failure;
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
- "Could not destroy domain");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not destroy domain");
goto failure;
}
static char *
-esxDomainGetOSType(virDomainPtr domain)
+esxDomainGetOSType(virDomainPtr domain ATTRIBUTE_UNUSED)
{
char *osType = strdup("hvm");
if (osType == NULL) {
- virReportOOMError(domain->conn);
+ virReportOOMError(NULL);
return NULL;
}
esxVI_DynamicProperty *dynamicProperty = NULL;
unsigned long memoryMB = 0;
- if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+ if (esxVI_String_AppendValueToList(&propertyNameList,
"config.hardware.memoryMB") < 0 ||
- esxVI_LookupVirtualMachineByUuid(domain->conn, priv->host,
- domain->uuid, propertyNameList,
- &virtualMachine,
+ esxVI_LookupVirtualMachineByUuid(priv->host, domain->uuid,
+ propertyNameList, &virtualMachine,
esxVI_Occurrence_RequiredItem) < 0) {
goto failure;
}
for (dynamicProperty = virtualMachine->propSet; dynamicProperty != NULL;
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "config.hardware.memoryMB")) {
- if (esxVI_AnyType_ExpectType(domain->conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_Int) < 0) {
goto failure;
}
if (dynamicProperty->val->int32 < 0) {
- ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
- "Got invalid memory size %d",
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Got invalid memory size %d",
dynamicProperty->val->int32);
} else {
memoryMB = dynamicProperty->val->int32;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
if (esxVI_LookupVirtualMachineByUuidAndPrepareForTask
- (domain->conn, priv->host, domain->uuid, NULL, &virtualMachine,
+ (priv->host, domain->uuid, NULL, &virtualMachine,
priv->autoAnswer) < 0 ||
- esxVI_VirtualMachineConfigSpec_Alloc(domain->conn, &spec) < 0 ||
- esxVI_Long_Alloc(domain->conn, &spec->memoryMB) < 0) {
+ esxVI_VirtualMachineConfigSpec_Alloc(&spec) < 0 ||
+ esxVI_Long_Alloc(&spec->memoryMB) < 0) {
goto failure;
}
spec->memoryMB->value =
memory / 1024; /* Scale from kilobytes to megabytes */
- if (esxVI_ReconfigVM_Task(domain->conn, priv->host, virtualMachine->obj,
- spec, &task) < 0 ||
- esxVI_WaitForTaskCompletion(domain->conn, priv->host, task,
- domain->uuid, priv->autoAnswer,
- &taskInfoState) < 0) {
+ if (esxVI_ReconfigVM_Task(priv->host, virtualMachine->obj, spec,
+ &task) < 0 ||
+ esxVI_WaitForTaskCompletion(priv->host, task, domain->uuid,
+ priv->autoAnswer, &taskInfoState) < 0) {
goto failure;
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not set max-memory to %lu kilobytes", memory);
goto failure;
}
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
if (esxVI_LookupVirtualMachineByUuidAndPrepareForTask
- (domain->conn, priv->host, domain->uuid, NULL, &virtualMachine,
+ (priv->host, domain->uuid, NULL, &virtualMachine,
priv->autoAnswer) < 0 ||
- esxVI_VirtualMachineConfigSpec_Alloc(domain->conn, &spec) < 0 ||
- esxVI_ResourceAllocationInfo_Alloc(domain->conn,
- &spec->memoryAllocation) < 0 ||
- esxVI_Long_Alloc(domain->conn, &spec->memoryAllocation->limit) < 0) {
+ esxVI_VirtualMachineConfigSpec_Alloc(&spec) < 0 ||
+ esxVI_ResourceAllocationInfo_Alloc(&spec->memoryAllocation) < 0 ||
+ esxVI_Long_Alloc(&spec->memoryAllocation->limit) < 0) {
goto failure;
}
spec->memoryAllocation->limit->value =
memory / 1024; /* Scale from kilobytes to megabytes */
- if (esxVI_ReconfigVM_Task(domain->conn, priv->host, virtualMachine->obj,
- spec, &task) < 0 ||
- esxVI_WaitForTaskCompletion(domain->conn, priv->host, task,
- domain->uuid, priv->autoAnswer,
- &taskInfoState) < 0) {
+ if (esxVI_ReconfigVM_Task(priv->host, virtualMachine->obj, spec,
+ &task) < 0 ||
+ esxVI_WaitForTaskCompletion(priv->host, task, domain->uuid,
+ priv->autoAnswer, &taskInfoState) < 0) {
goto failure;
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not set memory to %lu kilobytes", memory);
goto failure;
}
esxVI_PerfMetricIntSeries *perfMetricIntSeries = NULL;
esxVI_Long *value = NULL;
- if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueListToList(domain->conn, &propertyNameList,
+ if (esxVI_String_AppendValueListToList(&propertyNameList,
"runtime.powerState\0"
"config.hardware.memoryMB\0"
"config.hardware.numCPU\0"
"config.memoryAllocation.limit\0") < 0 ||
- esxVI_LookupVirtualMachineByUuid(domain->conn, priv->host,
- domain->uuid, propertyNameList,
- &virtualMachine,
+ esxVI_LookupVirtualMachineByUuid(priv->host, domain->uuid,
+ propertyNameList, &virtualMachine,
esxVI_Occurrence_RequiredItem) < 0) {
goto failure;
}
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "runtime.powerState")) {
if (esxVI_VirtualMachinePowerState_CastFromAnyType
- (domain->conn, dynamicProperty->val, &powerState) < 0) {
+ (dynamicProperty->val, &powerState) < 0) {
goto failure;
}
break;
}
} else if (STREQ(dynamicProperty->name, "config.hardware.memoryMB")) {
- if (esxVI_AnyType_ExpectType(domain->conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_Int) < 0) {
goto failure;
}
info->maxMem = dynamicProperty->val->int32 * 1024; /* Scale from megabyte to kilobyte */
} else if (STREQ(dynamicProperty->name, "config.hardware.numCPU")) {
- if (esxVI_AnyType_ExpectType(domain->conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_Int) < 0) {
goto failure;
}
info->nrVirtCpu = dynamicProperty->val->int32;
} else if (STREQ(dynamicProperty->name,
"config.memoryAllocation.limit")) {
- if (esxVI_AnyType_ExpectType(domain->conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_Long) < 0) {
goto failure;
}
/* Verify the cached 'used CPU time' performance counter ID */
if (info->state == VIR_DOMAIN_RUNNING && priv->usedCpuTimeCounterId >= 0) {
- if (esxVI_Int_Alloc(domain->conn, &counterId) < 0) {
+ if (esxVI_Int_Alloc(&counterId) < 0) {
goto failure;
}
counterId->value = priv->usedCpuTimeCounterId;
- if (esxVI_Int_AppendToList(domain->conn, &counterIdList,
- counterId) < 0) {
+ if (esxVI_Int_AppendToList(&counterIdList, counterId) < 0) {
goto failure;
}
- if (esxVI_QueryPerfCounter(domain->conn, priv->host, counterIdList,
+ if (esxVI_QueryPerfCounter(priv->host, counterIdList,
&perfCounterInfo) < 0) {
goto failure;
}
* counter ID and cache it, if it's not already cached.
*/
if (info->state == VIR_DOMAIN_RUNNING && priv->usedCpuTimeCounterId < 0) {
- if (esxVI_QueryAvailablePerfMetric(domain->conn, priv->host,
- virtualMachine->obj, NULL, NULL,
- NULL, &perfMetricIdList) < 0) {
+ if (esxVI_QueryAvailablePerfMetric(priv->host, virtualMachine->obj,
+ NULL, NULL, NULL,
+ &perfMetricIdList) < 0) {
goto failure;
}
counterId = NULL;
- if (esxVI_Int_DeepCopy(domain->conn, &counterId,
- perfMetricId->counterId) < 0 ||
- esxVI_Int_AppendToList(domain->conn, &counterIdList,
- counterId) < 0) {
+ if (esxVI_Int_DeepCopy(&counterId, perfMetricId->counterId) < 0 ||
+ esxVI_Int_AppendToList(&counterIdList, counterId) < 0) {
goto failure;
}
}
- if (esxVI_QueryPerfCounter(domain->conn, priv->host, counterIdList,
+ if (esxVI_QueryPerfCounter(priv->host, counterIdList,
&perfCounterInfoList) < 0) {
goto failure;
}
if (info->state == VIR_DOMAIN_RUNNING && priv->usedCpuTimeCounterId >= 0) {
VIR_DEBUG("usedCpuTimeCounterId %d BEGIN", priv->usedCpuTimeCounterId);
- if (esxVI_PerfQuerySpec_Alloc(domain->conn, &querySpec) < 0 ||
- esxVI_Int_Alloc(domain->conn, &querySpec->maxSample) < 0 ||
- esxVI_PerfMetricId_Alloc(domain->conn, &querySpec->metricId) < 0 ||
- esxVI_Int_Alloc(domain->conn,
- &querySpec->metricId->counterId) < 0) {
+ if (esxVI_PerfQuerySpec_Alloc(&querySpec) < 0 ||
+ esxVI_Int_Alloc(&querySpec->maxSample) < 0 ||
+ esxVI_PerfMetricId_Alloc(&querySpec->metricId) < 0 ||
+ esxVI_Int_Alloc(&querySpec->metricId->counterId) < 0) {
goto failure;
}
querySpec->metricId->instance = (char *)"";
querySpec->format = (char *)"normal";
-
- if (esxVI_QueryPerf(domain->conn, priv->host, querySpec,
- &perfEntityMetricList) < 0) {
+ if (esxVI_QueryPerf(priv->host, querySpec, &perfEntityMetricList) < 0) {
querySpec->entity = NULL;
querySpec->metricId->instance = NULL;
querySpec->format = NULL;
esxVI_TaskInfoState taskInfoState;
if (nvcpus < 1) {
- ESX_ERROR(domain->conn, VIR_ERR_INVALID_ARG,
- "Requested number of virtual CPUs must al least be 1");
+ ESX_ERROR(VIR_ERR_INVALID_ARG,
+ "Requested number of virtual CPUs must at least be 1");
goto failure;
}
- if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
}
if (nvcpus > maxVcpus) {
- ESX_ERROR(domain->conn, VIR_ERR_INVALID_ARG,
+ ESX_ERROR(VIR_ERR_INVALID_ARG,
"Requested number of virtual CPUs is greater than max "
"allowable number of virtual CPUs for the domain: %d > %d",
nvcpus, maxVcpus);
}
if (esxVI_LookupVirtualMachineByUuidAndPrepareForTask
- (domain->conn, priv->host, domain->uuid, NULL, &virtualMachine,
+ (priv->host, domain->uuid, NULL, &virtualMachine,
priv->autoAnswer) < 0 ||
- esxVI_VirtualMachineConfigSpec_Alloc(domain->conn, &spec) < 0 ||
- esxVI_Int_Alloc(domain->conn, &spec->numCPUs) < 0) {
+ esxVI_VirtualMachineConfigSpec_Alloc(&spec) < 0 ||
+ esxVI_Int_Alloc(&spec->numCPUs) < 0) {
goto failure;
}
spec->numCPUs->value = nvcpus;
- if (esxVI_ReconfigVM_Task(domain->conn, priv->host, virtualMachine->obj,
- spec, &task) < 0 ||
- esxVI_WaitForTaskCompletion(domain->conn, priv->host, task,
- domain->uuid, priv->autoAnswer,
- &taskInfoState) < 0) {
+ if (esxVI_ReconfigVM_Task(priv->host, virtualMachine->obj, spec,
+ &task) < 0 ||
+ esxVI_WaitForTaskCompletion(priv->host, task, domain->uuid,
+ priv->autoAnswer, &taskInfoState) < 0) {
goto failure;
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not set number of virtual CPUs to %d", nvcpus);
goto failure;
}
return priv->maxVcpus;
}
- if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+ if (esxVI_String_AppendValueToList(&propertyNameList,
"capability.maxSupportedVcpus") < 0 ||
- esxVI_LookupObjectContentByType(domain->conn, priv->host,
- priv->host->hostFolder, "HostSystem",
- propertyNameList, esxVI_Boolean_True,
- &hostSystem) < 0) {
+ esxVI_LookupObjectContentByType(priv->host, priv->host->hostFolder,
+ "HostSystem", propertyNameList,
+ esxVI_Boolean_True, &hostSystem) < 0) {
goto failure;
}
if (hostSystem == NULL) {
- ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not retrieve the HostSystem object");
goto failure;
}
for (dynamicProperty = hostSystem->propSet; dynamicProperty != NULL;
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "capability.maxSupportedVcpus")) {
- if (esxVI_AnyType_ExpectType(domain->conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_Int) < 0) {
goto failure;
}
virDomainDefPtr def = NULL;
char *xml = NULL;
- if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+ if (esxVI_String_AppendValueToList(&propertyNameList,
"config.files.vmPathName") < 0 ||
- esxVI_LookupVirtualMachineByUuid(domain->conn, priv->host,
- domain->uuid, propertyNameList,
- &virtualMachine,
+ esxVI_LookupVirtualMachineByUuid(priv->host, domain->uuid,
+ propertyNameList, &virtualMachine,
esxVI_Occurrence_RequiredItem) < 0) {
goto failure;
}
for (dynamicProperty = virtualMachine->propSet; dynamicProperty != NULL;
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "config.files.vmPathName")) {
- if (esxVI_AnyType_ExpectType(domain->conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_String) < 0) {
goto failure;
}
}
}
- if (esxUtil_ParseDatastoreRelatedPath(domain->conn, vmPathName,
- &datastoreName, &directoryName,
- &fileName) < 0) {
+ if (esxUtil_ParseDatastoreRelatedPath(vmPathName, &datastoreName,
+ &directoryName, &fileName) < 0) {
goto failure;
}
virBufferURIEncodeString(&buffer, datastoreName);
if (virBufferError(&buffer)) {
- virReportOOMError(domain->conn);
+ virReportOOMError(NULL);
goto failure;
}
url = virBufferContentAndReset(&buffer);
- if (esxVI_Context_DownloadFile(domain->conn, priv->host, url, &vmx) < 0) {
+ if (esxVI_Context_DownloadFile(priv->host, url, &vmx) < 0) {
goto failure;
}
- def = esxVMX_ParseConfig(domain->conn, priv->host, vmx, datastoreName,
- directoryName, priv->host->apiVersion);
+ def = esxVMX_ParseConfig(priv->host, vmx, datastoreName, directoryName,
+ priv->host->apiVersion);
if (def != NULL) {
xml = virDomainDefFormat(domain->conn, def, flags);
char *xml = NULL;
if (STRNEQ(nativeFormat, "vmware-vmx")) {
- ESX_ERROR(conn, VIR_ERR_INVALID_ARG,
+ ESX_ERROR(VIR_ERR_INVALID_ARG,
"Unsupported config format '%s'", nativeFormat);
return NULL;
}
- def = esxVMX_ParseConfig(conn, priv->host, nativeConfig, "?", "?",
+ def = esxVMX_ParseConfig(priv->host, nativeConfig, "?", "?",
priv->host->apiVersion);
if (def != NULL) {
char *vmx = NULL;
if (STRNEQ(nativeFormat, "vmware-vmx")) {
- ESX_ERROR(conn, VIR_ERR_INVALID_ARG,
+ ESX_ERROR(VIR_ERR_INVALID_ARG,
"Unsupported config format '%s'", nativeFormat);
return NULL;
}
return NULL;
}
- vmx = esxVMX_FormatConfig(conn, priv->host, def, priv->host->apiVersion);
+ vmx = esxVMX_FormatConfig(priv->host, def, priv->host->apiVersion);
virDomainDefFree(def);
return 0;
}
- if (esxVI_EnsureSession(conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueListToList(conn, &propertyNameList,
+ if (esxVI_String_AppendValueListToList(&propertyNameList,
"name\0"
"runtime.powerState\0") < 0 ||
- esxVI_LookupObjectContentByType(conn, priv->host, priv->host->vmFolder,
+ esxVI_LookupObjectContentByType(priv->host, priv->host->vmFolder,
"VirtualMachine", propertyNameList,
esxVI_Boolean_True,
&virtualMachineList) < 0) {
for (virtualMachine = virtualMachineList; virtualMachine != NULL;
virtualMachine = virtualMachine->_next) {
- if (esxVI_GetVirtualMachinePowerState(conn, virtualMachine,
+ if (esxVI_GetVirtualMachinePowerState(virtualMachine,
&powerState) < 0) {
goto failure;
}
dynamicProperty != NULL;
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "name")) {
- if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_String) < 0) {
goto failure;
}
names[count] = strdup(dynamicProperty->val->string);
if (names[count] == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
{
esxPrivate *priv = (esxPrivate *)conn->privateData;
- if (esxVI_EnsureSession(conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
return -1;
}
return esxVI_LookupNumberOfDomainsByPowerState
- (conn, priv->host, esxVI_VirtualMachinePowerState_PoweredOn,
+ (priv->host, esxVI_VirtualMachinePowerState_PoweredOn,
esxVI_Boolean_True);
}
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
- if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+ if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
esxVI_LookupVirtualMachineByUuidAndPrepareForTask
- (domain->conn, priv->host, domain->uuid, propertyNameList,
- &virtualMachine, priv->autoAnswer) < 0 ||
- esxVI_GetVirtualMachinePowerState(domain->conn, virtualMachine,
+ (priv->host, domain->uuid, propertyNameList, &virtualMachine,
+ priv->autoAnswer) < 0 ||
+ esxVI_GetVirtualMachinePowerState(virtualMachine,
&powerState) < 0) {
goto failure;
}
if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
- ESX_ERROR(domain->conn, VIR_ERR_OPERATION_INVALID,
- "Domain is not powered off");
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered off");
goto failure;
}
- if (esxVI_PowerOnVM_Task(domain->conn, priv->host, virtualMachine->obj,
- &task) < 0 ||
- esxVI_WaitForTaskCompletion(domain->conn, priv->host, task,
- domain->uuid, priv->autoAnswer,
- &taskInfoState) < 0) {
+ if (esxVI_PowerOnVM_Task(priv->host, virtualMachine->obj, &task) < 0 ||
+ esxVI_WaitForTaskCompletion(priv->host, task, domain->uuid,
+ priv->autoAnswer, &taskInfoState) < 0) {
goto failure;
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
- "Could not start domain");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not start domain");
goto failure;
}
esxVI_TaskInfoState taskInfoState;
virDomainPtr domain = NULL;
- if (esxVI_EnsureSession(conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
}
/* Check if an existing domain should be edited */
- if (esxVI_LookupVirtualMachineByUuid(conn, priv->host, def->uuid, NULL,
+ if (esxVI_LookupVirtualMachineByUuid(priv->host, def->uuid, NULL,
&virtualMachine,
esxVI_Occurrence_OptionalItem) < 0) {
goto failure;
if (virtualMachine != NULL) {
/* FIXME */
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Domain already exists, editing existing domains is not "
"supported yet");
goto failure;
}
/* Build VMX from domain XML */
- vmx = esxVMX_FormatConfig(conn, priv->host, def, priv->host->apiVersion);
+ vmx = esxVMX_FormatConfig(priv->host, def, priv->host->apiVersion);
if (vmx == NULL) {
goto failure;
* datastore isn't perfect but should work in the majority of cases.
*/
if (def->ndisks < 1) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Domain XML doesn't contain any disks, cannot deduce "
"datastore and path for VMX file");
goto failure;
}
if (disk == NULL) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Domain XML doesn't contain any file-based harddisks, "
"cannot deduce datastore and path for VMX file");
goto failure;
}
if (disk->src == NULL) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"First file-based harddisk has no source, cannot deduce "
"datastore and path for VMX file");
goto failure;
}
- if (esxUtil_ParseDatastoreRelatedPath(conn, disk->src, &datastoreName,
+ if (esxUtil_ParseDatastoreRelatedPath(disk->src, &datastoreName,
&directoryName, &fileName) < 0) {
goto failure;
}
if (! virFileHasSuffix(fileName, ".vmdk")) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting source '%s' of first file-based harddisk to be a "
"VMDK image", disk->src);
goto failure;
virBufferURIEncodeString(&buffer, datastoreName);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
if (directoryName != NULL) {
if (virAsprintf(&datastoreRelatedPath, "[%s] %s/%s.vmx", datastoreName,
directoryName, def->name) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
} else {
if (virAsprintf(&datastoreRelatedPath, "[%s] %s.vmx", datastoreName,
def->name) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
}
/* Get resource pool */
- if (esxVI_String_AppendValueToList(conn, &propertyNameList, "parent") < 0 ||
- esxVI_LookupHostSystemByIp(conn, priv->host, priv->host->ipAddress,
+ if (esxVI_String_AppendValueToList(&propertyNameList, "parent") < 0 ||
+ esxVI_LookupHostSystemByIp(priv->host, priv->host->ipAddress,
propertyNameList, &hostSystem) < 0) {
goto failure;
}
- if (esxVI_LookupResourcePoolByHostSystem(conn, priv->host, hostSystem,
+ if (esxVI_LookupResourcePoolByHostSystem(priv->host, hostSystem,
&resourcePool) < 0) {
goto failure;
}
/* FIXME */
/* Upload VMX file */
- if (esxVI_Context_UploadFile(conn, priv->host, url, vmx) < 0) {
+ if (esxVI_Context_UploadFile(priv->host, url, vmx) < 0) {
goto failure;
}
/* Register the domain */
- if (esxVI_RegisterVM_Task(conn, priv->host, priv->host->vmFolder,
+ if (esxVI_RegisterVM_Task(priv->host, priv->host->vmFolder,
datastoreRelatedPath, NULL, esxVI_Boolean_False,
resourcePool, hostSystem->obj, &task) < 0 ||
- esxVI_WaitForTaskCompletion(conn, priv->host, task,
- def->uuid, priv->autoAnswer,
- &taskInfoState) < 0) {
+ esxVI_WaitForTaskCompletion(priv->host, task, def->uuid,
+ priv->autoAnswer, &taskInfoState) < 0) {
goto failure;
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Could not define domain");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not define domain");
goto failure;
}
ctx = priv->host;
}
- if (esxVI_EnsureSession(domain->conn, ctx) < 0) {
+ if (esxVI_EnsureSession(ctx) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+ if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
- esxVI_LookupVirtualMachineByUuid(domain->conn, ctx, domain->uuid,
- propertyNameList, &virtualMachine,
+ esxVI_LookupVirtualMachineByUuid(ctx, domain->uuid, propertyNameList,
+ &virtualMachine,
esxVI_Occurrence_RequiredItem) < 0 ||
- esxVI_GetVirtualMachinePowerState(domain->conn, virtualMachine,
- &powerState) < 0) {
+ esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0) {
goto failure;
}
if (powerState != esxVI_VirtualMachinePowerState_Suspended &&
powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
- ESX_ERROR(domain->conn, VIR_ERR_OPERATION_INVALID,
+ ESX_ERROR(VIR_ERR_OPERATION_INVALID,
"Domain is not suspended or powered off");
goto failure;
}
- if (esxVI_UnregisterVM(domain->conn, ctx, virtualMachine->obj) < 0) {
+ if (esxVI_UnregisterVM(ctx, virtualMachine->obj) < 0) {
goto failure;
}
* SharesLevel 'low', 'normal' and 'high'.
*/
static char *
-esxDomainGetSchedulerType(virDomainPtr domain, int *nparams)
+esxDomainGetSchedulerType(virDomainPtr domain ATTRIBUTE_UNUSED, int *nparams)
{
char *type = strdup("allocation");
if (type == NULL) {
- virReportOOMError(domain->conn);
+ virReportOOMError(NULL);
return NULL;
}
int i = 0;
if (*nparams < 3) {
- ESX_ERROR(domain->conn, VIR_ERR_INVALID_ARG,
+ ESX_ERROR(VIR_ERR_INVALID_ARG,
"Parameter array must have space for 3 items");
goto failure;
}
- if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueListToList(domain->conn, &propertyNameList,
+ if (esxVI_String_AppendValueListToList(&propertyNameList,
"config.cpuAllocation.reservation\0"
"config.cpuAllocation.limit\0"
"config.cpuAllocation.shares\0") < 0 ||
- esxVI_LookupVirtualMachineByUuid(domain->conn, priv->host,
- domain->uuid, propertyNameList,
- &virtualMachine,
+ esxVI_LookupVirtualMachineByUuid(priv->host, domain->uuid,
+ propertyNameList, &virtualMachine,
esxVI_Occurrence_RequiredItem) < 0) {
goto failure;
}
params[i].type = VIR_DOMAIN_SCHED_FIELD_LLONG;
- if (esxVI_AnyType_ExpectType(domain->conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_Long) < 0) {
goto failure;
}
params[i].type = VIR_DOMAIN_SCHED_FIELD_LLONG;
- if (esxVI_AnyType_ExpectType(domain->conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_Long) < 0) {
goto failure;
}
params[i].type = VIR_DOMAIN_SCHED_FIELD_INT;
- if (esxVI_SharesInfo_CastFromAnyType(domain->conn,
- dynamicProperty->val,
+ if (esxVI_SharesInfo_CastFromAnyType(dynamicProperty->val,
&sharesInfo) < 0) {
goto failure;
}
break;
default:
- ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Shares level has unknown value %d",
(int)sharesInfo->level);
goto failure;
esxVI_TaskInfoState taskInfoState;
int i;
- if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
if (esxVI_LookupVirtualMachineByUuidAndPrepareForTask
- (domain->conn, priv->host, domain->uuid, NULL, &virtualMachine,
+ (priv->host, domain->uuid, NULL, &virtualMachine,
priv->autoAnswer) < 0 ||
- esxVI_VirtualMachineConfigSpec_Alloc(domain->conn, &spec) < 0 ||
- esxVI_ResourceAllocationInfo_Alloc(domain->conn,
- &spec->cpuAllocation) < 0) {
+ esxVI_VirtualMachineConfigSpec_Alloc(&spec) < 0 ||
+ esxVI_ResourceAllocationInfo_Alloc(&spec->cpuAllocation) < 0) {
goto failure;
}
for (i = 0; i < nparams; ++i) {
if (STREQ (params[i].field, "reservation") &&
params[i].type == VIR_DOMAIN_SCHED_FIELD_LLONG) {
- if (esxVI_Long_Alloc(domain->conn,
- &spec->cpuAllocation->reservation) < 0) {
+ if (esxVI_Long_Alloc(&spec->cpuAllocation->reservation) < 0) {
goto failure;
}
if (params[i].value.l < 0) {
- ESX_ERROR(domain->conn, VIR_ERR_INVALID_ARG,
+ ESX_ERROR(VIR_ERR_INVALID_ARG,
"Could not set reservation to %lld MHz, expecting "
"positive value", params[i].value.l);
goto failure;
spec->cpuAllocation->reservation->value = params[i].value.l;
} else if (STREQ (params[i].field, "limit") &&
params[i].type == VIR_DOMAIN_SCHED_FIELD_LLONG) {
- if (esxVI_Long_Alloc(domain->conn,
- &spec->cpuAllocation->limit) < 0) {
+ if (esxVI_Long_Alloc(&spec->cpuAllocation->limit) < 0) {
goto failure;
}
if (params[i].value.l < -1) {
- ESX_ERROR(domain->conn, VIR_ERR_INVALID_ARG,
+ ESX_ERROR(VIR_ERR_INVALID_ARG,
"Could not set limit to %lld MHz, expecting "
"positive value or -1 (unlimited)",
params[i].value.l);
spec->cpuAllocation->limit->value = params[i].value.l;
} else if (STREQ (params[i].field, "shares") &&
params[i].type == VIR_DOMAIN_SCHED_FIELD_INT) {
- if (esxVI_SharesInfo_Alloc(domain->conn, &sharesInfo) < 0 ||
- esxVI_Int_Alloc(domain->conn, &sharesInfo->shares) < 0) {
+ if (esxVI_SharesInfo_Alloc(&sharesInfo) < 0 ||
+ esxVI_Int_Alloc(&sharesInfo->shares) < 0) {
goto failure;
}
break;
default:
- ESX_ERROR(domain->conn, VIR_ERR_INVALID_ARG,
+ ESX_ERROR(VIR_ERR_INVALID_ARG,
"Could not set shares to %d, expecting positive "
"value or -1 (low), -2 (normal) or -3 (high)",
params[i].value.i);
}
}
} else {
- ESX_ERROR(domain->conn, VIR_ERR_INVALID_ARG,
- "Unknown field '%s'", params[i].field);
+ ESX_ERROR(VIR_ERR_INVALID_ARG, "Unknown field '%s'",
+ params[i].field);
goto failure;
}
}
- if (esxVI_ReconfigVM_Task(domain->conn, priv->host, virtualMachine->obj,
- spec, &task) < 0 ||
- esxVI_WaitForTaskCompletion(domain->conn, priv->host, task,
- domain->uuid, priv->autoAnswer,
- &taskInfoState) < 0) {
+ if (esxVI_ReconfigVM_Task(priv->host, virtualMachine->obj, spec,
+ &task) < 0 ||
+ esxVI_WaitForTaskCompletion(priv->host, task, domain->uuid,
+ priv->autoAnswer, &taskInfoState) < 0) {
goto failure;
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not change scheduler parameters");
goto failure;
}
char *transport = NULL;
if (uri_in == NULL) {
- if (esxUtil_ParseQuery(dconn, &transport, NULL, NULL, NULL) < 0) {
+ if (esxUtil_ParseQuery(dconn->uri, &transport, NULL, NULL, NULL) < 0) {
return -1;
}
if (virAsprintf(uri_out, "%s://%s:%d/sdk", transport,
dconn->uri->server, dconn->uri->port) < 0) {
- virReportOOMError(dconn);
+ virReportOOMError(NULL);
goto failure;
}
}
esxVI_TaskInfoState taskInfoState;
if (priv->vCenter == NULL) {
- ESX_ERROR(domain->conn, VIR_ERR_INVALID_ARG,
+ ESX_ERROR(VIR_ERR_INVALID_ARG,
"Migration not possible without a vCenter");
goto failure;
}
if (dname != NULL) {
- ESX_ERROR(domain->conn, VIR_ERR_INVALID_ARG,
+ ESX_ERROR(VIR_ERR_INVALID_ARG,
"Renaming domains on migration not supported");
goto failure;
}
- if (esxVI_EnsureSession(domain->conn, priv->vCenter) < 0) {
+ if (esxVI_EnsureSession(priv->vCenter) < 0) {
goto failure;
}
xmlUri = xmlParseURI(uri);
if (xmlUri == NULL) {
- virReportOOMError(domain->conn);
+ virReportOOMError(NULL);
goto failure;
}
- if (esxUtil_ResolveHostname(domain->conn, xmlUri->server, hostIpAddress,
+ if (esxUtil_ResolveHostname(xmlUri->server, hostIpAddress,
NI_MAXHOST) < 0) {
goto failure;
}
/* Lookup VirtualMachine, HostSystem and ResourcePool */
if (esxVI_LookupVirtualMachineByUuidAndPrepareForTask
- (domain->conn, priv->vCenter, domain->uuid, NULL, &virtualMachine,
+ (priv->vCenter, domain->uuid, NULL, &virtualMachine,
priv->autoAnswer) < 0 ||
- esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
- "parent") < 0 ||
- esxVI_LookupHostSystemByIp(domain->conn, priv->vCenter, hostIpAddress,
+ esxVI_String_AppendValueToList(&propertyNameList, "parent") < 0 ||
+ esxVI_LookupHostSystemByIp(priv->vCenter, hostIpAddress,
propertyNameList, &hostSystem) < 0) {
goto failure;
}
- if (esxVI_LookupResourcePoolByHostSystem(domain->conn, priv->vCenter,
- hostSystem, &resourcePool) < 0) {
+ if (esxVI_LookupResourcePoolByHostSystem(priv->vCenter, hostSystem,
+ &resourcePool) < 0) {
goto failure;
}
/* Validate the purposed migration */
- if (esxVI_ValidateMigration(domain->conn, priv->vCenter,
- virtualMachine->obj,
+ if (esxVI_ValidateMigration(priv->vCenter, virtualMachine->obj,
esxVI_VirtualMachinePowerState_Undefined,
NULL, resourcePool, hostSystem->obj,
&eventList) < 0) {
* to the first event for now.
*/
if (eventList->fullFormattedMessage != NULL) {
- ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not migrate domain, validation reported a "
"problem: %s", eventList->fullFormattedMessage);
} else {
- ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not migrate domain, validation reported a "
"problem");
}
}
/* Perform the purposed migration */
- if (esxVI_MigrateVM_Task(domain->conn, priv->vCenter, virtualMachine->obj,
- resourcePool, hostSystem->obj, &task) < 0 ||
- esxVI_WaitForTaskCompletion(domain->conn, priv->vCenter, task,
- domain->uuid, priv->autoAnswer,
- &taskInfoState) < 0) {
+ if (esxVI_MigrateVM_Task(priv->vCenter, virtualMachine->obj, resourcePool,
+ hostSystem->obj, &task) < 0 ||
+ esxVI_WaitForTaskCompletion(priv->vCenter, task, domain->uuid,
+ priv->autoAnswer, &taskInfoState) < 0) {
goto failure;
}
if (taskInfoState != esxVI_TaskInfoState_Success) {
- ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not migrate domain, migration task finished with "
"an error");
goto failure;
esxVI_DynamicProperty *dynamicProperty = NULL;
esxVI_ResourcePoolResourceUsage *resourcePoolResourceUsage = NULL;
- if (esxVI_EnsureSession(conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
/* Lookup host system with its resource pool */
- if (esxVI_String_AppendValueToList(conn, &propertyNameList, "parent") < 0 ||
- esxVI_LookupHostSystemByIp(conn, priv->host, priv->host->ipAddress,
+ if (esxVI_String_AppendValueToList(&propertyNameList, "parent") < 0 ||
+ esxVI_LookupHostSystemByIp(priv->host, priv->host->ipAddress,
propertyNameList, &hostSystem) < 0) {
goto failure;
}
- if (esxVI_LookupResourcePoolByHostSystem(conn, priv->host, hostSystem,
+ if (esxVI_LookupResourcePoolByHostSystem(priv->host, hostSystem,
&managedObjectReference) < 0) {
goto failure;
}
esxVI_String_Free(&propertyNameList);
/* Get memory usage of resource pool */
- if (esxVI_String_AppendValueToList(conn, &propertyNameList,
+ if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.memory") < 0 ||
- esxVI_LookupObjectContentByType(conn, priv->host,
- managedObjectReference,
+ esxVI_LookupObjectContentByType(priv->host, managedObjectReference,
"ResourcePool", propertyNameList,
esxVI_Boolean_False,
&resourcePool) < 0) {
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "runtime.memory")) {
if (esxVI_ResourcePoolResourceUsage_CastFromAnyType
- (conn, dynamicProperty->val,
- &resourcePoolResourceUsage) < 0) {
+ (dynamicProperty->val, &resourcePoolResourceUsage) < 0) {
goto failure;
}
}
if (resourcePoolResourceUsage == NULL) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not retrieve memory usage of resource pool");
goto failure;
}
esxVI_String *propertyNameList = NULL;
esxVI_VirtualMachinePowerState powerState;
- if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+ if (esxVI_EnsureSession(priv->host) < 0) {
goto failure;
}
- if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+ if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
- esxVI_LookupVirtualMachineByUuid(domain->conn, priv->host,
- domain->uuid, propertyNameList,
- &virtualMachine,
+ esxVI_LookupVirtualMachineByUuid(priv->host, domain->uuid,
+ propertyNameList, &virtualMachine,
esxVI_Occurrence_RequiredItem) < 0 ||
- esxVI_GetVirtualMachinePowerState(domain->conn, virtualMachine,
- &powerState) < 0) {
+ esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0) {
goto failure;
}
#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
int
-esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
+esxUtil_ParseQuery(xmlURIPtr uri, char **transport, char **vCenter,
int *noVerify, int *autoAnswer)
{
int result = 0;
}
#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) {
*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;
*vCenter = strdup(queryParam->value);
if (*vCenter == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
} else if (STRCASEEQ(queryParam->name, "no_verify")) {
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;
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;
*transport = strdup("https");
if (*transport == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
}
int
-esxUtil_ParseDatastoreRelatedPath(virConnectPtr conn,
- const char *datastoreRelatedPath,
+esxUtil_ParseDatastoreRelatedPath(const char *datastoreRelatedPath,
char **datastoreName,
char **directoryName, char **fileName)
{
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;
}
*/
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;
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;
*fileName = strdup(separator);
if (*fileName == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
} else {
int
-esxUtil_ResolveHostname(virConnectPtr conn, const char *hostname,
+esxUtil_ResolveHostname(const char *hostname,
char *ipAddress, size_t ipAddress_length)
{
struct addrinfo hints;
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;
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);
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;
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;
}
return 0;
}
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing essential config entry '%s'", name);
return -1;
}
*string = strdup(value->str);
if (*string == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
return -1;
}
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;
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;
}
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;
}
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;
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 (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 (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;
}
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;
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 (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;
}
} 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;
}
#ifndef __ESX_UTIL_H__
#define __ESX_UTIL_H__
-#include <libxml/tree.h>
+#include <libxml/uri.h>
#include "internal.h"
#include "conf.h"
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__ */
#define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_VI_ERROR(conn, code, fmt...) \
- virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+#define ESX_VI_ERROR(code, fmt...) \
+ virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, fmt)
#define ESX_VI__SOAP__REQUEST_HEADER \
#define ESX_VI__TEMPLATE__ALLOC(_type) \
int \
- esxVI_##_type##_Alloc(virConnectPtr conn, esxVI_##_type **ptrptr) \
+ esxVI_##_type##_Alloc(esxVI_##_type **ptrptr) \
{ \
- return esxVI_Alloc(conn, (void **)ptrptr, sizeof(esxVI_##_type)); \
+ return esxVI_Alloc((void **)ptrptr, sizeof(esxVI_##_type)); \
}
#define ESX_VI__TEMPLATE__FREE(_type, _body) \
#endif
static int
-esxVI_CURL_Perform(virConnectPtr conn, esxVI_Context *ctx, const char *url)
+esxVI_CURL_Perform(esxVI_Context *ctx, const char *url)
{
CURLcode errorCode;
long responseCode = 0;
errorCode = curl_easy_perform(ctx->curl_handle);
if (errorCode != CURLE_OK) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"curl_easy_perform() returned an error: %s (%d)",
curl_easy_strerror(errorCode), errorCode);
return -1;
&responseCode);
if (errorCode != CURLE_OK) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned an "
"error: %s (%d)", curl_easy_strerror(errorCode),
errorCode);
}
if (responseCode < 0) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned a "
"negative response code");
return -1;
&redirectUrl);
if (errorCode != CURLE_OK) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"curl_easy_getinfo(CURLINFO_REDIRECT_URL) returned "
"an error: %s (%d)", curl_easy_strerror(errorCode),
errorCode);
} else {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"The server redirects from '%s' to '%s'", url,
redirectUrl);
}
#else
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"The server redirects from '%s'", url);
#endif
}
int
-esxVI_Context_Connect(virConnectPtr conn, esxVI_Context *ctx, const char *url,
+esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
const char *ipAddress, const char *username,
const char *password, int noVerify)
{
if (ctx == NULL || url == NULL || ipAddress == NULL || username == NULL ||
password == NULL || ctx->url != NULL || ctx->service != NULL ||
ctx->curl_handle != NULL || ctx->curl_headers != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
goto failure;
}
- if (esxVI_String_DeepCopyValue(conn, &ctx->url, url) < 0 ||
- esxVI_String_DeepCopyValue(conn, &ctx->ipAddress, ipAddress) < 0) {
+ if (esxVI_String_DeepCopyValue(&ctx->url, url) < 0 ||
+ esxVI_String_DeepCopyValue(&ctx->ipAddress, ipAddress) < 0) {
goto failure;
}
ctx->curl_handle = curl_easy_init();
if (ctx->curl_handle == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
- "Could not initialize CURL");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not initialize CURL");
goto failure;
}
"Expect: nothing");
if (ctx->curl_headers == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
- "Could not build CURL header list");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not build CURL header list");
goto failure;
}
#endif
if (virMutexInit(&ctx->curl_lock) < 0) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
- "Could not initialize CURL mutex");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not initialize CURL mutex");
goto failure;
}
ctx->password = strdup(password);
if (ctx->username == NULL || ctx->password == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
- if (esxVI_RetrieveServiceContent(conn, ctx, &ctx->service) < 0) {
+ if (esxVI_RetrieveServiceContent(ctx, &ctx->service) < 0) {
goto failure;
}
} else if (STRPREFIX(ctx->service->about->apiVersion, "4.0")) {
ctx->apiVersion = esxVI_APIVersion_40;
} else {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VI API major/minor version '2.5' or '4.0' "
"but found '%s'", ctx->service->about->apiVersion);
goto failure;
if (STRPREFIX(ctx->service->about->version, "2.0")) {
ctx->productVersion = esxVI_ProductVersion_GSX20;
} else {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting GSX major/minor version '2.0' but "
"found '%s'", ctx->service->about->version);
goto failure;
} else if (STRPREFIX(ctx->service->about->version, "4.0")) {
ctx->productVersion = esxVI_ProductVersion_ESX40;
} else {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting ESX major/minor version '3.5' or "
"'4.0' but found '%s'",
ctx->service->about->version);
} else if (STRPREFIX(ctx->service->about->version, "4.0")) {
ctx->productVersion = esxVI_ProductVersion_VPX40;
} else {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VPX major/minor version '2.5' or '4.0' "
"but found '%s'", ctx->service->about->version);
goto failure;
}
} else {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting product 'gsx' or 'esx' or 'embeddedEsx' "
"or 'vpx' but found '%s'",
ctx->service->about->productLineId);
goto failure;
}
} else {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VI API type 'HostAgent' or 'VirtualCenter' "
"but found '%s'", ctx->service->about->apiType);
goto failure;
}
- if (esxVI_Login(conn, ctx, username, password, &ctx->session) < 0) {
+ if (esxVI_Login(ctx, username, password, &ctx->session) < 0) {
goto failure;
}
- esxVI_BuildFullTraversalSpecList(conn, &ctx->fullTraversalSpecList);
+ esxVI_BuildFullTraversalSpecList(&ctx->fullTraversalSpecList);
- if (esxVI_String_AppendValueListToList(conn, &propertyNameList,
+ if (esxVI_String_AppendValueListToList(&propertyNameList,
"vmFolder\0"
"hostFolder\0") < 0) {
goto failure;
}
/* Get pointer to Datacenter for later use */
- if (esxVI_LookupObjectContentByType(conn, ctx, ctx->service->rootFolder,
+ if (esxVI_LookupObjectContentByType(ctx, ctx->service->rootFolder,
"Datacenter", propertyNameList,
esxVI_Boolean_True,
&datacenterList) < 0) {
}
if (datacenterList == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not retrieve the 'datacenter' object from the VI "
"host/center");
goto failure;
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "vmFolder")) {
if (esxVI_ManagedObjectReference_CastFromAnyType
- (conn, dynamicProperty->val, &ctx->vmFolder, "Folder")) {
+ (dynamicProperty->val, &ctx->vmFolder, "Folder")) {
goto failure;
}
} else if (STREQ(dynamicProperty->name, "hostFolder")) {
if (esxVI_ManagedObjectReference_CastFromAnyType
- (conn, dynamicProperty->val, &ctx->hostFolder, "Folder")) {
+ (dynamicProperty->val, &ctx->hostFolder, "Folder")) {
goto failure;
}
} else {
}
if (ctx->vmFolder == NULL || ctx->hostFolder == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"The 'datacenter' object is missing the "
"'vmFolder'/'hostFolder' property");
goto failure;
}
int
-esxVI_Context_DownloadFile(virConnectPtr conn, esxVI_Context *ctx,
- const char *url, char **content)
+esxVI_Context_DownloadFile(esxVI_Context *ctx, const char *url, char **content)
{
virBuffer buffer = VIR_BUFFER_INITIALIZER;
int responseCode = 0;
if (content == NULL || *content != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
goto failure;
}
curl_easy_setopt(ctx->curl_handle, CURLOPT_UPLOAD, 0);
curl_easy_setopt(ctx->curl_handle, CURLOPT_HTTPGET, 1);
- responseCode = esxVI_CURL_Perform(conn, ctx, url);
+ responseCode = esxVI_CURL_Perform(ctx, url);
virMutexUnlock(&ctx->curl_lock);
if (responseCode < 0) {
goto failure;
} else if (responseCode != 200) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"HTTP response code %d for download from '%s'",
responseCode, url);
goto failure;
}
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
}
int
-esxVI_Context_UploadFile(virConnectPtr conn, esxVI_Context *ctx,
- const char *url, const char *content)
+esxVI_Context_UploadFile(esxVI_Context *ctx, const char *url,
+ const char *content)
{
int responseCode = 0;
if (content == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
curl_easy_setopt(ctx->curl_handle, CURLOPT_UPLOAD, 1);
curl_easy_setopt(ctx->curl_handle, CURLOPT_INFILESIZE, strlen(content));
- responseCode = esxVI_CURL_Perform(conn, ctx, url);
+ responseCode = esxVI_CURL_Perform(ctx, url);
virMutexUnlock(&ctx->curl_lock);
if (responseCode < 0) {
return -1;
} else if (responseCode != 200 && responseCode != 201) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"HTTP response code %d for upload to '%s'",
responseCode, url);
return -1;
}
int
-esxVI_Context_Execute(virConnectPtr conn, esxVI_Context *ctx,
- const char *methodName, const char *request,
- esxVI_Response **response, esxVI_Occurrence occurrence)
+esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
+ const char *request, esxVI_Response **response,
+ esxVI_Occurrence occurrence)
{
int result = 0;
virBuffer buffer = VIR_BUFFER_INITIALIZER;
xmlNodePtr responseNode = NULL;
if (request == NULL || response == NULL || *response != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
goto failure;
}
- if (esxVI_Response_Alloc(conn, response) < 0) {
+ if (esxVI_Response_Alloc(response) < 0) {
goto failure;
}
curl_easy_setopt(ctx->curl_handle, CURLOPT_POSTFIELDS, request);
curl_easy_setopt(ctx->curl_handle, CURLOPT_POSTFIELDSIZE, strlen(request));
- (*response)->responseCode = esxVI_CURL_Perform(conn, ctx, ctx->url);
+ (*response)->responseCode = esxVI_CURL_Perform(ctx, ctx->url);
virMutexUnlock(&ctx->curl_lock);
}
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
NULL, XML_PARSE_NONET);
if ((*response)->document == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Response for call to '%s' could not be parsed",
methodName);
goto failure;
}
if (xmlDocGetRootElement((*response)->document) == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Response for call to '%s' is an empty XML document",
methodName);
goto failure;
xpathContext = xmlXPathNewContext((*response)->document);
if (xpathContext == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not create XPath context");
goto failure;
}
if ((*response)->responseCode == 500) {
(*response)->node =
- virXPathNode(conn, "/soapenv:Envelope/soapenv:Body/soapenv:Fault",
+ virXPathNode(NULL, "/soapenv:Envelope/soapenv:Body/soapenv:Fault",
xpathContext);
if ((*response)->node == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"HTTP response code %d for call to '%s'. "
"Fault is unknown, XPath evaluation failed",
(*response)->responseCode, methodName);
goto failure;
}
- if (esxVI_Fault_Deserialize(conn, (*response)->node, &fault) < 0) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ if (esxVI_Fault_Deserialize((*response)->node, &fault) < 0) {
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"HTTP response code %d for call to '%s'. "
"Fault is unknown, deserialization failed",
(*response)->responseCode, methodName);
goto failure;
}
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"HTTP response code %d for call to '%s'. "
"Fault: %s - %s", (*response)->responseCode,
methodName, fault->faultcode, fault->faultstring);
if (virAsprintf(&xpathExpression,
"/soapenv:Envelope/soapenv:Body/vim:%sResponse",
methodName) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
- responseNode = virXPathNode(conn, xpathExpression, xpathContext);
+ responseNode = virXPathNode(NULL, xpathExpression, xpathContext);
if (responseNode == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"XPath evaluation of response for call to '%s' "
"failed", methodName);
goto failure;
}
xpathContext->node = responseNode;
- (*response)->node = virXPathNode(conn, "./vim:returnval",
+ (*response)->node = virXPathNode(NULL, "./vim:returnval",
xpathContext);
switch (occurrence) {
case esxVI_Occurrence_RequiredItem:
if ((*response)->node == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Call to '%s' returned an empty result, "
"expecting a non-empty result", methodName);
goto failure;
case esxVI_Occurrence_OptionalItem:
if ((*response)->node != NULL &&
(*response)->node->next != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Call to '%s' returned a list, expecting "
"exactly one item", methodName);
goto failure;
case esxVI_Occurrence_None:
if ((*response)->node != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Call to '%s' returned something, expecting "
"an empty result", methodName);
goto failure;
break;
default:
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Invalid argument (occurrence)");
goto failure;
}
}
} else {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"HTTP response code %d for call to '%s'",
(*response)->responseCode, methodName);
goto failure;
*/
int
-esxVI_Enumeration_CastFromAnyType(virConnectPtr conn,
- const esxVI_Enumeration *enumeration,
+esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration *enumeration,
esxVI_AnyType *anyType, int *value)
{
int i;
if (anyType == NULL || value == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
*value = 0; /* undefined */
if (STRNEQ(anyType->other, enumeration->type)) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting type '%s' but found '%s'", enumeration->type,
anyType->other);
return -1;
}
}
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unknown value '%s' for %s", anyType->value,
enumeration->type);
}
int
-esxVI_Enumeration_Serialize(virConnectPtr conn,
- const esxVI_Enumeration *enumeration,
+esxVI_Enumeration_Serialize(const esxVI_Enumeration *enumeration,
int value, const char *element,
virBufferPtr output, esxVI_Boolean required)
{
const char *name = NULL;
if (element == NULL || output == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
if (value == 0) { /* undefined */
- return esxVI_CheckSerializationNecessity(conn, element, required);
+ return esxVI_CheckSerializationNecessity(element, required);
}
for (i = 0; enumeration->values[i].name != NULL; ++i) {
}
if (name == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
}
int
-esxVI_Enumeration_Deserialize(virConnectPtr conn,
- const esxVI_Enumeration *enumeration,
+esxVI_Enumeration_Deserialize(const esxVI_Enumeration *enumeration,
xmlNodePtr node, int *value)
{
int i;
char *name = NULL;
if (value == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
goto failure;
}
*value = 0; /* undefined */
- if (esxVI_String_DeserializeValue(conn, node, &name) < 0) {
+ if (esxVI_String_DeserializeValue(node, &name) < 0) {
goto failure;
}
}
}
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Unknown value '%s' for %s",
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Unknown value '%s' for %s",
name, enumeration->type);
cleanup:
*/
int
-esxVI_List_Append(virConnectPtr conn, esxVI_List **list, esxVI_List *item)
+esxVI_List_Append(esxVI_List **list, esxVI_List *item)
{
esxVI_List *next = NULL;
if (list == NULL || item == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
}
int
-esxVI_List_DeepCopy(virConnectPtr conn, esxVI_List **destList,
- esxVI_List *srcList,
+esxVI_List_DeepCopy(esxVI_List **destList, esxVI_List *srcList,
esxVI_List_DeepCopyFunc deepCopyFunc,
esxVI_List_FreeFunc freeFunc)
{
esxVI_List *src = NULL;
if (destList == NULL || *destList != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
goto failure;
}
for (src = srcList; src != NULL; src = src->_next) {
- if (deepCopyFunc(conn, &dest, src) < 0 ||
- esxVI_List_Append(conn, destList, dest) < 0) {
+ if (deepCopyFunc(&dest, src) < 0 ||
+ esxVI_List_Append(destList, dest) < 0) {
goto failure;
}
}
int
-esxVI_List_CastFromAnyType(virConnectPtr conn, esxVI_AnyType *anyType,
- esxVI_List **list,
+esxVI_List_CastFromAnyType(esxVI_AnyType *anyType, esxVI_List **list,
esxVI_List_CastFromAnyTypeFunc castFromAnyTypeFunc,
esxVI_List_FreeFunc freeFunc)
{
if (list == NULL || *list != NULL ||
castFromAnyTypeFunc == NULL || freeFunc == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
}
if (! STRPREFIX(anyType->other, "ArrayOf")) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting type to begin with 'ArrayOf' but found '%s'",
anyType->other);
return -1;
for (childNode = anyType->_node->children; childNode != NULL;
childNode = childNode->next) {
if (childNode->type != XML_ELEMENT_NODE) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Wrong XML element type %d", childNode->type);
goto failure;
}
esxVI_AnyType_Free(&childAnyType);
- if (esxVI_AnyType_Deserialize(conn, childNode, &childAnyType) < 0 ||
- castFromAnyTypeFunc(conn, childAnyType, &item) < 0 ||
- esxVI_List_Append(conn, list, item) < 0) {
+ if (esxVI_AnyType_Deserialize(childNode, &childAnyType) < 0 ||
+ castFromAnyTypeFunc(childAnyType, &item) < 0 ||
+ esxVI_List_Append(list, item) < 0) {
goto failure;
}
}
int
-esxVI_List_Serialize(virConnectPtr conn, esxVI_List *list, const char *element,
+esxVI_List_Serialize(esxVI_List *list, const char *element,
virBufferPtr output, esxVI_Boolean required,
esxVI_List_SerializeFunc serializeFunc)
{
esxVI_List *item = NULL;
if (element == NULL || output == NULL || serializeFunc == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
if (list == NULL) {
- return esxVI_CheckSerializationNecessity(conn, element, required);
+ return esxVI_CheckSerializationNecessity(element, required);
}
for (item = list; item != NULL; item = item->_next) {
- if (serializeFunc(conn, item, element, output,
- esxVI_Boolean_True) < 0) {
+ if (serializeFunc(item, element, output, esxVI_Boolean_True) < 0) {
return -1;
}
}
}
int
-esxVI_List_Deserialize(virConnectPtr conn, xmlNodePtr node, esxVI_List **list,
+esxVI_List_Deserialize(xmlNodePtr node, esxVI_List **list,
esxVI_List_DeserializeFunc deserializeFunc,
esxVI_List_FreeFunc freeFunc)
{
if (list == NULL || *list != NULL ||
deserializeFunc == NULL || freeFunc == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
for (; node != NULL; node = node->next) {
if (node->type != XML_ELEMENT_NODE) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Wrong XML element type %d", node->type);
goto failure;
}
- if (deserializeFunc(conn, node, &item) < 0 ||
- esxVI_List_Append(conn, list, item) < 0) {
+ if (deserializeFunc(node, &item) < 0 ||
+ esxVI_List_Append(list, item) < 0) {
goto failure;
}
*/
int
-esxVI_Alloc(virConnectPtr conn, void **ptrptr, size_t size)
+esxVI_Alloc(void **ptrptr, size_t size)
{
if (ptrptr == NULL || *ptrptr != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
if (virAllocN(ptrptr, size, 1) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
return -1;
}
int
-esxVI_CheckSerializationNecessity(virConnectPtr conn, const char *element,
+esxVI_CheckSerializationNecessity(const char *element,
esxVI_Boolean required)
{
if (element == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
if (required == esxVI_Boolean_True) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Required property missing while trying to serialize "
"'%s'", element);
return -1;
int
-esxVI_BuildFullTraversalSpecItem(virConnectPtr conn,
- esxVI_SelectionSpec **fullTraversalSpecList,
+esxVI_BuildFullTraversalSpecItem(esxVI_SelectionSpec **fullTraversalSpecList,
const char *name, const char *type,
const char *path, const char *selectSetNames)
{
const char *currentSelectSetName = NULL;
if (fullTraversalSpecList == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
- if (esxVI_TraversalSpec_Alloc(conn, &traversalSpec) < 0 ||
- esxVI_String_DeepCopyValue(conn, &traversalSpec->_base->name,
- name) < 0 ||
- esxVI_String_DeepCopyValue(conn, &traversalSpec->type, type) < 0 ||
- esxVI_String_DeepCopyValue(conn, &traversalSpec->path, path) < 0) {
+ if (esxVI_TraversalSpec_Alloc(&traversalSpec) < 0 ||
+ esxVI_String_DeepCopyValue(&traversalSpec->_base->name, name) < 0 ||
+ esxVI_String_DeepCopyValue(&traversalSpec->type, type) < 0 ||
+ esxVI_String_DeepCopyValue(&traversalSpec->path, path) < 0) {
goto failure;
}
while (currentSelectSetName != NULL && *currentSelectSetName != '\0') {
selectionSpec = NULL;
- if (esxVI_SelectionSpec_Alloc(conn, &selectionSpec) < 0 ||
- esxVI_String_DeepCopyValue(conn, &selectionSpec->name,
+ if (esxVI_SelectionSpec_Alloc(&selectionSpec) < 0 ||
+ esxVI_String_DeepCopyValue(&selectionSpec->name,
currentSelectSetName) < 0 ||
- esxVI_SelectionSpec_AppendToList(conn,
- &traversalSpec->selectSet,
+ esxVI_SelectionSpec_AppendToList(&traversalSpec->selectSet,
selectionSpec) < 0) {
goto failure;
}
}
}
- if (esxVI_SelectionSpec_AppendToList(conn, fullTraversalSpecList,
+ if (esxVI_SelectionSpec_AppendToList(fullTraversalSpecList,
traversalSpec->_base) < 0) {
goto failure;
}
int
-esxVI_BuildFullTraversalSpecList(virConnectPtr conn,
- esxVI_SelectionSpec **fullTraversalSpecList)
+esxVI_BuildFullTraversalSpecList(esxVI_SelectionSpec **fullTraversalSpecList)
{
if (fullTraversalSpecList == NULL || *fullTraversalSpecList != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
- if (esxVI_BuildFullTraversalSpecItem(conn, fullTraversalSpecList,
+ if (esxVI_BuildFullTraversalSpecItem(fullTraversalSpecList,
"visitFolders",
"Folder", "childEntity",
"visitFolders\0"
}
/* Traversal through datastore branch */
- if (esxVI_BuildFullTraversalSpecItem(conn, fullTraversalSpecList,
+ if (esxVI_BuildFullTraversalSpecItem(fullTraversalSpecList,
"datacenterToDatastore",
"Datacenter", "datastore",
NULL) < 0) {
}
/* Traversal through vmFolder branch */
- if (esxVI_BuildFullTraversalSpecItem(conn, fullTraversalSpecList,
+ if (esxVI_BuildFullTraversalSpecItem(fullTraversalSpecList,
"datacenterToVmFolder",
"Datacenter", "vmFolder",
"visitFolders\0") < 0) {
}
/* Traversal through hostFolder branch */
- if (esxVI_BuildFullTraversalSpecItem(conn, fullTraversalSpecList,
+ if (esxVI_BuildFullTraversalSpecItem(fullTraversalSpecList,
"datacenterToHostFolder",
"Datacenter", "hostFolder",
"visitFolders\0") < 0) {
}
/* Traversal through host branch */
- if (esxVI_BuildFullTraversalSpecItem(conn, fullTraversalSpecList,
+ if (esxVI_BuildFullTraversalSpecItem(fullTraversalSpecList,
"computeResourceToHost",
"ComputeResource", "host",
NULL) < 0) {
}
/* Traversal through resourcePool branch */
- if (esxVI_BuildFullTraversalSpecItem(conn, fullTraversalSpecList,
+ if (esxVI_BuildFullTraversalSpecItem(fullTraversalSpecList,
"computeResourceToResourcePool",
"ComputeResource", "resourcePool",
"resourcePoolToResourcePool\0"
}
/* Recurse through all resource pools */
- if (esxVI_BuildFullTraversalSpecItem(conn, fullTraversalSpecList,
+ if (esxVI_BuildFullTraversalSpecItem(fullTraversalSpecList,
"resourcePoolToResourcePool",
"ResourcePool", "resourcePool",
"resourcePoolToResourcePool\0"
}
/* Recurse through all hosts */
- if (esxVI_BuildFullTraversalSpecItem(conn, fullTraversalSpecList,
+ if (esxVI_BuildFullTraversalSpecItem(fullTraversalSpecList,
"hostSystemToVm",
"HostSystem", "vm",
"visitFolders\0") < 0) {
}
/* Recurse through all resource pools */
- if (esxVI_BuildFullTraversalSpecItem(conn, fullTraversalSpecList,
+ if (esxVI_BuildFullTraversalSpecItem(fullTraversalSpecList,
"resourcePoolToVm",
"ResourcePool", "vm", NULL) < 0) {
goto failure;
#define ESX_VI_USE_SESSION_IS_ACTIVE 0
int
-esxVI_EnsureSession(virConnectPtr conn, esxVI_Context *ctx)
+esxVI_EnsureSession(esxVI_Context *ctx)
{
int result = 0;
#if ESX_VI_USE_SESSION_IS_ACTIVE
#endif
if (ctx->session == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
return -1;
}
#if ESX_VI_USE_SESSION_IS_ACTIVE
- if (esxVI_SessionIsActive(conn, ctx, ctx->session->key,
- ctx->session->userName, &active) < 0) {
+ if (esxVI_SessionIsActive(ctx, ctx->session->key, ctx->session->userName,
+ &active) < 0) {
return -1;
}
if (active != esxVI_Boolean_True) {
esxVI_UserSession_Free(&ctx->session);
- if (esxVI_Login(conn, ctx, ctx->username, ctx->password,
+ if (esxVI_Login(ctx, ctx->username, ctx->password,
&ctx->session) < 0) {
return -1;
}
}
#else
- if (esxVI_String_AppendValueToList(conn, &propertyNameList,
+ if (esxVI_String_AppendValueToList(&propertyNameList,
"currentSession") < 0 ||
- esxVI_LookupObjectContentByType(conn, ctx,
- ctx->service->sessionManager,
+ esxVI_LookupObjectContentByType(ctx, ctx->service->sessionManager,
"SessionManager", propertyNameList,
esxVI_Boolean_False,
&sessionManager) < 0) {
for (dynamicProperty = sessionManager->propSet; dynamicProperty != NULL;
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "currentSession")) {
- if (esxVI_UserSession_CastFromAnyType(conn, dynamicProperty->val,
+ if (esxVI_UserSession_CastFromAnyType(dynamicProperty->val,
¤tSession) < 0) {
goto failure;
}
if (currentSession == NULL) {
esxVI_UserSession_Free(&ctx->session);
- if (esxVI_Login(conn, ctx, ctx->username, ctx->password,
- &ctx->session) < 0) {
+ if (esxVI_Login(ctx, ctx->username, ctx->password, &ctx->session) < 0) {
goto failure;
}
} else if (STRNEQ(ctx->session->key, currentSession->key)) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Key of the current session differs from the key at "
"last login");
goto failure;
int
-esxVI_LookupObjectContentByType(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_LookupObjectContentByType(esxVI_Context *ctx,
esxVI_ManagedObjectReference *root,
const char *type,
esxVI_String *propertyNameList,
esxVI_PropertyFilterSpec *propertyFilterSpec = NULL;
if (ctx->fullTraversalSpecList == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
return -1;
}
- if (esxVI_ObjectSpec_Alloc(conn, &objectSpec) < 0) {
+ if (esxVI_ObjectSpec_Alloc(&objectSpec) < 0) {
goto failure;
}
objectSpec->selectSet = ctx->fullTraversalSpecList;
}
- if (esxVI_PropertySpec_Alloc(conn, &propertySpec) < 0) {
+ if (esxVI_PropertySpec_Alloc(&propertySpec) < 0) {
goto failure;
}
propertySpec->type = (char *)type;
propertySpec->pathSet = propertyNameList;
- if (esxVI_PropertyFilterSpec_Alloc(conn, &propertyFilterSpec) < 0 ||
- esxVI_PropertySpec_AppendToList(conn, &propertyFilterSpec->propSet,
+ if (esxVI_PropertyFilterSpec_Alloc(&propertyFilterSpec) < 0 ||
+ esxVI_PropertySpec_AppendToList(&propertyFilterSpec->propSet,
propertySpec) < 0 ||
- esxVI_ObjectSpec_AppendToList(conn, &propertyFilterSpec->objectSet,
+ esxVI_ObjectSpec_AppendToList(&propertyFilterSpec->objectSet,
objectSpec) < 0) {
goto failure;
}
- result = esxVI_RetrieveProperties(conn, ctx, propertyFilterSpec,
+ result = esxVI_RetrieveProperties(ctx, propertyFilterSpec,
objectContentList);
cleanup:
int
-esxVI_GetManagedEntityStatus(virConnectPtr conn,
- esxVI_ObjectContent *objectContent,
+esxVI_GetManagedEntityStatus(esxVI_ObjectContent *objectContent,
const char *propertyName,
esxVI_ManagedEntityStatus *managedEntityStatus)
{
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, propertyName)) {
return esxVI_ManagedEntityStatus_CastFromAnyType
- (conn, dynamicProperty->val, managedEntityStatus);
+ (dynamicProperty->val, managedEntityStatus);
}
}
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing '%s' property while looking for ManagedEntityStatus",
propertyName);
int
-esxVI_GetVirtualMachinePowerState(virConnectPtr conn,
- esxVI_ObjectContent *virtualMachine,
+esxVI_GetVirtualMachinePowerState(esxVI_ObjectContent *virtualMachine,
esxVI_VirtualMachinePowerState *powerState)
{
esxVI_DynamicProperty *dynamicProperty;
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "runtime.powerState")) {
return esxVI_VirtualMachinePowerState_CastFromAnyType
- (conn, dynamicProperty->val, powerState);
+ (dynamicProperty->val, powerState);
}
}
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Missing 'runtime.powerState' property");
return -1;
int
esxVI_GetVirtualMachineQuestionInfo
- (virConnectPtr conn, esxVI_ObjectContent *virtualMachine,
+ (esxVI_ObjectContent *virtualMachine,
esxVI_VirtualMachineQuestionInfo **questionInfo)
{
esxVI_DynamicProperty *dynamicProperty;
if (questionInfo == NULL || *questionInfo != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "runtime.question")) {
if (esxVI_VirtualMachineQuestionInfo_CastFromAnyType
- (conn, dynamicProperty->val, questionInfo) < 0) {
+ (dynamicProperty->val, questionInfo) < 0) {
return -1;
}
}
int
-esxVI_LookupNumberOfDomainsByPowerState(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_LookupNumberOfDomainsByPowerState(esxVI_Context *ctx,
esxVI_VirtualMachinePowerState powerState,
esxVI_Boolean inverse)
{
esxVI_VirtualMachinePowerState powerState_;
int numberOfDomains = 0;
- if (esxVI_String_AppendValueToList(conn, &propertyNameList,
+ if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
- esxVI_LookupObjectContentByType(conn, ctx, ctx->vmFolder,
- "VirtualMachine", propertyNameList,
- esxVI_Boolean_True,
+ esxVI_LookupObjectContentByType(ctx, ctx->vmFolder, "VirtualMachine",
+ propertyNameList, esxVI_Boolean_True,
&virtualMachineList) < 0) {
goto failure;
}
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "runtime.powerState")) {
if (esxVI_VirtualMachinePowerState_CastFromAnyType
- (conn, dynamicProperty->val, &powerState_) < 0) {
+ (dynamicProperty->val, &powerState_) < 0) {
goto failure;
}
int
-esxVI_GetVirtualMachineIdentity(virConnectPtr conn,
- esxVI_ObjectContent *virtualMachine,
+esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
int *id, char **name, unsigned char *uuid)
{
const char *uuid_string = NULL;
esxVI_ManagedEntityStatus configStatus = esxVI_ManagedEntityStatus_Undefined;
if (STRNEQ(virtualMachine->obj->type, "VirtualMachine")) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"ObjectContent does not reference a virtual machine");
return -1;
}
if (id != NULL) {
if (esxUtil_ParseVirtualMachineIDString
(virtualMachine->obj->value, id) < 0 || *id <= 0) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not parse positive integer from '%s'",
virtualMachine->obj->value);
goto failure;
if (name != NULL) {
if (*name != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
goto failure;
}
dynamicProperty != NULL;
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "name")) {
- if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_String) < 0) {
goto failure;
}
*name = strdup(dynamicProperty->val->string);
if (*name == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
}
if (*name == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not get name of virtual machine");
goto failure;
}
}
if (uuid != NULL) {
- if (esxVI_GetManagedEntityStatus(conn, virtualMachine, "configStatus",
+ if (esxVI_GetManagedEntityStatus(virtualMachine, "configStatus",
&configStatus) < 0) {
goto failure;
}
dynamicProperty != NULL;
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "config.uuid")) {
- if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_String) < 0) {
goto failure;
}
}
if (uuid_string == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not get UUID of virtual machine");
goto failure;
}
if (virUUIDParse(uuid_string, uuid) < 0) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not parse UUID from string '%s'",
uuid_string);
goto failure;
int
esxVI_LookupResourcePoolByHostSystem
- (virConnectPtr conn, esxVI_Context *ctx, esxVI_ObjectContent *hostSystem,
+ (esxVI_Context *ctx, esxVI_ObjectContent *hostSystem,
esxVI_ManagedObjectReference **resourcePool)
{
int result = 0;
esxVI_ObjectContent *computeResource = NULL;
if (resourcePool == NULL || *resourcePool != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "parent")) {
if (esxVI_ManagedObjectReference_CastFromAnyType
- (conn, dynamicProperty->val, &managedObjectReference,
+ (dynamicProperty->val, &managedObjectReference,
"ComputeResource") < 0) {
goto failure;
}
}
if (managedObjectReference == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not retrieve compute resource of host system");
goto failure;
}
- if (esxVI_String_AppendValueToList(conn, &propertyNameList,
- "resourcePool") < 0 ||
- esxVI_LookupObjectContentByType(conn, ctx, managedObjectReference,
+ if (esxVI_String_AppendValueToList(&propertyNameList, "resourcePool") < 0 ||
+ esxVI_LookupObjectContentByType(ctx, managedObjectReference,
"ComputeResource", propertyNameList,
esxVI_Boolean_False,
&computeResource) < 0) {
}
if (computeResource == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not retrieve compute resource of host system");
goto failure;
}
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "resourcePool")) {
if (esxVI_ManagedObjectReference_CastFromAnyType
- (conn, dynamicProperty->val, resourcePool,
- "ResourcePool") < 0) {
+ (dynamicProperty->val, resourcePool, "ResourcePool") < 0) {
goto failure;
}
}
if ((*resourcePool) == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not retrieve resource pool of compute resource");
goto failure;
}
int
-esxVI_LookupHostSystemByIp(virConnectPtr conn, esxVI_Context *ctx,
- const char *ipAddress,
+esxVI_LookupHostSystemByIp(esxVI_Context *ctx, const char *ipAddress,
esxVI_String *propertyNameList,
esxVI_ObjectContent **hostSystem)
{
esxVI_ManagedObjectReference *managedObjectReference = NULL;
if (hostSystem == NULL || *hostSystem != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
- if (esxVI_FindByIp(conn, ctx, ctx->datacenter, ipAddress,
- esxVI_Boolean_False, &managedObjectReference) < 0) {
+ if (esxVI_FindByIp(ctx, ctx->datacenter, ipAddress, esxVI_Boolean_False,
+ &managedObjectReference) < 0) {
goto failure;
}
- if (esxVI_LookupObjectContentByType(conn, ctx, managedObjectReference,
+ if (esxVI_LookupObjectContentByType(ctx, managedObjectReference,
"HostSystem", propertyNameList,
esxVI_Boolean_False, hostSystem) < 0) {
goto failure;
int
-esxVI_LookupVirtualMachineByUuid(virConnectPtr conn, esxVI_Context *ctx,
- const unsigned char *uuid,
+esxVI_LookupVirtualMachineByUuid(esxVI_Context *ctx, const unsigned char *uuid,
esxVI_String *propertyNameList,
esxVI_ObjectContent **virtualMachine,
esxVI_Occurrence occurrence)
char uuid_string[VIR_UUID_STRING_BUFLEN] = "";
if (virtualMachine == NULL || *virtualMachine != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
- if (esxVI_FindByUuid(conn, ctx, ctx->datacenter, uuid, esxVI_Boolean_True,
+ if (esxVI_FindByUuid(ctx, ctx->datacenter, uuid, esxVI_Boolean_True,
&managedObjectReference) < 0) {
goto failure;
}
} else {
virUUIDFormat(uuid, uuid_string);
- ESX_VI_ERROR(conn, VIR_ERR_NO_DOMAIN,
+ ESX_VI_ERROR(VIR_ERR_NO_DOMAIN,
"Could not find domain with UUID '%s'", uuid_string);
goto failure;
}
}
- if (esxVI_LookupObjectContentByType(conn, ctx, managedObjectReference,
+ if (esxVI_LookupObjectContentByType(ctx, managedObjectReference,
"VirtualMachine", propertyNameList,
esxVI_Boolean_False,
virtualMachine) < 0) {
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)
{
esxVI_VirtualMachineQuestionInfo *questionInfo = NULL;
esxVI_TaskInfo *pendingTaskInfoList = NULL;
- if (esxVI_String_DeepCopyList(conn, &completePropertyNameList,
+ if (esxVI_String_DeepCopyList(&completePropertyNameList,
propertyNameList) < 0 ||
- esxVI_String_AppendValueListToList(conn, &completePropertyNameList,
+ esxVI_String_AppendValueListToList(&completePropertyNameList,
"runtime.question\0"
"recentTask\0") < 0 ||
- esxVI_LookupVirtualMachineByUuid(conn, ctx, uuid,
- completePropertyNameList,
+ esxVI_LookupVirtualMachineByUuid(ctx, uuid, completePropertyNameList,
virtualMachine,
esxVI_Occurrence_RequiredItem) < 0 ||
- esxVI_GetVirtualMachineQuestionInfo(conn, *virtualMachine,
+ esxVI_GetVirtualMachineQuestionInfo(*virtualMachine,
&questionInfo) < 0 ||
esxVI_LookupPendingTaskInfoListByVirtualMachine
- (conn, ctx, *virtualMachine, &pendingTaskInfoList) < 0) {
+ (ctx, *virtualMachine, &pendingTaskInfoList) < 0) {
goto failure;
}
if (questionInfo != NULL &&
- esxVI_HandleVirtualMachineQuestion(conn, ctx, (*virtualMachine)->obj,
+ esxVI_HandleVirtualMachineQuestion(ctx, (*virtualMachine)->obj,
questionInfo, autoAnswer) < 0) {
goto failure;
}
if (pendingTaskInfoList != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_OPERATION_INVALID,
+ ESX_VI_ERROR(VIR_ERR_OPERATION_INVALID,
"Other tasks are pending for this domain");
goto failure;
}
int
-esxVI_LookupDatastoreByName(virConnectPtr conn, esxVI_Context *ctx,
- const char *name, esxVI_String *propertyNameList,
+esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name,
+ esxVI_String *propertyNameList,
esxVI_ObjectContent **datastore,
esxVI_Occurrence occurrence)
{
int numInaccessibleDatastores = 0;
if (datastore == NULL || *datastore != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
/* Get all datastores */
- if (esxVI_String_DeepCopyList(conn, &completePropertyNameList,
+ if (esxVI_String_DeepCopyList(&completePropertyNameList,
propertyNameList) < 0 ||
- esxVI_String_AppendValueListToList(conn, &completePropertyNameList,
+ esxVI_String_AppendValueListToList(&completePropertyNameList,
"summary.accessible\0"
"summary.name\0"
"summary.url\0") < 0) {
goto failure;
}
- if (esxVI_LookupObjectContentByType(conn, ctx, ctx->datacenter,
- "Datastore", completePropertyNameList,
+ if (esxVI_LookupObjectContentByType(ctx, ctx->datacenter, "Datastore",
+ completePropertyNameList,
esxVI_Boolean_True,
&datastoreList) < 0) {
goto failure;
if (occurrence == esxVI_Occurrence_OptionalItem) {
goto cleanup;
} else {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
- "No datastores available");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "No datastores available");
goto failure;
}
}
for (dynamicProperty = candidate->propSet; dynamicProperty != NULL;
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "summary.accessible")) {
- if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_Boolean) < 0) {
goto failure;
}
}
if (accessible == esxVI_Boolean_Undefined) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Got incomplete response while querying for the "
"datastore 'summary.accessible' property");
goto failure;
if (STREQ(dynamicProperty->name, "summary.accessible")) {
/* Ignore it */
} else if (STREQ(dynamicProperty->name, "summary.name")) {
- if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_String) < 0) {
goto failure;
}
if (STREQ(dynamicProperty->val->string, name)) {
- if (esxVI_ObjectContent_DeepCopy(conn, datastore,
+ if (esxVI_ObjectContent_DeepCopy(datastore,
candidate) < 0) {
goto failure;
}
continue;
}
- if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_String) < 0) {
goto failure;
}
if (! STRPREFIX(dynamicProperty->val->string,
"/vmfs/volumes/")) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Datastore URL '%s' has unexpected prefix, "
"expecting '/vmfs/volumes/' prefix",
dynamicProperty->val->string);
}
if (STREQ(dynamicProperty->val->string + offset, name)) {
- if (esxVI_ObjectContent_DeepCopy(conn, datastore,
+ if (esxVI_ObjectContent_DeepCopy(datastore,
candidate) < 0) {
goto failure;
}
if (occurrence != esxVI_Occurrence_OptionalItem) {
if (numInaccessibleDatastores > 0) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not find datastore '%s', maybe it's "
"inaccessible", name);
} else {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not find datastore '%s'", name);
}
-int esxVI_LookupTaskInfoByTask(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_LookupTaskInfoByTask(esxVI_Context *ctx,
esxVI_ManagedObjectReference *task,
esxVI_TaskInfo **taskInfo)
{
esxVI_DynamicProperty *dynamicProperty = NULL;
if (taskInfo == NULL || *taskInfo != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
- if (esxVI_String_AppendValueToList(conn, &propertyNameList, "info") < 0 ||
- esxVI_LookupObjectContentByType(conn, ctx, task, "Task",
- propertyNameList, esxVI_Boolean_False,
+ if (esxVI_String_AppendValueToList(&propertyNameList, "info") < 0 ||
+ esxVI_LookupObjectContentByType(ctx, task, "Task", propertyNameList,
+ esxVI_Boolean_False,
&objectContent) < 0) {
goto failure;
}
for (dynamicProperty = objectContent->propSet; dynamicProperty != NULL;
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "info")) {
- if (esxVI_TaskInfo_CastFromAnyType(conn, dynamicProperty->val,
+ if (esxVI_TaskInfo_CastFromAnyType(dynamicProperty->val,
taskInfo) < 0) {
goto failure;
}
int
esxVI_LookupPendingTaskInfoListByVirtualMachine
- (virConnectPtr conn, esxVI_Context *ctx, esxVI_ObjectContent *virtualMachine,
+ (esxVI_Context *ctx, esxVI_ObjectContent *virtualMachine,
esxVI_TaskInfo **pendingTaskInfoList)
{
int result = 0;
esxVI_TaskInfo *taskInfo = NULL;
if (pendingTaskInfoList == NULL || *pendingTaskInfoList != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "recentTask")) {
if (esxVI_ManagedObjectReference_CastListFromAnyType
- (conn, dynamicProperty->val, &recentTaskList, "Task") < 0) {
+ (dynamicProperty->val, &recentTaskList, "Task") < 0) {
goto failure;
}
/* Lookup task info for each task */
for (recentTask = recentTaskList; recentTask != NULL;
recentTask = recentTask->_next) {
- if (esxVI_LookupTaskInfoByTask(conn, ctx, recentTask, &taskInfo) < 0) {
+ if (esxVI_LookupTaskInfoByTask(ctx, recentTask, &taskInfo) < 0) {
goto failure;
}
if (taskInfo->state == esxVI_TaskInfoState_Queued ||
taskInfo->state == esxVI_TaskInfoState_Running) {
- if (esxVI_TaskInfo_AppendToList(conn, pendingTaskInfoList,
+ if (esxVI_TaskInfo_AppendToList(pendingTaskInfoList,
taskInfo) < 0) {
goto failure;
}
int
-esxVI_LookupAndHandleVirtualMachineQuestion(virConnectPtr conn,
- esxVI_Context *ctx,
+esxVI_LookupAndHandleVirtualMachineQuestion(esxVI_Context *ctx,
const unsigned char *uuid,
esxVI_Boolean autoAnswer)
{
esxVI_String *propertyNameList = NULL;
esxVI_VirtualMachineQuestionInfo *questionInfo = NULL;
- if (esxVI_String_AppendValueToList(conn, &propertyNameList,
+ if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.question") < 0 ||
- esxVI_LookupVirtualMachineByUuid(conn, ctx, uuid, propertyNameList,
+ esxVI_LookupVirtualMachineByUuid(ctx, uuid, propertyNameList,
&virtualMachine,
esxVI_Occurrence_RequiredItem) < 0 ||
- esxVI_GetVirtualMachineQuestionInfo(conn, virtualMachine,
+ esxVI_GetVirtualMachineQuestionInfo(virtualMachine,
&questionInfo) < 0) {
goto failure;
}
if (questionInfo != NULL &&
- esxVI_HandleVirtualMachineQuestion(conn, ctx, virtualMachine->obj,
+ esxVI_HandleVirtualMachineQuestion(ctx, virtualMachine->obj,
questionInfo, autoAnswer) < 0) {
goto failure;
}
int
-esxVI_StartVirtualMachineTask(virConnectPtr conn, esxVI_Context *ctx,
- const char *name, const char *request,
+esxVI_StartVirtualMachineTask(esxVI_Context *ctx, const char *name,
+ const char *request,
esxVI_ManagedObjectReference **task)
{
int result = 0;
esxVI_Response *response = NULL;
if (virAsprintf(&methodName, "%s_Task", name) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
- if (esxVI_Context_Execute(conn, ctx, methodName, request, &response,
+ if (esxVI_Context_Execute(ctx, methodName, request, &response,
esxVI_Occurrence_RequiredItem) < 0 ||
- esxVI_ManagedObjectReference_Deserialize(conn, response->node, task,
+ esxVI_ManagedObjectReference_Deserialize(response->node, task,
"Task") < 0) {
goto failure;
}
int
esxVI_StartSimpleVirtualMachineTask
- (virConnectPtr conn, esxVI_Context *ctx, const char *name,
+ (esxVI_Context *ctx, const char *name,
esxVI_ManagedObjectReference *virtualMachine,
esxVI_ManagedObjectReference **task)
{
virBufferAdd(&buffer, name, -1);
virBufferAddLit(&buffer, "_Task xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn, virtualMachine, "_this",
- &buffer,
+ if (esxVI_ManagedObjectReference_Serialize(virtualMachine, "_this", &buffer,
esxVI_Boolean_True) < 0) {
goto failure;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_StartVirtualMachineTask(conn, ctx, name, request, task) < 0) {
+ if (esxVI_StartVirtualMachineTask(ctx, name, request, task) < 0) {
goto failure;
}
int
-esxVI_SimpleVirtualMachineMethod(virConnectPtr conn, esxVI_Context *ctx,
- const char *name,
+esxVI_SimpleVirtualMachineMethod(esxVI_Context *ctx, const char *name,
esxVI_ManagedObjectReference *virtualMachine)
{
int result = 0;
esxVI_Response *response = NULL;
if (ctx->service == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
virBufferAdd(&buffer, name, -1);
virBufferAddLit(&buffer, " xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn, virtualMachine, "_this",
- &buffer,
+ if (esxVI_ManagedObjectReference_Serialize(virtualMachine, "_this", &buffer,
esxVI_Boolean_True) < 0) {
goto failure;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_Context_Execute(conn, ctx, name, request, &response,
+ if (esxVI_Context_Execute(ctx, name, request, &response,
esxVI_Occurrence_None) < 0) {
goto failure;
}
int
esxVI_HandleVirtualMachineQuestion
- (virConnectPtr conn, esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine,
+ (esxVI_Context *ctx, esxVI_ManagedObjectReference *virtualMachine,
esxVI_VirtualMachineQuestionInfo *questionInfo,
esxVI_Boolean autoAnswer)
{
}
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
if (autoAnswer == esxVI_Boolean_True) {
if (possibleAnswers == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Pending question blocks virtual machine execution, "
"question is '%s', no possible answers",
questionInfo->text);
goto failure;
} else if (answerChoice == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Pending question blocks virtual machine execution, "
"question is '%s', possible answers are %s, but no "
"default answer is specified", questionInfo->text,
"with default answer '%s'", questionInfo->text,
possibleAnswers, answerChoice->label);
- if (esxVI_AnswerVM(conn, ctx, virtualMachine, questionInfo->id,
+ if (esxVI_AnswerVM(ctx, virtualMachine, questionInfo->id,
answerChoice->key) < 0) {
goto failure;
}
} else {
if (possibleAnswers != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Pending question blocks virtual machine execution, "
"question is '%s', possible answers are %s",
questionInfo->text, possibleAnswers);
} else {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Pending question blocks virtual machine execution, "
"question is '%s', no possible answers",
questionInfo->text);
int
-esxVI_WaitForTaskCompletion(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_WaitForTaskCompletion(esxVI_Context *ctx,
esxVI_ManagedObjectReference *task,
const unsigned char *virtualMachineUuid,
esxVI_Boolean autoAnswer,
version = strdup("");
if (version == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
- if (esxVI_ObjectSpec_Alloc(conn, &objectSpec) < 0) {
+ if (esxVI_ObjectSpec_Alloc(&objectSpec) < 0) {
goto failure;
}
objectSpec->obj = task;
objectSpec->skip = esxVI_Boolean_False;
- if (esxVI_PropertySpec_Alloc(conn, &propertySpec) < 0) {
+ if (esxVI_PropertySpec_Alloc(&propertySpec) < 0) {
goto failure;
}
propertySpec->type = task->type;
- if (esxVI_String_AppendValueToList(conn, &propertySpec->pathSet,
+ if (esxVI_String_AppendValueToList(&propertySpec->pathSet,
"info.state") < 0 ||
- esxVI_PropertyFilterSpec_Alloc(conn, &propertyFilterSpec) < 0 ||
- esxVI_PropertySpec_AppendToList(conn, &propertyFilterSpec->propSet,
+ esxVI_PropertyFilterSpec_Alloc(&propertyFilterSpec) < 0 ||
+ esxVI_PropertySpec_AppendToList(&propertyFilterSpec->propSet,
propertySpec) < 0 ||
- esxVI_ObjectSpec_AppendToList(conn, &propertyFilterSpec->objectSet,
+ esxVI_ObjectSpec_AppendToList(&propertyFilterSpec->objectSet,
objectSpec) < 0 ||
- esxVI_CreateFilter(conn, ctx, propertyFilterSpec, esxVI_Boolean_True,
+ esxVI_CreateFilter(ctx, propertyFilterSpec, esxVI_Boolean_True,
&propertyFilter) < 0) {
goto failure;
}
if (virtualMachineUuid != NULL) {
if (esxVI_LookupAndHandleVirtualMachineQuestion
- (conn, ctx, virtualMachineUuid, autoAnswer) < 0) {
+ (ctx, virtualMachineUuid, autoAnswer) < 0) {
/*
* FIXME: Disable error reporting here, so possible errors from
* esxVI_LookupTaskInfoByTask() and esxVI_CancelTask()
* don't overwrite the actual error
*/
- if (esxVI_LookupTaskInfoByTask(conn, ctx, task, &taskInfo)) {
+ if (esxVI_LookupTaskInfoByTask(ctx, task, &taskInfo)) {
goto failure;
}
if (taskInfo->cancelable == esxVI_Boolean_True) {
- if (esxVI_CancelTask(conn, ctx, task) < 0) {
+ if (esxVI_CancelTask(ctx, task) < 0) {
VIR_ERROR0("Cancelable task is blocked by an "
"unanswered question but cancelation "
"failed");
}
}
- if (esxVI_WaitForUpdates(conn, ctx, version, &updateSet) < 0) {
+ if (esxVI_WaitForUpdates(ctx, version, &updateSet) < 0) {
goto failure;
}
version = strdup(updateSet->version);
if (version == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
continue;
}
- if (esxVI_TaskInfoState_CastFromAnyType(conn, propertyValue,
- &state) < 0) {
+ if (esxVI_TaskInfoState_CastFromAnyType(propertyValue, &state) < 0) {
goto failure;
}
}
- if (esxVI_DestroyPropertyFilter(conn, ctx, propertyFilter) < 0) {
+ if (esxVI_DestroyPropertyFilter(ctx, propertyFilter) < 0) {
VIR_DEBUG0("DestroyPropertyFilter failed");
}
- if (esxVI_TaskInfoState_CastFromAnyType(conn, propertyValue,
- finalState) < 0) {
+ if (esxVI_TaskInfoState_CastFromAnyType(propertyValue, finalState) < 0) {
goto failure;
}
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);
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);
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);
};
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);
* - '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,
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,
#define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_VI_ERROR(conn, code, fmt...) \
- virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+#define ESX_VI_ERROR(code, fmt...) \
+ virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, fmt)
#define ESX_VI__SOAP__REQUEST_HEADER \
*/
int
-esxVI_RetrieveServiceContent(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_RetrieveServiceContent(esxVI_Context *ctx,
esxVI_ServiceContent **serviceContent)
{
int result = 0;
esxVI_Response *response = NULL;
if (serviceContent == NULL || *serviceContent != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
- if (esxVI_Context_Execute(conn, ctx, "RetrieveServiceContent", request,
+ if (esxVI_Context_Execute(ctx, "RetrieveServiceContent", request,
&response, esxVI_Occurrence_RequiredItem) < 0 ||
- esxVI_ServiceContent_Deserialize(conn, response->node,
- serviceContent) < 0) {
+ esxVI_ServiceContent_Deserialize(response->node, serviceContent) < 0) {
goto failure;
}
int
-esxVI_Login(virConnectPtr conn, esxVI_Context *ctx,
- const char *userName, const char *password,
+esxVI_Login(esxVI_Context *ctx, const char *userName, const char *password,
esxVI_UserSession **userSession)
{
int result = 0;
esxVI_Response *response = NULL;
if (ctx->service == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
return -1;
}
if (userSession == NULL || *userSession != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
virBufferAddLit(&buffer, "<Login xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn,
- ctx->service->sessionManager,
+ if (esxVI_ManagedObjectReference_Serialize(ctx->service->sessionManager,
"_this", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_String_SerializeValue(conn, userName, "userName", &buffer,
+ esxVI_String_SerializeValue(userName, "userName", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_String_SerializeValue(conn, password, "password", &buffer,
+ esxVI_String_SerializeValue(password, "password", &buffer,
esxVI_Boolean_True) < 0) {
goto failure;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_Context_Execute(conn, ctx, "Login", request, &response,
+ if (esxVI_Context_Execute(ctx, "Login", request, &response,
esxVI_Occurrence_RequiredItem) < 0 ||
- esxVI_UserSession_Deserialize(conn, response->node, userSession) < 0) {
+ esxVI_UserSession_Deserialize(response->node, userSession) < 0) {
goto failure;
}
int
-esxVI_Logout(virConnectPtr conn, esxVI_Context *ctx)
+esxVI_Logout(esxVI_Context *ctx)
{
int result = 0;
virBuffer buffer = VIR_BUFFER_INITIALIZER;
esxVI_Response *response = NULL;
if (ctx->service == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
return -1;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
virBufferAddLit(&buffer, "<Logout xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn,
- ctx->service->sessionManager,
+ if (esxVI_ManagedObjectReference_Serialize(ctx->service->sessionManager,
"_this", &buffer,
esxVI_Boolean_True) < 0) {
goto failure;
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_Context_Execute(conn, ctx, "Logout", request, &response,
+ if (esxVI_Context_Execute(ctx, "Logout", request, &response,
esxVI_Occurrence_None) < 0) {
goto failure;
}
int
-esxVI_SessionIsActive(virConnectPtr conn, esxVI_Context *ctx,
- const char *sessionID, const char *userName,
- esxVI_Boolean *active)
+esxVI_SessionIsActive(esxVI_Context *ctx, const char *sessionID,
+ const char *userName, esxVI_Boolean *active)
{
int result = 0;
virBuffer buffer = VIR_BUFFER_INITIALIZER;
esxVI_Response *response = NULL;
if (ctx->service == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
return -1;
}
if (active == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
virBufferAddLit(&buffer, "<SessionIsActive xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn,
- ctx->service->sessionManager,
+ if (esxVI_ManagedObjectReference_Serialize(ctx->service->sessionManager,
"_this", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_String_SerializeValue(conn, sessionID, "sessionID", &buffer,
+ esxVI_String_SerializeValue(sessionID, "sessionID", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_String_SerializeValue(conn, userName, "userName", &buffer,
+ esxVI_String_SerializeValue(userName, "userName", &buffer,
esxVI_Boolean_True) < 0) {
goto failure;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_Context_Execute(conn, ctx, "SessionIsActive", request,
- &response, esxVI_Occurrence_RequiredItem) < 0 ||
- esxVI_Boolean_Deserialize(conn, response->node, active) < 0) {
+ if (esxVI_Context_Execute(ctx, "SessionIsActive", request, &response,
+ esxVI_Occurrence_RequiredItem) < 0 ||
+ esxVI_Boolean_Deserialize(response->node, active) < 0) {
goto failure;
}
int
-esxVI_RetrieveProperties(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_RetrieveProperties(esxVI_Context *ctx,
esxVI_PropertyFilterSpec *propertyFilterSpecList,
esxVI_ObjectContent **objectContentList)
{
esxVI_Response *response = NULL;
if (ctx->service == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
return -1;
}
if (objectContentList == NULL || *objectContentList != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
virBufferAddLit(&buffer, "<RetrieveProperties xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn,
- ctx->service->propertyCollector,
+ if (esxVI_ManagedObjectReference_Serialize(ctx->service->propertyCollector,
"_this", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_PropertyFilterSpec_SerializeList(conn, propertyFilterSpecList,
+ esxVI_PropertyFilterSpec_SerializeList(propertyFilterSpecList,
"specSet", &buffer,
esxVI_Boolean_True) < 0) {
goto failure;
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_Context_Execute(conn, ctx, "RetrieveProperties", request,
- &response, esxVI_Occurrence_List) < 0 ||
- esxVI_ObjectContent_DeserializeList(conn, response->node,
+ if (esxVI_Context_Execute(ctx, "RetrieveProperties", request, &response,
+ esxVI_Occurrence_List) < 0 ||
+ esxVI_ObjectContent_DeserializeList(response->node,
objectContentList) < 0) {
goto failure;
}
int
-esxVI_PowerOnVM_Task(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_PowerOnVM_Task(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine,
esxVI_ManagedObjectReference **task)
{
- return esxVI_StartSimpleVirtualMachineTask(conn, ctx, "PowerOnVM",
+ return esxVI_StartSimpleVirtualMachineTask(ctx, "PowerOnVM",
virtualMachine, task);
}
int
-esxVI_PowerOffVM_Task(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_PowerOffVM_Task(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine,
esxVI_ManagedObjectReference **task)
{
- return esxVI_StartSimpleVirtualMachineTask(conn, ctx, "PowerOffVM",
+ return esxVI_StartSimpleVirtualMachineTask(ctx, "PowerOffVM",
virtualMachine, task);
}
int
-esxVI_SuspendVM_Task(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_SuspendVM_Task(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine,
esxVI_ManagedObjectReference **task)
{
- return esxVI_StartSimpleVirtualMachineTask(conn, ctx, "SuspendVM",
+ return esxVI_StartSimpleVirtualMachineTask(ctx, "SuspendVM",
virtualMachine, task);
}
int
-esxVI_MigrateVM_Task(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_MigrateVM_Task(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine,
esxVI_ManagedObjectReference *resourcePool,
esxVI_ManagedObjectReference *hostSystem,
char *request = NULL;
if (task == NULL || *task != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
virBufferAddLit(&buffer, "<MigrateVM_Task xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn, virtualMachine, "_this",
- &buffer,
+ if (esxVI_ManagedObjectReference_Serialize(virtualMachine, "_this", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_ManagedObjectReference_Serialize(conn, resourcePool, "pool",
- &buffer,
+ esxVI_ManagedObjectReference_Serialize(resourcePool, "pool", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_ManagedObjectReference_Serialize(conn, hostSystem, "host",
- &buffer,
+ esxVI_ManagedObjectReference_Serialize(hostSystem, "host", &buffer,
esxVI_Boolean_True) < 0 ||
esxVI_VirtualMachineMovePriority_Serialize
- (conn, esxVI_VirtualMachineMovePriority_DefaultPriority,
- "priority", &buffer, esxVI_Boolean_True) < 0) {
+ (esxVI_VirtualMachineMovePriority_DefaultPriority, "priority",
+ &buffer, esxVI_Boolean_True) < 0) {
goto failure;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_StartVirtualMachineTask(conn, ctx, "MigrateVM", request,
- task) < 0) {
+ if (esxVI_StartVirtualMachineTask(ctx, "MigrateVM", request, task) < 0) {
goto failure;
}
int
-esxVI_ReconfigVM_Task(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_ReconfigVM_Task(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine,
esxVI_VirtualMachineConfigSpec *spec,
esxVI_ManagedObjectReference **task)
char *request = NULL;
if (task == NULL || *task != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
virBufferAddLit(&buffer, "<ReconfigVM_Task xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn, virtualMachine, "_this",
- &buffer,
+ if (esxVI_ManagedObjectReference_Serialize(virtualMachine, "_this", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_VirtualMachineConfigSpec_Serialize(conn, spec, "spec", &buffer,
+ esxVI_VirtualMachineConfigSpec_Serialize(spec, "spec", &buffer,
esxVI_Boolean_True) < 0) {
goto failure;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_StartVirtualMachineTask(conn, ctx, "ReconfigVM", request,
- task) < 0) {
+ if (esxVI_StartVirtualMachineTask(ctx, "ReconfigVM", request, task) < 0) {
goto failure;
}
int
-esxVI_RegisterVM_Task(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_RegisterVM_Task(esxVI_Context *ctx,
esxVI_ManagedObjectReference *folder,
const char *path, const char *name,
esxVI_Boolean asTemplate,
char *request = NULL;
if (task == NULL || *task != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
virBufferAddLit(&buffer, "<RegisterVM_Task xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn, folder, "_this", &buffer,
+ if (esxVI_ManagedObjectReference_Serialize(folder, "_this", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_String_SerializeValue(conn, path, "path", &buffer,
+ esxVI_String_SerializeValue(path, "path", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_String_SerializeValue(conn, name, "name", &buffer,
+ esxVI_String_SerializeValue(name, "name", &buffer,
esxVI_Boolean_False) < 0 ||
- esxVI_Boolean_Serialize(conn, asTemplate, "asTemplate", &buffer,
+ esxVI_Boolean_Serialize(asTemplate, "asTemplate", &buffer,
esxVI_Boolean_False) < 0 ||
- esxVI_ManagedObjectReference_Serialize(conn, resourcePool, "pool",
- &buffer,
+ esxVI_ManagedObjectReference_Serialize(resourcePool, "pool", &buffer,
esxVI_Boolean_False) < 0 ||
- esxVI_ManagedObjectReference_Serialize(conn, hostSystem, "host",
- &buffer,
+ esxVI_ManagedObjectReference_Serialize(hostSystem, "host", &buffer,
esxVI_Boolean_False) < 0) {
goto failure;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_StartVirtualMachineTask(conn, ctx, "RegisterVM", request,
- task) < 0) {
+ if (esxVI_StartVirtualMachineTask(ctx, "RegisterVM", request, task) < 0) {
goto failure;
}
int
-esxVI_CancelTask(virConnectPtr conn, esxVI_Context *ctx,
- esxVI_ManagedObjectReference *task)
+esxVI_CancelTask(esxVI_Context *ctx, esxVI_ManagedObjectReference *task)
{
int result = 0;
virBuffer buffer = VIR_BUFFER_INITIALIZER;
esxVI_Response *response = NULL;
if (ctx->service == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
return -1;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
virBufferAddLit(&buffer, "<CancelTask xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn, task, "_this", &buffer,
+ if (esxVI_ManagedObjectReference_Serialize(task, "_this", &buffer,
esxVI_Boolean_True) < 0) {
goto failure;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_Context_Execute(conn, ctx, "CancelTask", request, &response,
+ if (esxVI_Context_Execute(ctx, "CancelTask", request, &response,
esxVI_Occurrence_None) < 0) {
goto failure;
}
int
-esxVI_UnregisterVM(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_UnregisterVM(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine)
{
int result = 0;
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
virBufferAddLit(&buffer, "<UnregisterVM xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn, virtualMachine, "_this",
- &buffer,
+ if (esxVI_ManagedObjectReference_Serialize(virtualMachine, "_this", &buffer,
esxVI_Boolean_True) < 0) {
goto failure;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_Context_Execute(conn, ctx, "UnregisterVM", request, &response,
+ if (esxVI_Context_Execute(ctx, "UnregisterVM", request, &response,
esxVI_Occurrence_None) < 0) {
goto failure;
}
int
-esxVI_AnswerVM(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_AnswerVM(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine,
const char *questionId, const char *answerChoice)
{
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
virBufferAddLit(&buffer, "<AnswerVM xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn, virtualMachine, "_this",
- &buffer,
+ if (esxVI_ManagedObjectReference_Serialize(virtualMachine, "_this", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_String_SerializeValue(conn, questionId, "questionId",
- &buffer, esxVI_Boolean_True) < 0 ||
- esxVI_String_SerializeValue(conn, answerChoice, "answerChoice",
- &buffer, esxVI_Boolean_True) < 0) {
+ esxVI_String_SerializeValue(questionId, "questionId", &buffer,
+ esxVI_Boolean_True) < 0 ||
+ esxVI_String_SerializeValue(answerChoice, "answerChoice", &buffer,
+ esxVI_Boolean_True) < 0) {
goto failure;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_Context_Execute(conn, ctx, request, NULL, &response,
+ if (esxVI_Context_Execute(ctx, request, NULL, &response,
esxVI_Boolean_False) < 0) {
goto failure;
}
int
-esxVI_CreateFilter(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_CreateFilter(esxVI_Context *ctx,
esxVI_PropertyFilterSpec *propertyFilterSpec,
esxVI_Boolean partialUpdates,
esxVI_ManagedObjectReference **propertyFilter)
esxVI_Response *response = NULL;
if (ctx->service == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
return -1;
}
if (propertyFilter == NULL || *propertyFilter != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
virBufferAddLit(&buffer, "<CreateFilter xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn,
- ctx->service->propertyCollector,
+ if (esxVI_ManagedObjectReference_Serialize(ctx->service->propertyCollector,
"_this", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_PropertyFilterSpec_Serialize(conn, propertyFilterSpec, "spec",
- &buffer, esxVI_Boolean_True) < 0 ||
- esxVI_Boolean_Serialize(conn, partialUpdates, "partialUpdates",
- &buffer, esxVI_Boolean_True) < 0) {
+ esxVI_PropertyFilterSpec_Serialize(propertyFilterSpec, "spec", &buffer,
+ esxVI_Boolean_True) < 0 ||
+ esxVI_Boolean_Serialize(partialUpdates, "partialUpdates", &buffer,
+ esxVI_Boolean_True) < 0) {
goto failure;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_Context_Execute(conn, ctx, "CreateFilter", request, &response,
+ if (esxVI_Context_Execute(ctx, "CreateFilter", request, &response,
esxVI_Occurrence_RequiredItem) < 0 ||
- esxVI_ManagedObjectReference_Deserialize(conn, response->node,
- propertyFilter,
+ esxVI_ManagedObjectReference_Deserialize(response->node, propertyFilter,
"PropertyFilter") < 0) {
goto failure;
}
int
-esxVI_DestroyPropertyFilter(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_DestroyPropertyFilter(esxVI_Context *ctx,
esxVI_ManagedObjectReference *propertyFilter)
{
int result = 0;
esxVI_Response *response = NULL;
if (ctx->service == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
return -1;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
virBufferAddLit(&buffer, "<DestroyPropertyFilter xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn, propertyFilter, "_this",
- &buffer,
+ if (esxVI_ManagedObjectReference_Serialize(propertyFilter, "_this", &buffer,
esxVI_Boolean_True) < 0) {
goto failure;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_Context_Execute(conn, ctx, "DestroyPropertyFilter", request,
+ if (esxVI_Context_Execute(ctx, "DestroyPropertyFilter", request,
&response, esxVI_Occurrence_None) < 0) {
goto failure;
}
int
-esxVI_WaitForUpdates(virConnectPtr conn, esxVI_Context *ctx,
- const char *version, esxVI_UpdateSet **updateSet)
+esxVI_WaitForUpdates(esxVI_Context *ctx, const char *version,
+ esxVI_UpdateSet **updateSet)
{
int result = 0;
virBuffer buffer = VIR_BUFFER_INITIALIZER;
esxVI_Response *response = NULL;
if (ctx->service == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
return -1;
}
if (updateSet == NULL || *updateSet != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
virBufferAddLit(&buffer, "<WaitForUpdates xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn,
- ctx->service->propertyCollector,
+ if (esxVI_ManagedObjectReference_Serialize(ctx->service->propertyCollector,
"_this", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_String_SerializeValue(conn, version, "version", &buffer,
+ esxVI_String_SerializeValue(version, "version", &buffer,
esxVI_Boolean_True) < 0) {
goto failure;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_Context_Execute(conn, ctx, "WaitForUpdates", request,
+ if (esxVI_Context_Execute(ctx, "WaitForUpdates", request,
&response, esxVI_Occurrence_RequiredItem) < 0 ||
- esxVI_UpdateSet_Deserialize(conn, response->node, updateSet) < 0) {
+ esxVI_UpdateSet_Deserialize(response->node, updateSet) < 0) {
goto failure;
}
int
-esxVI_RebootGuest(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_RebootGuest(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine)
{
- return esxVI_SimpleVirtualMachineMethod(conn, ctx, "RebootGuest",
- virtualMachine);
+ return esxVI_SimpleVirtualMachineMethod(ctx, "RebootGuest", virtualMachine);
}
int
-esxVI_ShutdownGuest(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_ShutdownGuest(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine)
{
- return esxVI_SimpleVirtualMachineMethod(conn, ctx, "ShutdownGuest",
+ return esxVI_SimpleVirtualMachineMethod(ctx, "ShutdownGuest",
virtualMachine);
}
int
-esxVI_ValidateMigration(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_ValidateMigration(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachineList,
esxVI_VirtualMachinePowerState powerState,
esxVI_String *testTypeList,
esxVI_Response *response = NULL;
if (ctx->service == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
return -1;
}
if (eventList == NULL || *eventList != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
"ServiceInstance"
"</_this>");
- if (esxVI_ManagedObjectReference_SerializeList(conn, virtualMachineList,
- "vm", &buffer,
+ if (esxVI_ManagedObjectReference_SerializeList(virtualMachineList, "vm",
+ &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_VirtualMachinePowerState_Serialize(conn, powerState, "state",
- &buffer,
+ esxVI_VirtualMachinePowerState_Serialize(powerState, "state", &buffer,
esxVI_Boolean_False) < 0 ||
- esxVI_String_SerializeList(conn, testTypeList, "testType", &buffer,
+ esxVI_String_SerializeList(testTypeList, "testType", &buffer,
esxVI_Boolean_False) < 0 ||
- esxVI_ManagedObjectReference_Serialize(conn, resourcePool, "pool",
- &buffer,
+ esxVI_ManagedObjectReference_Serialize(resourcePool, "pool", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_ManagedObjectReference_Serialize(conn, hostSystem, "host",
- &buffer,
+ esxVI_ManagedObjectReference_Serialize(hostSystem, "host", &buffer,
esxVI_Boolean_True) < 0) {
goto failure;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_Context_Execute(conn, ctx, "ValidateMigration", request,
- &response, esxVI_Occurrence_List) < 0 ||
- esxVI_Event_DeserializeList(conn, response->node, eventList) < 0) {
+ if (esxVI_Context_Execute(ctx, "ValidateMigration", request, &response,
+ esxVI_Occurrence_List) < 0 ||
+ esxVI_Event_DeserializeList(response->node, eventList) < 0) {
goto failure;
}
int
-esxVI_FindByIp(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_FindByIp(esxVI_Context *ctx,
esxVI_ManagedObjectReference *datacenter,
const char *ip, esxVI_Boolean vmSearch,
esxVI_ManagedObjectReference **managedObjectReference)
esxVI_Response *response = NULL;
if (ctx->service == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
return -1;
}
if (managedObjectReference == NULL || *managedObjectReference != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
virBufferAddLit(&buffer, "<FindByIp xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn, ctx->service->searchIndex,
+ if (esxVI_ManagedObjectReference_Serialize(ctx->service->searchIndex,
"_this", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_ManagedObjectReference_Serialize(conn, datacenter,
- "datacenter", &buffer,
+ esxVI_ManagedObjectReference_Serialize(datacenter, "datacenter",
+ &buffer,
esxVI_Boolean_False) < 0 ||
- esxVI_String_SerializeValue(conn, ip, "ip", &buffer,
+ esxVI_String_SerializeValue(ip, "ip", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_Boolean_Serialize(conn, vmSearch, "vmSearch", &buffer,
+ esxVI_Boolean_Serialize(vmSearch, "vmSearch", &buffer,
esxVI_Boolean_True) < 0) {
goto failure;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_Context_Execute(conn, ctx, "FindByIp", request, &response,
+ if (esxVI_Context_Execute(ctx, "FindByIp", request, &response,
esxVI_Occurrence_OptionalItem) < 0 ||
esxVI_ManagedObjectReference_Deserialize
- (conn, response->node, managedObjectReference,
+ (response->node, managedObjectReference,
vmSearch == esxVI_Boolean_True ? "VirtualMachine"
: "HostSystem") < 0) {
goto failure;
int
-esxVI_FindByUuid(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_FindByUuid(esxVI_Context *ctx,
esxVI_ManagedObjectReference *datacenter,
const unsigned char *uuid, esxVI_Boolean vmSearch,
esxVI_ManagedObjectReference **managedObjectReference)
esxVI_Response *response = NULL;
if (ctx->service == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
return -1;
}
if (managedObjectReference == NULL || *managedObjectReference != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
virBufferAddLit(&buffer, "<FindByUuid xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn, ctx->service->searchIndex,
+ if (esxVI_ManagedObjectReference_Serialize(ctx->service->searchIndex,
"_this", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_ManagedObjectReference_Serialize(conn, datacenter,
- "datacenter", &buffer,
+ esxVI_ManagedObjectReference_Serialize(datacenter, "datacenter",
+ &buffer,
esxVI_Boolean_False) < 0 ||
- esxVI_String_SerializeValue(conn, uuid_string, "uuid", &buffer,
+ esxVI_String_SerializeValue(uuid_string, "uuid", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_Boolean_Serialize(conn, vmSearch, "vmSearch", &buffer,
+ esxVI_Boolean_Serialize(vmSearch, "vmSearch", &buffer,
esxVI_Boolean_True) < 0) {
goto failure;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_Context_Execute(conn, ctx, "FindByUuid", request, &response,
+ if (esxVI_Context_Execute(ctx, "FindByUuid", request, &response,
esxVI_Occurrence_OptionalItem) < 0) {
goto failure;
}
}
if (esxVI_ManagedObjectReference_Deserialize
- (conn, response->node, managedObjectReference,
+ (response->node, managedObjectReference,
vmSearch == esxVI_Boolean_True ? "VirtualMachine"
: "HostSystem") < 0) {
goto failure;
int
-esxVI_QueryAvailablePerfMetric(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_QueryAvailablePerfMetric(esxVI_Context *ctx,
esxVI_ManagedObjectReference *entity,
esxVI_DateTime *beginTime,
esxVI_DateTime *endTime, esxVI_Int *intervalId,
esxVI_Response *response = NULL;
if (ctx->service == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
return -1;
}
if (perfMetricIdList == NULL || *perfMetricIdList != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
virBufferAddLit(&buffer, "<QueryAvailablePerfMetric xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn, ctx->service->perfManager,
+ if (esxVI_ManagedObjectReference_Serialize(ctx->service->perfManager,
"_this", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_ManagedObjectReference_Serialize(conn, entity,
- "entity", &buffer,
+ esxVI_ManagedObjectReference_Serialize(entity, "entity", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_DateTime_Serialize(conn, beginTime, "beginTime", &buffer,
+ esxVI_DateTime_Serialize(beginTime, "beginTime", &buffer,
esxVI_Boolean_False) < 0 ||
- esxVI_DateTime_Serialize(conn, endTime, "endTime", &buffer,
+ esxVI_DateTime_Serialize(endTime, "endTime", &buffer,
esxVI_Boolean_False) < 0 ||
- esxVI_Int_Serialize(conn, intervalId, "intervalId", &buffer,
+ esxVI_Int_Serialize(intervalId, "intervalId", &buffer,
esxVI_Boolean_False) < 0) {
goto failure;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_Context_Execute(conn, ctx, "QueryAvailablePerfMetric", request,
+ if (esxVI_Context_Execute(ctx, "QueryAvailablePerfMetric", request,
&response, esxVI_Occurrence_List) < 0 ||
- esxVI_PerfMetricId_DeserializeList(conn, response->node,
+ esxVI_PerfMetricId_DeserializeList(response->node,
perfMetricIdList) < 0) {
goto failure;
}
int
-esxVI_QueryPerfCounter(virConnectPtr conn, esxVI_Context *ctx,
- esxVI_Int *counterIdList,
+esxVI_QueryPerfCounter(esxVI_Context *ctx, esxVI_Int *counterIdList,
esxVI_PerfCounterInfo **perfCounterInfoList)
{
int result = 0;
esxVI_Response *response = NULL;
if (ctx->service == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
return -1;
}
if (perfCounterInfoList == NULL || *perfCounterInfoList != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
virBufferAddLit(&buffer, "<QueryPerfCounter xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn, ctx->service->perfManager,
+ if (esxVI_ManagedObjectReference_Serialize(ctx->service->perfManager,
"_this", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_Int_SerializeList(conn, counterIdList, "counterId", &buffer,
+ esxVI_Int_SerializeList(counterIdList, "counterId", &buffer,
esxVI_Boolean_True) < 0) {
goto failure;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_Context_Execute(conn, ctx, "QueryPerfCounter", request,
- &response, esxVI_Occurrence_List) < 0 ||
- esxVI_PerfCounterInfo_DeserializeList(conn, response->node,
+ if (esxVI_Context_Execute(ctx, "QueryPerfCounter", request, &response,
+ esxVI_Occurrence_List) < 0 ||
+ esxVI_PerfCounterInfo_DeserializeList(response->node,
perfCounterInfoList) < 0) {
goto failure;
}
int
-esxVI_QueryPerf(virConnectPtr conn, esxVI_Context *ctx,
- esxVI_PerfQuerySpec *querySpecList,
+esxVI_QueryPerf(esxVI_Context *ctx, esxVI_PerfQuerySpec *querySpecList,
esxVI_PerfEntityMetric **perfEntityMetricList)
{
int result = 0;
esxVI_Response *response = NULL;
if (ctx->service == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
return -1;
}
if (perfEntityMetricList == NULL || *perfEntityMetricList != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
virBufferAddLit(&buffer, "<QueryPerf xmlns=\"urn:vim25\">");
- if (esxVI_ManagedObjectReference_Serialize(conn, ctx->service->perfManager,
+ if (esxVI_ManagedObjectReference_Serialize(ctx->service->perfManager,
"_this", &buffer,
esxVI_Boolean_True) < 0 ||
- esxVI_PerfQuerySpec_SerializeList(conn, querySpecList, "querySpec",
- &buffer, esxVI_Boolean_True) < 0) {
+ esxVI_PerfQuerySpec_SerializeList(querySpecList, "querySpec", &buffer,
+ esxVI_Boolean_True) < 0) {
goto failure;
}
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
request = virBufferContentAndReset(&buffer);
- if (esxVI_Context_Execute(conn, ctx, "QueryPerf", request, &response,
+ if (esxVI_Context_Execute(ctx, "QueryPerf", request, &response,
esxVI_Occurrence_List) < 0 ||
- esxVI_PerfEntityMetric_DeserializeList(conn, response->node,
+ esxVI_PerfEntityMetric_DeserializeList(response->node,
perfEntityMetricList) < 0) {
goto failure;
}
* 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,
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
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__ */
#define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_VI_ERROR(conn, code, fmt...) \
- virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+#define ESX_VI_ERROR(code, fmt...) \
+ virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, fmt)
#define ESX_VI__TEMPLATE__ALLOC(_type) \
int \
- esxVI_##_type##_Alloc(virConnectPtr conn, esxVI_##_type **ptrptr) \
+ esxVI_##_type##_Alloc(esxVI_##_type **ptrptr) \
{ \
- return esxVI_Alloc(conn, (void **)ptrptr, sizeof(esxVI_##_type)); \
+ return esxVI_Alloc((void **)ptrptr, sizeof(esxVI_##_type)); \
}
#define ESX_VI__TEMPLATE__LIST__APPEND(_type) \
int \
- esxVI_##_type##_AppendToList(virConnectPtr conn, esxVI_##_type **list, \
- esxVI_##_type *item) \
+ esxVI_##_type##_AppendToList(esxVI_##_type **list, esxVI_##_type *item) \
{ \
- return esxVI_List_Append(conn, (esxVI_List **)list, \
- (esxVI_List *)item); \
+ return esxVI_List_Append((esxVI_List **)list, (esxVI_List *)item); \
}
#define ESX_VI__TEMPLATE__LIST__DEEP_COPY(_type) \
int \
- esxVI_##_type##_DeepCopyList(virConnectPtr conn, \
- esxVI_##_type **destList, \
+ esxVI_##_type##_DeepCopyList(esxVI_##_type **destList, \
esxVI_##_type *srcList) \
{ \
return esxVI_List_DeepCopy \
- (conn, (esxVI_List **)destList, (esxVI_List *)srcList, \
+ ((esxVI_List **)destList, (esxVI_List *)srcList, \
(esxVI_List_DeepCopyFunc)esxVI_##_type##_DeepCopy, \
(esxVI_List_FreeFunc)esxVI_##_type##_Free); \
}
#define ESX_VI__TEMPLATE__LIST__CAST_FROM_ANY_TYPE(_type) \
int \
- esxVI_##_type##_CastListFromAnyType(virConnectPtr conn, \
- esxVI_AnyType *anyType, \
+ esxVI_##_type##_CastListFromAnyType(esxVI_AnyType *anyType, \
esxVI_##_type **list) \
{ \
return esxVI_List_CastFromAnyType \
- (conn, anyType, (esxVI_List **)list, \
+ (anyType, (esxVI_List **)list, \
(esxVI_List_CastFromAnyTypeFunc) \
esxVI_##_type##_CastFromAnyType, \
(esxVI_List_FreeFunc)esxVI_##_type##_Free); \
#define ESX_VI__TEMPLATE__LIST__SERIALIZE(_type) \
int \
- esxVI_##_type##_SerializeList(virConnectPtr conn, esxVI_##_type *list, \
- const char *element, virBufferPtr output, \
+ esxVI_##_type##_SerializeList(esxVI_##_type *list, const char *element, \
+ virBufferPtr output, \
esxVI_Boolean required) \
{ \
- return esxVI_List_Serialize(conn, (esxVI_List *)list, \
- element, output, required, \
+ return esxVI_List_Serialize((esxVI_List *)list, element, \
+ output, required, \
(esxVI_List_SerializeFunc) \
esxVI_##_type##_Serialize); \
}
#define ESX_VI__TEMPLATE__LIST__DESERIALIZE(_type) \
int \
- esxVI_##_type##_DeserializeList(virConnectPtr conn, xmlNodePtr node, \
- esxVI_##_type **list) \
+ esxVI_##_type##_DeserializeList(xmlNodePtr node, esxVI_##_type **list) \
{ \
return esxVI_List_Deserialize \
- (conn, node, (esxVI_List **)list, \
+ (node, (esxVI_List **)list, \
(esxVI_List_DeserializeFunc)esxVI_##_type##_Deserialize, \
(esxVI_List_FreeFunc)esxVI_##_type##_Free); \
}
#define ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(_type) \
int \
- esxVI_##_type##_CastFromAnyType(virConnectPtr conn, \
- esxVI_AnyType *anyType, \
+ esxVI_##_type##_CastFromAnyType(esxVI_AnyType *anyType, \
esxVI_##_type **ptrptr) \
{ \
if (anyType == NULL || ptrptr == NULL || *ptrptr != NULL) { \
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
return -1; \
} \
\
if (STRNEQ(anyType->other, #_type)) { \
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
"Expecting type '%s' but found '%s'", \
#_type, anyType->other); \
return -1; \
} \
\
- return esxVI_##_type##_Deserialize(conn, anyType->_node, ptrptr); \
+ return esxVI_##_type##_Deserialize(anyType->_node, ptrptr); \
}
#define ESX_VI__TEMPLATE__SERIALIZE_EXTRA(_type, _type_string, _serialize) \
int \
- esxVI_##_type##_Serialize(virConnectPtr conn, \
- esxVI_##_type *item, \
+ esxVI_##_type##_Serialize(esxVI_##_type *item, \
const char *element, virBufferPtr output, \
esxVI_Boolean required) \
{ \
if (element == NULL || output == NULL ) { \
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
return -1; \
} \
\
if (item == NULL) { \
- return esxVI_CheckSerializationNecessity(conn, element, \
- required); \
+ return esxVI_CheckSerializationNecessity(element, required); \
} \
\
ESV_VI__XML_TAG__OPEN(output, element, _type_string); \
#define ESX_VI__TEMPLATE__DESERIALIZE(_type, _deserialize, _require) \
int \
- esxVI_##_type##_Deserialize(virConnectPtr conn, xmlNodePtr node, \
- esxVI_##_type **ptrptr) \
+ esxVI_##_type##_Deserialize(xmlNodePtr node, esxVI_##_type **ptrptr) \
{ \
xmlNodePtr childNode = NULL; \
\
if (ptrptr == NULL || *ptrptr != NULL) { \
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
return -1; \
} \
\
- if (esxVI_##_type##_Alloc(conn, ptrptr) < 0) { \
+ if (esxVI_##_type##_Alloc(ptrptr) < 0) { \
return -1; \
} \
\
for (childNode = node->children; childNode != NULL; \
childNode = childNode->next) { \
if (childNode->type != XML_ELEMENT_NODE) { \
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
"Wrong XML element type %d", childNode->type); \
goto failure; \
} \
#define ESX_VI__TEMPLATE__DESERIALIZE_NUMBER(_type, _xsdType, _min, _max) \
int \
- esxVI_##_type##_Deserialize(virConnectPtr conn, xmlNodePtr node, \
- esxVI_##_type **number) \
+ esxVI_##_type##_Deserialize(xmlNodePtr node, esxVI_##_type **number) \
{ \
int result = 0; \
char *string; \
long long value; \
\
if (number == NULL || *number != NULL) { \
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
return -1; \
} \
\
- if (esxVI_##_type##_Alloc(conn, number) < 0) { \
+ if (esxVI_##_type##_Alloc(number) < 0) { \
return -1; \
} \
\
string = (char *)xmlNodeListGetString(node->doc, node->children, 1); \
\
if (string == NULL) { \
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
"XML node doesn't contain text, expecting an " \
_xsdType" value"); \
goto failure; \
} \
\
if (virStrToLong_ll(string, NULL, 10, &value) < 0) { \
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
"Unknown value '%s' for "_xsdType, string); \
goto failure; \
} \
\
if (value < (_min) || value > (_max)) { \
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
"Value '%s' is not representable as "_xsdType, \
(const char *)string); \
goto failure; \
#define ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(_type, _name, _required) \
- if (esxVI_##_type##_Serialize(conn, item->_name, #_name, output, \
+ if (esxVI_##_type##_Serialize(item->_name, #_name, output, \
esxVI_Boolean_##_required) < 0) { \
return -1; \
}
#define ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(_type, _name, _required) \
- if (esxVI_##_type##_SerializeValue(conn, item->_name, #_name, output, \
+ if (esxVI_##_type##_SerializeValue(item->_name, #_name, output, \
esxVI_Boolean_##_required) < 0) { \
return -1; \
}
#define ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(_type, _name, _required) \
- if (esxVI_##_type##_SerializeList(conn, item->_name, #_name, output, \
+ if (esxVI_##_type##_SerializeList(item->_name, #_name, output, \
esxVI_Boolean_##_required) < 0) { \
return -1; \
}
#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(_type, _name) \
if (xmlStrEqual(childNode->name, BAD_CAST #_name)) { \
- if (esxVI_##_type##_Deserialize(conn, childNode, \
- &(*ptrptr)->_name) < 0) { \
+ if (esxVI_##_type##_Deserialize(childNode, &(*ptrptr)->_name) < 0) { \
goto failure; \
} \
\
#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(_type, _name) \
if (xmlStrEqual(childNode->name, BAD_CAST #_name)) { \
- if (esxVI_##_type##_DeserializeValue(conn, childNode, \
+ if (esxVI_##_type##_DeserializeValue(childNode, \
&(*ptrptr)->_name) < 0) { \
goto failure; \
} \
#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(_type, _expected, \
_name) \
if (xmlStrEqual(childNode->name, BAD_CAST #_name)) { \
- if (esxVI_##_type##_Deserialize(conn, childNode, &(*ptrptr)->_name, \
+ if (esxVI_##_type##_Deserialize(childNode, &(*ptrptr)->_name, \
_expected) < 0) { \
goto failure; \
} \
if (xmlStrEqual(childNode->name, BAD_CAST #_name)) { \
esxVI_##_type *_name##Item = NULL; \
\
- if (esxVI_##_type##_Deserialize(conn, childNode, &_name##Item) < 0) { \
+ if (esxVI_##_type##_Deserialize(childNode, &_name##Item) < 0) { \
goto failure; \
} \
\
- if (esxVI_##_type##_AppendToList(conn, &(*ptrptr)->_name, \
+ if (esxVI_##_type##_AppendToList(&(*ptrptr)->_name, \
_name##Item) < 0) { \
esxVI_##_type##_Free(&_name##Item); \
goto failure; \
*/
#define ESX_VI__TEMPLATE__PROPERTY__REQUIRED(_name) \
if ((*ptrptr)->_name == 0) { \
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
"Missing required '%s' property", #_name); \
goto failure; \
}
#define ESX_VI__TEMPLATE__ENUMERATION__CAST_FROM_ANY_TYPE(_type) \
int \
- esxVI_##_type##_CastFromAnyType(virConnectPtr conn, \
- esxVI_AnyType *anyType, \
+ esxVI_##_type##_CastFromAnyType(esxVI_AnyType *anyType, \
esxVI_##_type *value) \
{ \
return esxVI_Enumeration_CastFromAnyType \
- (conn, &_esxVI_##_type##_Enumeration, anyType, \
- (int *)value); \
+ (&_esxVI_##_type##_Enumeration, anyType, (int *)value); \
}
#define ESX_VI__TEMPLATE__ENUMERATION__SERIALIZE(_type) \
int \
- esxVI_##_type##_Serialize(virConnectPtr conn, esxVI_##_type value, \
- const char *element, virBufferPtr output, \
- esxVI_Boolean required) \
+ esxVI_##_type##_Serialize(esxVI_##_type value, const char *element, \
+ virBufferPtr output, esxVI_Boolean required) \
{ \
- return esxVI_Enumeration_Serialize(conn, \
- &_esxVI_##_type##_Enumeration, \
- value, element, output, \
- required); \
+ return esxVI_Enumeration_Serialize(&_esxVI_##_type##_Enumeration, \
+ value, element, output, required); \
}
#define ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(_type) \
int \
- esxVI_##_type##_Deserialize(virConnectPtr conn, xmlNodePtr node, \
- esxVI_##_type *value) \
+ esxVI_##_type##_Deserialize(xmlNodePtr node, esxVI_##_type *value) \
{ \
- return esxVI_Enumeration_Deserialize(conn, \
- &_esxVI_##_type##_Enumeration, \
+ return esxVI_Enumeration_Deserialize(&_esxVI_##_type##_Enumeration, \
node, (int *)value); \
}
});
int
-esxVI_AnyType_ExpectType(virConnectPtr conn, esxVI_AnyType *anyType,
- esxVI_Type type)
+esxVI_AnyType_ExpectType(esxVI_AnyType *anyType, esxVI_Type type)
{
if (anyType->type != type) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting type '%s' but found '%s'",
esxVI_Type_Name(type),
anyType->type != esxVI_Type_Other
}
int
-esxVI_AnyType_DeepCopy(virConnectPtr conn, esxVI_AnyType **dest,
- esxVI_AnyType *src)
+esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
{
if (dest == NULL || *dest != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
return 0;
}
- if (esxVI_AnyType_Alloc(conn, dest) < 0) {
+ if (esxVI_AnyType_Alloc(dest) < 0) {
goto failure;
}
(*dest)->_node = xmlCopyNode(src->_node, 1);
if ((*dest)->_node == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
- "Could not copy an XML node");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not copy an XML node");
goto failure;
}
(*dest)->type = src->type;
- if (esxVI_String_DeepCopyValue(conn, &(*dest)->other, src->other) < 0 ||
- esxVI_String_DeepCopyValue(conn, &(*dest)->value, src->value) < 0) {
+ if (esxVI_String_DeepCopyValue(&(*dest)->other, src->other) < 0 ||
+ esxVI_String_DeepCopyValue(&(*dest)->value, src->value) < 0) {
goto failure;
}
}
int
-esxVI_AnyType_Deserialize(virConnectPtr conn, xmlNodePtr node,
- esxVI_AnyType **anyType)
+esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
{
long long number;
if (anyType == NULL || *anyType != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
- if (esxVI_AnyType_Alloc(conn, anyType) < 0) {
+ if (esxVI_AnyType_Alloc(anyType) < 0) {
return -1;
}
(*anyType)->_node = xmlCopyNode(node, 1);
if ((*anyType)->_node == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
- "Could not copy an XML node");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not copy an XML node");
goto failure;
}
BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");
if ((*anyType)->other == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"AnyType is missing 'type' property");
goto failure;
}
(*anyType)->value = strdup("");
if ((*anyType)->value == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
}
#define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max) \
do { \
if (virStrToLong_ll((*anyType)->value, NULL, 10, &number) < 0) { \
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
"Unknown value '%s' for "_xsdType, \
(*anyType)->value); \
goto failure; \
} \
\
if (number < (_min) || number > (_max)) { \
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
"Value '%s' is out of "_xsdType" range", \
(*anyType)->value); \
goto failure; \
} else if (STREQ((*anyType)->value, "false")) {
(*anyType)->boolean = esxVI_Boolean_False;
} else {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unknown value '%s' for xsd:boolean",
(*anyType)->value);
goto failure;
ESX_VI__TEMPLATE__LIST__APPEND(String);
int
-esxVI_String_AppendValueToList(virConnectPtr conn,
- esxVI_String **stringList, const char *value)
+esxVI_String_AppendValueToList(esxVI_String **stringList, const char *value)
{
esxVI_String *string = NULL;
- if (esxVI_String_Alloc(conn, &string) < 0) {
+ if (esxVI_String_Alloc(&string) < 0) {
goto failure;
}
string->value = strdup(value);
if (string->value == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
- if (esxVI_String_AppendToList(conn, stringList, string) < 0) {
+ if (esxVI_String_AppendToList(stringList, string) < 0) {
goto failure;
}
}
int
-esxVI_String_AppendValueListToList(virConnectPtr conn,
- esxVI_String **stringList,
+esxVI_String_AppendValueListToList(esxVI_String **stringList,
const char *valueList)
{
esxVI_String *stringListToAppend = NULL;
const char *value = valueList;
while (value != NULL && *value != '\0') {
- if (esxVI_String_AppendValueToList(conn, &stringListToAppend,
- value) < 0) {
+ if (esxVI_String_AppendValueToList(&stringListToAppend, value) < 0) {
goto failure;
}
value += strlen(value) + 1;
}
- if (esxVI_String_AppendToList(conn, stringList, stringListToAppend) < 0) {
+ if (esxVI_String_AppendToList(stringList, stringListToAppend) < 0) {
goto failure;
}
}
int
-esxVI_String_DeepCopy(virConnectPtr conn, esxVI_String **dest,
- esxVI_String *src)
+esxVI_String_DeepCopy(esxVI_String **dest, esxVI_String *src)
{
if (dest == NULL || *dest != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
return 0;
}
- if (esxVI_String_Alloc(conn, dest) < 0 ||
- esxVI_String_DeepCopyValue(conn, &(*dest)->value, src->value)) {
+ if (esxVI_String_Alloc(dest) < 0 ||
+ esxVI_String_DeepCopyValue(&(*dest)->value, src->value)) {
goto failure;
}
ESX_VI__TEMPLATE__LIST__DEEP_COPY(String);
int
-esxVI_String_DeepCopyValue(virConnectPtr conn, char **dest, const char *src)
+esxVI_String_DeepCopyValue(char **dest, const char *src)
{
if (dest == NULL || *dest != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
*dest = strdup(src);
if (*dest == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
return -1;
}
}
int
-esxVI_String_Serialize(virConnectPtr conn, esxVI_String *string,
- const char *element, virBufferPtr output,
- esxVI_Boolean required)
+esxVI_String_Serialize(esxVI_String *string, const char *element,
+ virBufferPtr output, esxVI_Boolean required)
{
- return esxVI_String_SerializeValue(conn,
- string != NULL ? string->value : NULL,
+ return esxVI_String_SerializeValue(string != NULL ? string->value : NULL,
element, output, required);
}
ESX_VI__TEMPLATE__LIST__SERIALIZE(String);
int
-esxVI_String_SerializeValue(virConnectPtr conn, const char *value,
- const char *element, virBufferPtr output,
- esxVI_Boolean required)
+esxVI_String_SerializeValue(const char *value, const char *element,
+ virBufferPtr output, esxVI_Boolean required)
{
if (element == NULL || output == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
if (value == NULL) {
- return esxVI_CheckSerializationNecessity(conn, element, required);
+ return esxVI_CheckSerializationNecessity(element, required);
}
ESV_VI__XML_TAG__OPEN(output, element, "xsd:string");
}
int
-esxVI_String_Deserialize(virConnectPtr conn, xmlNodePtr node,
- esxVI_String **string)
+esxVI_String_Deserialize(xmlNodePtr node, esxVI_String **string)
{
if (string == NULL || *string != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
- if (esxVI_String_Alloc(conn, string) < 0) {
+ if (esxVI_String_Alloc(string) < 0) {
return -1;
}
(*string)->value = strdup("");
if ((*string)->value == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
}
ESX_VI__TEMPLATE__LIST__DESERIALIZE(String);
int
-esxVI_String_DeserializeValue(virConnectPtr conn, xmlNodePtr node,
- char **value)
+esxVI_String_DeserializeValue(xmlNodePtr node, char **value)
{
if (value == NULL || *value != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
*value = strdup("");
if (*value == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
return -1;
}
}
ESX_VI__TEMPLATE__LIST__APPEND(Int);
int
-esxVI_Int_DeepCopy(virConnectPtr conn, esxVI_Int **dest, esxVI_Int *src)
+esxVI_Int_DeepCopy(esxVI_Int **dest, esxVI_Int *src)
{
if (dest == NULL || *dest != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
return 0;
}
- if (esxVI_Int_Alloc(conn, dest) < 0) {
+ if (esxVI_Int_Alloc(dest) < 0) {
goto failure;
}
});
int
-esxVI_DateTime_Deserialize(virConnectPtr conn, xmlNodePtr node,
- esxVI_DateTime **dateTime)
+esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime)
{
if (dateTime == NULL || *dateTime != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
- if (esxVI_DateTime_Alloc(conn, dateTime) < 0) {
+ if (esxVI_DateTime_Alloc(dateTime) < 0) {
return -1;
}
(char *)xmlNodeListGetString(node->doc, node->children, 1);
if ((*dateTime)->value == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"XML node doesn't contain text, expecting an "
"xsd:dateTime value");
goto failure;
});
int
-esxVI_ManagedObjectReference_DeepCopy(virConnectPtr conn,
- esxVI_ManagedObjectReference **dest,
+esxVI_ManagedObjectReference_DeepCopy(esxVI_ManagedObjectReference **dest,
esxVI_ManagedObjectReference *src)
{
if (dest == NULL || *dest != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
return 0;
}
- if (esxVI_ManagedObjectReference_Alloc(conn, dest) < 0 ||
- esxVI_String_DeepCopyValue(conn, &(*dest)->type, src->type) < 0 ||
- esxVI_String_DeepCopyValue(conn, &(*dest)->value, src->value) < 0) {
+ if (esxVI_ManagedObjectReference_Alloc(dest) < 0 ||
+ esxVI_String_DeepCopyValue(&(*dest)->type, src->type) < 0 ||
+ esxVI_String_DeepCopyValue(&(*dest)->value, src->value) < 0) {
goto failure;
}
int
esxVI_ManagedObjectReference_CastFromAnyType
- (virConnectPtr conn, esxVI_AnyType *anyType,
+ (esxVI_AnyType *anyType,
esxVI_ManagedObjectReference **managedObjectReference,
const char *expectedType)
{
if (anyType == NULL || managedObjectReference == NULL ||
*managedObjectReference != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
if (STRNEQ(anyType->other, "ManagedObjectReference")) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting type 'ManagedObjectReference' but found '%s'",
anyType->other);
return -1;
}
- return esxVI_ManagedObjectReference_Deserialize(conn, anyType->_node,
+ return esxVI_ManagedObjectReference_Deserialize(anyType->_node,
managedObjectReference,
expectedType);
}
int
esxVI_ManagedObjectReference_CastListFromAnyType
- (virConnectPtr conn, esxVI_AnyType *anyType,
+ (esxVI_AnyType *anyType,
esxVI_ManagedObjectReference **managedObjectReferenceList,
const char *expectedType)
{
if (managedObjectReferenceList == NULL ||
*managedObjectReferenceList != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
goto failure;
}
}
if (STRNEQ(anyType->other, "ArrayOfManagedObjectReference")) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting type to be 'ArrayOfManagedObjectReference' "
"but found '%s'", anyType->other);
goto failure;
for (childNode = anyType->_node->children; childNode != NULL;
childNode = childNode->next) {
if (childNode->type != XML_ELEMENT_NODE) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Wrong XML element type %d", childNode->type);
goto failure;
}
esxVI_AnyType_Free(&childAnyType);
- if (esxVI_AnyType_Deserialize(conn, childNode, &childAnyType) < 0) {
+ if (esxVI_AnyType_Deserialize(childNode, &childAnyType) < 0) {
goto failure;
}
managedObjectReference = NULL;
if (esxVI_ManagedObjectReference_CastFromAnyType
- (conn, childAnyType, &managedObjectReference,
- expectedType) < 0) {
+ (childAnyType, &managedObjectReference, expectedType) < 0) {
goto failure;
}
if (esxVI_ManagedObjectReference_AppendToList
- (conn, managedObjectReferenceList, managedObjectReference) < 0) {
+ (managedObjectReferenceList, managedObjectReference) < 0) {
goto failure;
}
}
int
esxVI_ManagedObjectReference_Serialize
- (virConnectPtr conn, esxVI_ManagedObjectReference *managedObjectReference,
+ (esxVI_ManagedObjectReference *managedObjectReference,
const char *element, virBufferPtr output, esxVI_Boolean required)
{
if (element == NULL || output == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
if (managedObjectReference == NULL) {
- return esxVI_CheckSerializationNecessity(conn, element, required);
+ return esxVI_CheckSerializationNecessity(element, required);
}
virBufferAddLit(output, "<");
int
esxVI_ManagedObjectReference_Deserialize
- (virConnectPtr conn, xmlNodePtr node,
- esxVI_ManagedObjectReference **managedObjectReference,
+ (xmlNodePtr node, esxVI_ManagedObjectReference **managedObjectReference,
const char *expectedType)
{
if (managedObjectReference == NULL || *managedObjectReference != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
- if (esxVI_ManagedObjectReference_Alloc(conn, managedObjectReference) < 0) {
+ if (esxVI_ManagedObjectReference_Alloc(managedObjectReference) < 0) {
return -1;
}
(char *)xmlGetNoNsProp(node, BAD_CAST "type");
if ((*managedObjectReference)->type == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"ManagedObjectReference is missing 'type' property");
goto failure;
}
if (expectedType != NULL &&
STRNEQ(expectedType, (*managedObjectReference)->type)) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expected type '%s' but found '%s'", expectedType,
(*managedObjectReference)->type);
goto failure;
}
- if (esxVI_String_DeserializeValue(conn, node,
+ if (esxVI_String_DeserializeValue(node,
&(*managedObjectReference)->value) < 0) {
goto failure;
}
});
int
-esxVI_DynamicProperty_DeepCopy(virConnectPtr conn,
- esxVI_DynamicProperty **dest,
+esxVI_DynamicProperty_DeepCopy(esxVI_DynamicProperty **dest,
esxVI_DynamicProperty *src)
{
if (dest == NULL || *dest != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
return 0;
}
- if (esxVI_DynamicProperty_Alloc(conn, dest) < 0 ||
- esxVI_String_DeepCopyValue(conn, &(*dest)->name, src->name) < 0 ||
- esxVI_AnyType_DeepCopy(conn, &(*dest)->val, src->val) < 0) {
+ if (esxVI_DynamicProperty_Alloc(dest) < 0 ||
+ esxVI_String_DeepCopyValue(&(*dest)->name, src->name) < 0 ||
+ esxVI_AnyType_DeepCopy(&(*dest)->val, src->val) < 0) {
goto failure;
}
ESX_VI__TEMPLATE__LIST__APPEND(SelectionSpec);
int
-esxVI_SelectionSpec_Serialize(virConnectPtr conn,
- esxVI_SelectionSpec *selectionSpec,
+esxVI_SelectionSpec_Serialize(esxVI_SelectionSpec *selectionSpec,
const char *element, virBufferPtr output,
esxVI_Boolean required)
{
if (element == NULL || output == NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
if (selectionSpec == NULL) {
- return esxVI_CheckSerializationNecessity(conn, element, required);
+ return esxVI_CheckSerializationNecessity(element, required);
}
if (selectionSpec->_super != NULL) {
- return esxVI_TraversalSpec_Serialize(conn, selectionSpec->_super,
- element, output, required);
+ return esxVI_TraversalSpec_Serialize(selectionSpec->_super, element,
+ output, required);
}
ESV_VI__XML_TAG__OPEN(output, element, "SelectionSpec");
- if (esxVI_String_SerializeValue(conn, selectionSpec->name, "name", output,
+ if (esxVI_String_SerializeValue(selectionSpec->name, "name", output,
esxVI_Boolean_False) < 0) {
return -1;
}
*/
int
-esxVI_TraversalSpec_Alloc(virConnectPtr conn,
- esxVI_TraversalSpec **traversalSpec)
+esxVI_TraversalSpec_Alloc(esxVI_TraversalSpec **traversalSpec)
{
- if (esxVI_Alloc(conn, (void **)traversalSpec,
- sizeof(esxVI_TraversalSpec)) < 0) {
+ if (esxVI_Alloc((void **)traversalSpec, sizeof(esxVI_TraversalSpec)) < 0) {
return -1;
}
- if (esxVI_SelectionSpec_Alloc(conn, &(*traversalSpec)->_base) < 0) {
+ if (esxVI_SelectionSpec_Alloc(&(*traversalSpec)->_base) < 0) {
esxVI_TraversalSpec_Free(traversalSpec);
return -1;
}
/* esxVI_TraversalSpec_Serialize */
ESX_VI__TEMPLATE__SERIALIZE(TraversalSpec,
{
- if (esxVI_String_SerializeValue(conn, item->_base->name, "name", output,
+ if (esxVI_String_SerializeValue(item->_base->name, "name", output,
esxVI_Boolean_False) < 0) {
return -1;
}
ESX_VI__TEMPLATE__LIST__APPEND(ObjectContent);
int
-esxVI_ObjectContent_DeepCopy(virConnectPtr conn,
- esxVI_ObjectContent **dest,
+esxVI_ObjectContent_DeepCopy(esxVI_ObjectContent **dest,
esxVI_ObjectContent *src)
{
if (dest == NULL || *dest != NULL) {
- ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
return 0;
}
- if (esxVI_ObjectContent_Alloc(conn, dest) < 0 ||
- esxVI_ManagedObjectReference_DeepCopy(conn, &(*dest)->obj,
- src->obj) < 0 ||
- esxVI_DynamicProperty_DeepCopyList(conn, &(*dest)->propSet,
+ if (esxVI_ObjectContent_Alloc(dest) < 0 ||
+ esxVI_ManagedObjectReference_DeepCopy(&(*dest)->obj, src->obj) < 0 ||
+ esxVI_DynamicProperty_DeepCopyList(&(*dest)->propSet,
src->propSet) < 0) {
goto failure;
}
esxVI_Boolean_False,
};
-int esxVI_Boolean_Serialize(virConnectPtr conn, esxVI_Boolean boolean_,
- const char *element, virBufferPtr output,
- esxVI_Boolean required);
-int esxVI_Boolean_Deserialize(virConnectPtr conn, xmlNodePtr node,
- esxVI_Boolean *boolean_);
+int esxVI_Boolean_Serialize(esxVI_Boolean boolean_, const char *element,
+ virBufferPtr output, esxVI_Boolean required);
+int esxVI_Boolean_Deserialize(xmlNodePtr node, esxVI_Boolean *boolean_);
};
};
-int esxVI_AnyType_Alloc(virConnectPtr conn, esxVI_AnyType **anyType);
+int esxVI_AnyType_Alloc(esxVI_AnyType **anyType);
void esxVI_AnyType_Free(esxVI_AnyType **anyType);
-int esxVI_AnyType_ExpectType(virConnectPtr conn, esxVI_AnyType *anyType,
- esxVI_Type type);
-int esxVI_AnyType_DeepCopy(virConnectPtr conn, esxVI_AnyType **dest,
- esxVI_AnyType *src);
-int esxVI_AnyType_Deserialize(virConnectPtr conn, xmlNodePtr node,
- esxVI_AnyType **anyType);
+int esxVI_AnyType_ExpectType(esxVI_AnyType *anyType, esxVI_Type type);
+int esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src);
+int esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType);
char *value; /* required */
};
-int esxVI_String_Alloc(virConnectPtr conn, esxVI_String **string);
+int esxVI_String_Alloc(esxVI_String **string);
void esxVI_String_Free(esxVI_String **stringList);
-int esxVI_String_AppendToList(virConnectPtr conn, esxVI_String **stringList,
- esxVI_String *string);
-int esxVI_String_AppendValueToList(virConnectPtr conn,
- esxVI_String **stringList,
+int esxVI_String_AppendToList(esxVI_String **stringList, esxVI_String *string);
+int esxVI_String_AppendValueToList(esxVI_String **stringList,
const char *value);
-int esxVI_String_AppendValueListToList(virConnectPtr conn,
- esxVI_String **stringList,
+int esxVI_String_AppendValueListToList(esxVI_String **stringList,
const char *valueList);
-int esxVI_String_DeepCopy(virConnectPtr conn, esxVI_String **dest,
- esxVI_String *src);
-int esxVI_String_DeepCopyList(virConnectPtr conn, esxVI_String **destList,
- esxVI_String *srcList);
-int esxVI_String_DeepCopyValue(virConnectPtr conn, char **dest,
- const char *src);
-int esxVI_String_Serialize(virConnectPtr conn, esxVI_String *string,
- const char *element, virBufferPtr output,
- esxVI_Boolean required);
-int esxVI_String_SerializeList(virConnectPtr conn, esxVI_String *stringList,
- const char *element, virBufferPtr output,
- esxVI_Boolean required);
-int esxVI_String_SerializeValue(virConnectPtr conn, const char *value,
- const char *element, virBufferPtr output,
- esxVI_Boolean required);
-int esxVI_String_Deserialize(virConnectPtr conn, xmlNodePtr node,
- esxVI_String **string);
-int esxVI_String_DeserializeList(virConnectPtr conn, xmlNodePtr node,
- esxVI_String **stringList);
-int esxVI_String_DeserializeValue(virConnectPtr conn, xmlNodePtr node,
- char **value);
+int esxVI_String_DeepCopy(esxVI_String **dest, esxVI_String *src);
+int esxVI_String_DeepCopyList(esxVI_String **destList, esxVI_String *srcList);
+int esxVI_String_DeepCopyValue(char **dest, const char *src);
+int esxVI_String_Serialize(esxVI_String *string, const char *element,
+ virBufferPtr output, esxVI_Boolean required);
+int esxVI_String_SerializeList(esxVI_String *stringList, const char *element,
+ virBufferPtr output, esxVI_Boolean required);
+int esxVI_String_SerializeValue(const char *value, const char *element,
+ virBufferPtr output, esxVI_Boolean required);
+int esxVI_String_Deserialize(xmlNodePtr node, esxVI_String **string);
+int esxVI_String_DeserializeList(xmlNodePtr node, esxVI_String **stringList);
+int esxVI_String_DeserializeValue(xmlNodePtr node, char **value);
int32_t value; /* required */
};
-int esxVI_Int_Alloc(virConnectPtr conn, esxVI_Int **number);
+int esxVI_Int_Alloc(esxVI_Int **number);
void esxVI_Int_Free(esxVI_Int **numberList);
-int esxVI_Int_AppendToList(virConnectPtr conn, esxVI_Int **numberList,
- esxVI_Int *number);
-int esxVI_Int_DeepCopy(virConnectPtr conn, esxVI_Int **dest, esxVI_Int *src);
-int esxVI_Int_Serialize(virConnectPtr conn, esxVI_Int *number,
- const char *element, virBufferPtr output,
- esxVI_Boolean required);
-int esxVI_Int_SerializeList(virConnectPtr conn, esxVI_Int *numberList,
- const char *element, virBufferPtr output,
- esxVI_Boolean required);
-int esxVI_Int_Deserialize(virConnectPtr conn, xmlNodePtr node,
- esxVI_Int **number);
+int esxVI_Int_AppendToList(esxVI_Int **numberList, esxVI_Int *number);
+int esxVI_Int_DeepCopy(esxVI_Int **dest, esxVI_Int *src);
+int esxVI_Int_Serialize(esxVI_Int *number, const char *element,
+ virBufferPtr output, esxVI_Boolean required);
+int esxVI_Int_SerializeList(esxVI_Int *numberList, const char *element,
+ virBufferPtr output, esxVI_Boolean required);
+int esxVI_Int_Deserialize(xmlNodePtr node, esxVI_Int **number);
int64_t value; /* required */
};
-int esxVI_Long_Alloc(virConnectPtr conn, esxVI_Long **number);
+int esxVI_Long_Alloc(esxVI_Long **number);
void esxVI_Long_Free(esxVI_Long **numberList);
-int esxVI_Long_AppendToList(virConnectPtr conn, esxVI_Long **numberList,
- esxVI_Long *number);
-int esxVI_Long_Serialize(virConnectPtr conn, esxVI_Long *number,
- const char *element, virBufferPtr output,
- esxVI_Boolean required);
-int esxVI_Long_SerializeList(virConnectPtr conn, esxVI_Long *numberList,
- const char *element, virBufferPtr output,
- esxVI_Boolean required);
-int esxVI_Long_Deserialize(virConnectPtr conn, xmlNodePtr node,
- esxVI_Long **number);
+int esxVI_Long_AppendToList(esxVI_Long **numberList, esxVI_Long *number);
+int esxVI_Long_Serialize(esxVI_Long *number, const char *element,
+ virBufferPtr output, esxVI_Boolean required);
+int esxVI_Long_SerializeList(esxVI_Long *numberList, const char *element,
+ virBufferPtr output,esxVI_Boolean required);
+int esxVI_Long_Deserialize(xmlNodePtr node, esxVI_Long **number);
char *value; /* required */
};
-int esxVI_DateTime_Alloc(virConnectPtr conn, esxVI_DateTime **dateTime);
+int esxVI_DateTime_Alloc(esxVI_DateTime **dateTime);
void esxVI_DateTime_Free(esxVI_DateTime **dateTime);
-int esxVI_DateTime_Serialize(virConnectPtr conn, esxVI_DateTime *dateTime,
- const char *element, virBufferPtr output,
- esxVI_Boolean required);
-int esxVI_DateTime_Deserialize(virConnectPtr conn, xmlNodePtr node,
- esxVI_DateTime **dateTime);
+int esxVI_DateTime_Serialize(esxVI_DateTime *dateTime, const char *element,
+ virBufferPtr output, esxVI_Boolean required);
+int esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime);
};
int esxVI_ManagedEntityStatus_CastFromAnyType
- (virConnectPtr conn, esxVI_AnyType *anyType,
- esxVI_ManagedEntityStatus *managedEntityStatus);
+ (esxVI_AnyType *anyType, esxVI_ManagedEntityStatus *managedEntityStatus);
};
int esxVI_ObjectUpdateKind_Deserialize
- (virConnectPtr conn, xmlNodePtr node,
- esxVI_ObjectUpdateKind *objectUpdateKind);
+ (xmlNodePtr node, esxVI_ObjectUpdateKind *objectUpdateKind);
esxVI_PerfSummaryType_Summation,
};
-int esxVI_PerfSummaryType_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_PerfSummaryType_Deserialize(xmlNodePtr node,
esxVI_PerfSummaryType *perfSummaryType);
esxVI_PerfStatsType_Rate,
};
-int esxVI_PerfStatsType_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_PerfStatsType_Deserialize(xmlNodePtr node,
esxVI_PerfStatsType *perfStatsType);
};
int esxVI_PropertyChangeOp_Deserialize
- (virConnectPtr conn, xmlNodePtr node,
- esxVI_PropertyChangeOp *propertyChangeOp);
+ (xmlNodePtr node, esxVI_PropertyChangeOp *propertyChangeOp);
esxVI_SharesLevel_Normal,
};
-int esxVI_SharesLevel_Serialize(virConnectPtr conn,
- esxVI_SharesLevel sharesLevel,
+int esxVI_SharesLevel_Serialize(esxVI_SharesLevel sharesLevel,
const char *element, virBufferPtr output,
esxVI_Boolean required);
-int esxVI_SharesLevel_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_SharesLevel_Deserialize(xmlNodePtr node,
esxVI_SharesLevel *sharesLevel);
esxVI_TaskInfoState_Success,
};
-int esxVI_TaskInfoState_CastFromAnyType(virConnectPtr conn,
- esxVI_AnyType *anyType,
+int esxVI_TaskInfoState_CastFromAnyType(esxVI_AnyType *anyType,
esxVI_TaskInfoState *taskInfoState);
-int esxVI_TaskInfoState_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_TaskInfoState_Deserialize(xmlNodePtr node,
esxVI_TaskInfoState *taskInfoState);
};
int esxVI_VirtualMachineMovePriority_Serialize
- (virConnectPtr conn,
- esxVI_VirtualMachineMovePriority virtualMachineMovePriority,
+ (esxVI_VirtualMachineMovePriority virtualMachineMovePriority,
const char *element, virBufferPtr output, esxVI_Boolean required);
};
int esxVI_VirtualMachinePowerState_CastFromAnyType
- (virConnectPtr conn, esxVI_AnyType *anyType,
+ (esxVI_AnyType *anyType,
esxVI_VirtualMachinePowerState *virtualMachinePowerState);
int esxVI_VirtualMachinePowerState_Serialize
- (virConnectPtr conn,
- esxVI_VirtualMachinePowerState virtualMachinePowerState,
+ (esxVI_VirtualMachinePowerState virtualMachinePowerState,
const char *element, virBufferPtr output, esxVI_Boolean required);
char *faultstring; /* required */
};
-int esxVI_Fault_Alloc(virConnectPtr conn, esxVI_Fault **fault);
+int esxVI_Fault_Alloc(esxVI_Fault **fault);
void esxVI_Fault_Free(esxVI_Fault **fault);
-int esxVI_Fault_Deserialize(virConnectPtr conn, xmlNodePtr node,
- esxVI_Fault **fault);
+int esxVI_Fault_Deserialize(xmlNodePtr node, esxVI_Fault **fault);
};
int esxVI_ManagedObjectReference_Alloc
- (virConnectPtr conn,
- esxVI_ManagedObjectReference **managedObjectReference);
+ (esxVI_ManagedObjectReference **managedObjectReference);
void esxVI_ManagedObjectReference_Free
(esxVI_ManagedObjectReference **managedObjectReferenceList);
-int esxVI_ManagedObjectReference_DeepCopy(virConnectPtr conn,
- esxVI_ManagedObjectReference **dest,
+int esxVI_ManagedObjectReference_DeepCopy(esxVI_ManagedObjectReference **dest,
esxVI_ManagedObjectReference *src);
int esxVI_ManagedObjectReference_AppendToList
- (virConnectPtr conn,
- esxVI_ManagedObjectReference **managedObjectReferenceList,
+ (esxVI_ManagedObjectReference **managedObjectReferenceList,
esxVI_ManagedObjectReference *managedObjectReference);
-int esxVI_ManagedObjectReference_CastFromAnyType(virConnectPtr conn,
- esxVI_AnyType *anyType,
+int esxVI_ManagedObjectReference_CastFromAnyType(esxVI_AnyType *anyType,
esxVI_ManagedObjectReference
**managedObjectReference,
const char *expectedType);
int esxVI_ManagedObjectReference_CastListFromAnyType
- (virConnectPtr conn, esxVI_AnyType *anyType,
+ (esxVI_AnyType *anyType,
esxVI_ManagedObjectReference **managedObjectReferenceList,
const char *expectedType);
int esxVI_ManagedObjectReference_Serialize
- (virConnectPtr conn,
- esxVI_ManagedObjectReference *managedObjectReference,
+ (esxVI_ManagedObjectReference *managedObjectReference,
const char *element, virBufferPtr output, esxVI_Boolean required);
int esxVI_ManagedObjectReference_SerializeList
- (virConnectPtr conn,
- esxVI_ManagedObjectReference *managedObjectReference,
+ (esxVI_ManagedObjectReference *managedObjectReference,
const char *element, virBufferPtr output, esxVI_Boolean required);
int esxVI_ManagedObjectReference_Deserialize
- (virConnectPtr conn, xmlNodePtr node,
- esxVI_ManagedObjectReference **managedObjectReference,
+ (xmlNodePtr node, esxVI_ManagedObjectReference **managedObjectReference,
const char *expectedType);
esxVI_AnyType *val; /* required */
};
-int esxVI_DynamicProperty_Alloc(virConnectPtr conn,
- esxVI_DynamicProperty **dynamicProperty);
+int esxVI_DynamicProperty_Alloc(esxVI_DynamicProperty **dynamicProperty);
void esxVI_DynamicProperty_Free
(esxVI_DynamicProperty **dynamicPropertyList);
-int esxVI_DynamicProperty_DeepCopy(virConnectPtr conn,
- esxVI_DynamicProperty **dest,
+int esxVI_DynamicProperty_DeepCopy(esxVI_DynamicProperty **dest,
esxVI_DynamicProperty *src);
-int esxVI_DynamicProperty_DeepCopyList(virConnectPtr conn,
- esxVI_DynamicProperty **destList,
+int esxVI_DynamicProperty_DeepCopyList(esxVI_DynamicProperty **destList,
esxVI_DynamicProperty *srcList);
int esxVI_DynamicProperty_AppendToList
- (virConnectPtr conn, esxVI_DynamicProperty **dynamicPropertyList,
+ (esxVI_DynamicProperty **dynamicPropertyList,
esxVI_DynamicProperty *dynamicProperty);
-int esxVI_DynamicProperty_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_DynamicProperty_Deserialize(xmlNodePtr node,
esxVI_DynamicProperty **dynamicProperty);
int esxVI_DynamicProperty_DeserializeList
- (virConnectPtr conn, xmlNodePtr node,
- esxVI_DynamicProperty **dynamicPropertyList);
+ (xmlNodePtr node, esxVI_DynamicProperty **dynamicPropertyList);
char *edx; /* optional */
};
-int esxVI_HostCpuIdInfo_Alloc(virConnectPtr conn,
- esxVI_HostCpuIdInfo **hostCpuIdInfo);
+int esxVI_HostCpuIdInfo_Alloc(esxVI_HostCpuIdInfo **hostCpuIdInfo);
void esxVI_HostCpuIdInfo_Free(esxVI_HostCpuIdInfo **hostCpuIdInfoList);
-int esxVI_HostCpuIdInfo_CastFromAnyType(virConnectPtr conn,
- esxVI_AnyType *anyType,
+int esxVI_HostCpuIdInfo_CastFromAnyType(esxVI_AnyType *anyType,
esxVI_HostCpuIdInfo **hostCpuIdInfo);
int esxVI_HostCpuIdInfo_CastListFromAnyType
- (virConnectPtr conn, esxVI_AnyType *anyType,
- esxVI_HostCpuIdInfo **hostCpuIdInfoList);
-int esxVI_HostCpuIdInfo_Deserialize(virConnectPtr conn, xmlNodePtr node,
+ (esxVI_AnyType *anyType, esxVI_HostCpuIdInfo **hostCpuIdInfoList);
+int esxVI_HostCpuIdInfo_Deserialize(xmlNodePtr node,
esxVI_HostCpuIdInfo **hostCpuIdInfo);
int esxVI_HostCpuIdInfo_DeserializeList
- (virConnectPtr conn, xmlNodePtr node,
- esxVI_HostCpuIdInfo **hostCpuIdInfoList);
+ (xmlNodePtr node, esxVI_HostCpuIdInfo **hostCpuIdInfoList);
char *name; /* optional */
};
-int esxVI_SelectionSpec_Alloc(virConnectPtr conn,
- esxVI_SelectionSpec **selectionSpec);
+int esxVI_SelectionSpec_Alloc(esxVI_SelectionSpec **selectionSpec);
void esxVI_SelectionSpec_Free(esxVI_SelectionSpec **selectionSpecList);
-int esxVI_SelectionSpec_AppendToList(virConnectPtr conn,
- esxVI_SelectionSpec **selectionSpecList,
+int esxVI_SelectionSpec_AppendToList(esxVI_SelectionSpec **selectionSpecList,
esxVI_SelectionSpec *selectionSpec);
-int esxVI_SelectionSpec_Serialize(virConnectPtr conn,
- esxVI_SelectionSpec *selectionSpec,
+int esxVI_SelectionSpec_Serialize(esxVI_SelectionSpec *selectionSpec,
const char *element, virBufferPtr output,
esxVI_Boolean required);
-int esxVI_SelectionSpec_SerializeList(virConnectPtr conn,
- esxVI_SelectionSpec *selectionSpecList,
+int esxVI_SelectionSpec_SerializeList(esxVI_SelectionSpec *selectionSpecList,
const char *element, virBufferPtr output,
esxVI_Boolean required);
esxVI_SelectionSpec *selectSet; /* optional, list */
};
-int esxVI_TraversalSpec_Alloc(virConnectPtr conn,
- esxVI_TraversalSpec **traversalSpec);
+int esxVI_TraversalSpec_Alloc(esxVI_TraversalSpec **traversalSpec);
void esxVI_TraversalSpec_Free(esxVI_TraversalSpec **traversalSpec);
-int esxVI_TraversalSpec_Serialize(virConnectPtr conn,
- esxVI_TraversalSpec *traversalSpec,
+int esxVI_TraversalSpec_Serialize(esxVI_TraversalSpec *traversalSpec,
const char *element, virBufferPtr output,
esxVI_Boolean required);
esxVI_SelectionSpec *selectSet; /* optional, list */
};
-int esxVI_ObjectSpec_Alloc(virConnectPtr conn, esxVI_ObjectSpec **objectSpec);
+int esxVI_ObjectSpec_Alloc(esxVI_ObjectSpec **objectSpec);
void esxVI_ObjectSpec_Free(esxVI_ObjectSpec **objectSpecList);
-int esxVI_ObjectSpec_AppendToList(virConnectPtr conn,
- esxVI_ObjectSpec **objectSpecList,
+int esxVI_ObjectSpec_AppendToList(esxVI_ObjectSpec **objectSpecList,
esxVI_ObjectSpec *objectSpec);
-int esxVI_ObjectSpec_Serialize(virConnectPtr conn,
- esxVI_ObjectSpec *objectSpec,
+int esxVI_ObjectSpec_Serialize(esxVI_ObjectSpec *objectSpec,
const char *element, virBufferPtr output,
esxVI_Boolean required);
-int esxVI_ObjectSpec_SerializeList(virConnectPtr conn,
- esxVI_ObjectSpec *objectSpecList,
+int esxVI_ObjectSpec_SerializeList(esxVI_ObjectSpec *objectSpecList,
const char *element, virBufferPtr output,
esxVI_Boolean required);
esxVI_AnyType *val; /* optional */
};
-int esxVI_PropertyChange_Alloc(virConnectPtr conn,
- esxVI_PropertyChange **propertyChange);
+int esxVI_PropertyChange_Alloc(esxVI_PropertyChange **propertyChange);
void esxVI_PropertyChange_Free(esxVI_PropertyChange **propertyChangeList);
int esxVI_PropertyChange_AppendToList
- (virConnectPtr conn, esxVI_PropertyChange **propertyChangeList,
+ (esxVI_PropertyChange **propertyChangeList,
esxVI_PropertyChange *propertyChange);
-int esxVI_PropertyChange_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_PropertyChange_Deserialize(xmlNodePtr node,
esxVI_PropertyChange **propertyChange);
int esxVI_PropertyChange_DeserializeList
- (virConnectPtr conn, xmlNodePtr node,
- esxVI_PropertyChange **propertyChangeList);
+ (xmlNodePtr node, esxVI_PropertyChange **propertyChangeList);
esxVI_String *pathSet; /* optional, list */
};
-int esxVI_PropertySpec_Alloc(virConnectPtr conn,
- esxVI_PropertySpec **propertySpec);
+int esxVI_PropertySpec_Alloc(esxVI_PropertySpec **propertySpec);
void esxVI_PropertySpec_Free(esxVI_PropertySpec **propertySpecList);
-int esxVI_PropertySpec_AppendToList(virConnectPtr conn,
- esxVI_PropertySpec **propertySpecList,
+int esxVI_PropertySpec_AppendToList(esxVI_PropertySpec **propertySpecList,
esxVI_PropertySpec *propertySpec);
-int esxVI_PropertySpec_Serialize(virConnectPtr conn,
- esxVI_PropertySpec *propertySpec,
+int esxVI_PropertySpec_Serialize(esxVI_PropertySpec *propertySpec,
const char *element, virBufferPtr output,
esxVI_Boolean required);
-int esxVI_PropertySpec_SerializeList(virConnectPtr conn,
- esxVI_PropertySpec *propertySpecList,
+int esxVI_PropertySpec_SerializeList(esxVI_PropertySpec *propertySpecList,
const char *element, virBufferPtr output,
esxVI_Boolean required);
};
int esxVI_PropertyFilterSpec_Alloc
- (virConnectPtr conn, esxVI_PropertyFilterSpec **propertyFilterSpec);
+ (esxVI_PropertyFilterSpec **propertyFilterSpec);
void esxVI_PropertyFilterSpec_Free
(esxVI_PropertyFilterSpec **propertyFilterSpecList);
int esxVI_PropertyFilterSpec_AppendToList
- (virConnectPtr conn, esxVI_PropertyFilterSpec **propertyFilterSpecList,
+ (esxVI_PropertyFilterSpec **propertyFilterSpecList,
esxVI_PropertyFilterSpec *propertyFilterSpec);
int esxVI_PropertyFilterSpec_Serialize
- (virConnectPtr conn, esxVI_PropertyFilterSpec *propertyFilterSpec,
- const char *element, virBufferPtr output, esxVI_Boolean required);
+ (esxVI_PropertyFilterSpec *propertyFilterSpec, const char *element,
+ virBufferPtr output, esxVI_Boolean required);
int esxVI_PropertyFilterSpec_SerializeList
- (virConnectPtr conn, esxVI_PropertyFilterSpec *propertyFilterSpecList,
- const char *element, virBufferPtr output, esxVI_Boolean required);
+ (esxVI_PropertyFilterSpec *propertyFilterSpecList, const char *element,
+ virBufferPtr output, esxVI_Boolean required);
/*esxVI_MissingProperty *missingSet; *//* optional, list *//* FIXME */
};
-int esxVI_ObjectContent_Alloc(virConnectPtr conn,
- esxVI_ObjectContent **objectContent);
+int esxVI_ObjectContent_Alloc(esxVI_ObjectContent **objectContent);
void esxVI_ObjectContent_Free(esxVI_ObjectContent **objectContentList);
-int esxVI_ObjectContent_AppendToList(virConnectPtr conn,
- esxVI_ObjectContent **objectContentList,
+int esxVI_ObjectContent_AppendToList(esxVI_ObjectContent **objectContentList,
esxVI_ObjectContent *objectContent);
-int esxVI_ObjectContent_DeepCopy(virConnectPtr conn,
- esxVI_ObjectContent **dest,
+int esxVI_ObjectContent_DeepCopy(esxVI_ObjectContent **dest,
esxVI_ObjectContent *src);
-int esxVI_ObjectContent_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_ObjectContent_Deserialize(xmlNodePtr node,
esxVI_ObjectContent **objectContent);
int esxVI_ObjectContent_DeserializeList
- (virConnectPtr conn, xmlNodePtr node,
- esxVI_ObjectContent **objectContentList);
+ (xmlNodePtr node, esxVI_ObjectContent **objectContentList);
/*esxVI_MissingProperty *missingSet; *//* optional, list *//* FIXME */
};
-int esxVI_ObjectUpdate_Alloc(virConnectPtr conn,
- esxVI_ObjectUpdate **objectUpdate);
+int esxVI_ObjectUpdate_Alloc(esxVI_ObjectUpdate **objectUpdate);
void esxVI_ObjectUpdate_Free(esxVI_ObjectUpdate **objectUpdateList);
-int esxVI_ObjectUpdate_AppendToList(virConnectPtr conn,
- esxVI_ObjectUpdate **objectUpdateList,
+int esxVI_ObjectUpdate_AppendToList(esxVI_ObjectUpdate **objectUpdateList,
esxVI_ObjectUpdate *objectUpdate);
-int esxVI_ObjectUpdate_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_ObjectUpdate_Deserialize(xmlNodePtr node,
esxVI_ObjectUpdate **objectUpdate);
-int esxVI_ObjectUpdate_DeserializeList(virConnectPtr conn, xmlNodePtr node,
+int esxVI_ObjectUpdate_DeserializeList(xmlNodePtr node,
esxVI_ObjectUpdate **objectUpdateList);
};
int esxVI_PropertyFilterUpdate_Alloc
- (virConnectPtr conn,
- esxVI_PropertyFilterUpdate **propertyFilterUpdate);
+ (esxVI_PropertyFilterUpdate **propertyFilterUpdate);
void esxVI_PropertyFilterUpdate_Free
(esxVI_PropertyFilterUpdate **propertyFilterUpdateList);
int esxVI_PropertyFilterUpdate_AppendToList
- (virConnectPtr conn,
- esxVI_PropertyFilterUpdate **propertyFilterUpdateList,
+ (esxVI_PropertyFilterUpdate **propertyFilterUpdateList,
esxVI_PropertyFilterUpdate *propertyFilterUpdate);
int esxVI_PropertyFilterUpdate_Deserialize
- (virConnectPtr conn, xmlNodePtr node,
- esxVI_PropertyFilterUpdate **propertyFilterUpdate);
+ (xmlNodePtr node, esxVI_PropertyFilterUpdate **propertyFilterUpdate);
int esxVI_PropertyFilterUpdate_DeserializeList
- (virConnectPtr conn, xmlNodePtr node,
- esxVI_PropertyFilterUpdate **propertyFilterUpdateList);
+ (xmlNodePtr node, esxVI_PropertyFilterUpdate **propertyFilterUpdateList);
char *apiVersion; /* required */
};
-int esxVI_AboutInfo_Alloc(virConnectPtr conn, esxVI_AboutInfo **aboutInfo);
+int esxVI_AboutInfo_Alloc(esxVI_AboutInfo **aboutInfo);
void esxVI_AboutInfo_Free(esxVI_AboutInfo **aboutInfo);
-int esxVI_AboutInfo_Deserialize(virConnectPtr conn, xmlNodePtr node,
- esxVI_AboutInfo **aboutInfo);
+int esxVI_AboutInfo_Deserialize(xmlNodePtr node, esxVI_AboutInfo **aboutInfo);
esxVI_ManagedObjectReference *virtualizationManager; /* optional */
};
-int esxVI_ServiceContent_Alloc(virConnectPtr conn,
- esxVI_ServiceContent **serviceContent);
+int esxVI_ServiceContent_Alloc(esxVI_ServiceContent **serviceContent);
void esxVI_ServiceContent_Free(esxVI_ServiceContent **serviceContent);
-int esxVI_ServiceContent_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_ServiceContent_Deserialize(xmlNodePtr node,
esxVI_ServiceContent **serviceContent);
esxVI_PropertyFilterUpdate *filterSet; /* optional, list */
};
-int esxVI_UpdateSet_Alloc(virConnectPtr conn, esxVI_UpdateSet **updateSet);
+int esxVI_UpdateSet_Alloc(esxVI_UpdateSet **updateSet);
void esxVI_UpdateSet_Free(esxVI_UpdateSet **updateSet);
-int esxVI_UpdateSet_Deserialize(virConnectPtr conn, xmlNodePtr node,
- esxVI_UpdateSet **updateSet);
+int esxVI_UpdateSet_Deserialize(xmlNodePtr node, esxVI_UpdateSet **updateSet);
esxVI_SharesLevel level; /* required */
};
-int esxVI_SharesInfo_Alloc(virConnectPtr conn, esxVI_SharesInfo **sharesInfo);
+int esxVI_SharesInfo_Alloc(esxVI_SharesInfo **sharesInfo);
void esxVI_SharesInfo_Free(esxVI_SharesInfo **sharesInfo);
-int esxVI_SharesInfo_CastFromAnyType(virConnectPtr conn,
- esxVI_AnyType *anyType,
+int esxVI_SharesInfo_CastFromAnyType(esxVI_AnyType *anyType,
esxVI_SharesInfo **sharesInfo);
-int esxVI_SharesInfo_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_SharesInfo_Deserialize(xmlNodePtr node,
esxVI_SharesInfo **sharesInfo);
-int esxVI_SharesInfo_Serialize(virConnectPtr conn,
- esxVI_SharesInfo *sharesInfo,
+int esxVI_SharesInfo_Serialize(esxVI_SharesInfo *sharesInfo,
const char *element, virBufferPtr output,
esxVI_Boolean required);
};
int esxVI_ResourceAllocationInfo_Alloc
- (virConnectPtr conn,
- esxVI_ResourceAllocationInfo **resourceAllocationInfo);
+ (esxVI_ResourceAllocationInfo **resourceAllocationInfo);
void esxVI_ResourceAllocationInfo_Free
(esxVI_ResourceAllocationInfo **resourceAllocationInfo);
int esxVI_ResourceAllocationInfo_Serialize
- (virConnectPtr conn, esxVI_ResourceAllocationInfo *resourceAllocationInfo,
+ (esxVI_ResourceAllocationInfo *resourceAllocationInfo,
const char *element, virBufferPtr output, esxVI_Boolean required);
};
int esxVI_ResourcePoolResourceUsage_Alloc
- (virConnectPtr conn,
- esxVI_ResourcePoolResourceUsage **resourcePoolResourceUsage);
+ (esxVI_ResourcePoolResourceUsage **resourcePoolResourceUsage);
void esxVI_ResourcePoolResourceUsage_Free
(esxVI_ResourcePoolResourceUsage **resourcePoolResourceUsage);
int esxVI_ResourcePoolResourceUsage_CastFromAnyType
- (virConnectPtr conn, esxVI_AnyType *anyType,
+ (esxVI_AnyType *anyType,
esxVI_ResourcePoolResourceUsage **resourcePoolResourceUsage);
int esxVI_ResourcePoolResourceUsage_Deserialize
- (virConnectPtr conn, xmlNodePtr node,
+ (xmlNodePtr node,
esxVI_ResourcePoolResourceUsage **resourcePoolResourceUsage);
};
int esxVI_VirtualMachineConfigSpec_Alloc
- (virConnectPtr conn,
- esxVI_VirtualMachineConfigSpec **virtualMachineConfigSpec);
+ (esxVI_VirtualMachineConfigSpec **virtualMachineConfigSpec);
void esxVI_VirtualMachineConfigSpec_Free
(esxVI_VirtualMachineConfigSpec **virtualMachineConfigSpec);
int esxVI_VirtualMachineConfigSpec_Serialize
- (virConnectPtr conn,
- esxVI_VirtualMachineConfigSpec *virtualMachineConfigSpec,
+ (esxVI_VirtualMachineConfigSpec *virtualMachineConfigSpec,
const char *element, virBufferPtr output, esxVI_Boolean required);
char *fullFormattedMessage; /* optional */
};
-int esxVI_Event_Alloc(virConnectPtr conn, esxVI_Event **event);
+int esxVI_Event_Alloc(esxVI_Event **event);
void esxVI_Event_Free(esxVI_Event **eventList);
-int esxVI_Event_Deserialize(virConnectPtr conn, xmlNodePtr node,
- esxVI_Event **event);
-int esxVI_Event_DeserializeList(virConnectPtr conn, xmlNodePtr node,
- esxVI_Event **eventList);
+int esxVI_Event_Deserialize(xmlNodePtr node, esxVI_Event **event);
+int esxVI_Event_DeserializeList(xmlNodePtr node, esxVI_Event **eventList);
char *messageLocale; /* required */
};
-int esxVI_UserSession_Alloc(virConnectPtr conn,
- esxVI_UserSession **userSession);
+int esxVI_UserSession_Alloc(esxVI_UserSession **userSession);
void esxVI_UserSession_Free(esxVI_UserSession **userSession);
-int esxVI_UserSession_CastFromAnyType(virConnectPtr conn,
- esxVI_AnyType *anyType,
+int esxVI_UserSession_CastFromAnyType(esxVI_AnyType *anyType,
esxVI_UserSession **userSession);
-int esxVI_UserSession_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_UserSession_Deserialize(xmlNodePtr node,
esxVI_UserSession **userSession);
};
int esxVI_VirtualMachineQuestionInfo_Alloc
- (virConnectPtr conn,
- esxVI_VirtualMachineQuestionInfo **virtualMachineQuestionInfo);
+ (esxVI_VirtualMachineQuestionInfo **virtualMachineQuestionInfo);
void esxVI_VirtualMachineQuestionInfo_Free
(esxVI_VirtualMachineQuestionInfo **virtualMachineQuestionInfo);
int esxVI_VirtualMachineQuestionInfo_CastFromAnyType
- (virConnectPtr conn, esxVI_AnyType *anyType,
+ (esxVI_AnyType *anyType,
esxVI_VirtualMachineQuestionInfo **virtualMachineQuestionInfo);
int esxVI_VirtualMachineQuestionInfo_Deserialize
- (virConnectPtr conn, xmlNodePtr node,
+ (xmlNodePtr node,
esxVI_VirtualMachineQuestionInfo **virtualMachineQuestionInfo);
};
int esxVI_ElementDescription_Alloc
- (virConnectPtr conn, esxVI_ElementDescription **elementDescription);
+ (esxVI_ElementDescription **elementDescription);
void esxVI_ElementDescription_Free
(esxVI_ElementDescription **elementDescription);
int esxVI_ElementDescription_AppendToList
- (virConnectPtr conn, esxVI_ElementDescription **elementDescriptionList,
+ (esxVI_ElementDescription **elementDescriptionList,
esxVI_ElementDescription *elementDescription);
int esxVI_ElementDescription_Deserialize
- (virConnectPtr conn, xmlNodePtr node,
- esxVI_ElementDescription **elementDescription);
+ (xmlNodePtr node, esxVI_ElementDescription **elementDescription);
esxVI_Int *defaultIndex; /* optional */
};
-int esxVI_ChoiceOption_Alloc(virConnectPtr conn,
- esxVI_ChoiceOption **choiceOption);
+int esxVI_ChoiceOption_Alloc(esxVI_ChoiceOption **choiceOption);
void esxVI_ChoiceOption_Free(esxVI_ChoiceOption **choiceOption);
-int esxVI_ChoiceOption_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_ChoiceOption_Deserialize(xmlNodePtr node,
esxVI_ChoiceOption **choiceOption);
char *instance; /* required */
};
-int esxVI_PerfMetricId_Alloc(virConnectPtr conn,
- esxVI_PerfMetricId **perfMetricId);
+int esxVI_PerfMetricId_Alloc(esxVI_PerfMetricId **perfMetricId);
void esxVI_PerfMetricId_Free(esxVI_PerfMetricId **perfMetricId);
-int esxVI_PerfMetricId_Serialize(virConnectPtr conn,
- esxVI_PerfMetricId *perfMetricId,
+int esxVI_PerfMetricId_Serialize(esxVI_PerfMetricId *perfMetricId,
const char *element, virBufferPtr output,
esxVI_Boolean required);
-int esxVI_PerfMetricId_SerializeList(virConnectPtr conn,
- esxVI_PerfMetricId *perfMetricIdList,
+int esxVI_PerfMetricId_SerializeList(esxVI_PerfMetricId *perfMetricIdList,
const char *element, virBufferPtr output,
esxVI_Boolean required);
-int esxVI_PerfMetricId_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_PerfMetricId_Deserialize(xmlNodePtr node,
esxVI_PerfMetricId **perfMetricId);
-int esxVI_PerfMetricId_DeserializeList(virConnectPtr conn, xmlNodePtr node,
+int esxVI_PerfMetricId_DeserializeList(xmlNodePtr node,
esxVI_PerfMetricId **perfMetricIdList);
esxVI_Int *associatedCounterId; /* optional, list */
};
-int esxVI_PerfCounterInfo_Alloc(virConnectPtr conn,
- esxVI_PerfCounterInfo **perfCounterInfo);
+int esxVI_PerfCounterInfo_Alloc(esxVI_PerfCounterInfo **perfCounterInfo);
void esxVI_PerfCounterInfo_Free(esxVI_PerfCounterInfo **perfCounterInfo);
-int esxVI_PerfCounterInfo_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_PerfCounterInfo_Deserialize(xmlNodePtr node,
esxVI_PerfCounterInfo **perfCounterInfo);
int esxVI_PerfCounterInfo_DeserializeList
- (virConnectPtr conn, xmlNodePtr node,
- esxVI_PerfCounterInfo **perfCounterInfoList);
+ (xmlNodePtr node, esxVI_PerfCounterInfo **perfCounterInfoList);
char *format; /* optional */ // FIXME: see PerfFormat
};
-int esxVI_PerfQuerySpec_Alloc(virConnectPtr conn,
- esxVI_PerfQuerySpec **perfQuerySpec);
+int esxVI_PerfQuerySpec_Alloc(esxVI_PerfQuerySpec **perfQuerySpec);
void esxVI_PerfQuerySpec_Free(esxVI_PerfQuerySpec **perfQuerySpec);
-int esxVI_PerfQuerySpec_Serialize(virConnectPtr conn,
- esxVI_PerfQuerySpec *perfQuerySpec,
+int esxVI_PerfQuerySpec_Serialize(esxVI_PerfQuerySpec *perfQuerySpec,
const char *element, virBufferPtr output,
esxVI_Boolean required);
-int esxVI_PerfQuerySpec_SerializeList(virConnectPtr conn,
- esxVI_PerfQuerySpec *perfQuerySpecList,
+int esxVI_PerfQuerySpec_SerializeList(esxVI_PerfQuerySpec *perfQuerySpecList,
const char *element, virBufferPtr output,
esxVI_Boolean required);
esxVI_Int *interval; /* required */
};
-int esxVI_PerfSampleInfo_Alloc(virConnectPtr conn,
- esxVI_PerfSampleInfo **perfSampleInfo);
+int esxVI_PerfSampleInfo_Alloc(esxVI_PerfSampleInfo **perfSampleInfo);
void esxVI_PerfSampleInfo_Free(esxVI_PerfSampleInfo **perfSampleInfo);
-int esxVI_PerfSampleInfo_AppendToList(virConnectPtr conn,
- esxVI_PerfSampleInfo **perfSampleInfoList,
+int esxVI_PerfSampleInfo_AppendToList(esxVI_PerfSampleInfo **perfSampleInfoList,
esxVI_PerfSampleInfo *perfSampleInfo);
-int esxVI_PerfSampleInfo_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_PerfSampleInfo_Deserialize(xmlNodePtr node,
esxVI_PerfSampleInfo **perfSampleInfo);
int esxVI_PerfSampleInfo_DeserializeList
- (virConnectPtr conn, xmlNodePtr node,
- esxVI_PerfSampleInfo **perfSampleInfoList);
+ (xmlNodePtr node, esxVI_PerfSampleInfo **perfSampleInfoList);
};
int esxVI_PerfMetricIntSeries_Alloc
- (virConnectPtr conn, esxVI_PerfMetricIntSeries **perfMetricIntSeries);
+ (esxVI_PerfMetricIntSeries **perfMetricIntSeries);
void esxVI_PerfMetricIntSeries_Free
(esxVI_PerfMetricIntSeries **perfMetricIntSeries);
int esxVI_PerfMetricIntSeries_AppendToList
- (virConnectPtr conn, esxVI_PerfMetricIntSeries **perfMetricIntSeriesList,
+ (esxVI_PerfMetricIntSeries **perfMetricIntSeriesList,
esxVI_PerfMetricIntSeries *perfMetricIntSeries);
int esxVI_PerfMetricIntSeries_Deserialize
- (virConnectPtr conn, xmlNodePtr node,
- esxVI_PerfMetricIntSeries **perfMetricIntSeries);
+ (xmlNodePtr node, esxVI_PerfMetricIntSeries **perfMetricIntSeries);
esxVI_PerfMetricIntSeries *value; /* optional, list */
};
-int esxVI_PerfEntityMetric_Alloc(virConnectPtr conn,
- esxVI_PerfEntityMetric **perfEntityMetric);
+int esxVI_PerfEntityMetric_Alloc(esxVI_PerfEntityMetric **perfEntityMetric);
void esxVI_PerfEntityMetric_Free
(esxVI_PerfEntityMetric **perfEntityMetric);
int esxVI_PerfEntityMetric_Deserialize
- (virConnectPtr conn, xmlNodePtr node,
- esxVI_PerfEntityMetric **perfEntityMetric);
+ (xmlNodePtr node, esxVI_PerfEntityMetric **perfEntityMetric);
int esxVI_PerfEntityMetric_DeserializeList
- (virConnectPtr conn, xmlNodePtr node,
- esxVI_PerfEntityMetric **perfEntityMetricList);
+ (xmlNodePtr node, esxVI_PerfEntityMetric **perfEntityMetricList);
esxVI_Int *eventChainId; /* required */
};
-int esxVI_TaskInfo_Alloc(virConnectPtr conn, esxVI_TaskInfo **taskInfo);
+int esxVI_TaskInfo_Alloc(esxVI_TaskInfo **taskInfo);
void esxVI_TaskInfo_Free(esxVI_TaskInfo **taskInfoList);
-int esxVI_TaskInfo_CastFromAnyType(virConnectPtr conn, esxVI_AnyType *anyType,
+int esxVI_TaskInfo_CastFromAnyType(esxVI_AnyType *anyType,
esxVI_TaskInfo **taskInfo);
-int esxVI_TaskInfo_AppendToList(virConnectPtr conn,
- esxVI_TaskInfo **taskInfoList,
+int esxVI_TaskInfo_AppendToList(esxVI_TaskInfo **taskInfoList,
esxVI_TaskInfo *taskInfo);
-int esxVI_TaskInfo_Deserialize(virConnectPtr conn, xmlNodePtr node,
- esxVI_TaskInfo **taskInfo);
+int esxVI_TaskInfo_Deserialize(xmlNodePtr node, esxVI_TaskInfo **taskInfo);
#endif /* __ESX_VI_TYPES_H__ */
#define VIR_FROM_THIS VIR_FROM_ESX
-#define ESX_ERROR(conn, code, fmt...) \
- virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
+#define ESX_ERROR(code, fmt...) \
+ virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
__LINE__, fmt)
int
-esxVMX_SCSIDiskNameToControllerAndID(virConnectPtr conn, const char *name,
- int *controller, int *id)
+esxVMX_SCSIDiskNameToControllerAndID(const char *name, int *controller, int *id)
{
int idx;
if (! STRPREFIX(name, "sd")) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML attribute 'dev' of entry "
"'devices/disk/target' to start with 'sd'");
return -1;
idx = virDiskNameToIndex(name);
if (idx < 0) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not parse valid disk index from '%s'", name);
return -1;
}
/* Each of the 4 SCSI controllers offers 15 IDs for devices */
if (idx >= (4 * 15)) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"SCSI disk index (parsed from '%s') is too large", name);
return -1;
}
int
-esxVMX_IDEDiskNameToControllerAndID(virConnectPtr conn, const char *name,
- int *controller, int *id)
+esxVMX_IDEDiskNameToControllerAndID(const char *name, int *controller, int *id)
{
int idx;
if (! STRPREFIX(name, "hd")) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML attribute 'dev' of entry "
"'devices/disk/target' to start with 'hd'");
return -1;
idx = virDiskNameToIndex(name);
if (idx < 0) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not parse valid disk index from '%s'", name);
return -1;
}
/* Each of the 2 IDE controllers offers 2 IDs for devices */
if (idx >= (2 * 2)) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"IDE disk index (parsed from '%s') is too large", name);
return -1;
}
int
-esxVMX_FloppyDiskNameToController(virConnectPtr conn, const char *name,
- int *controller)
+esxVMX_FloppyDiskNameToController(const char *name, int *controller)
{
int idx;
if (! STRPREFIX(name, "fd")) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML attribute 'dev' of entry "
"'devices/disk/target' to start with 'fd'");
return -1;
idx = virDiskNameToIndex(name);
if (idx < 0) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Could not parse valid disk index from '%s'", name);
return -1;
}
if (idx >= 2) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Floppy disk index (parsed from '%s') is too large", name);
return -1;
}
int
-esxVMX_GatherSCSIControllers(virConnectPtr conn, virDomainDefPtr def,
- char *virtualDev[4], int present[4])
+esxVMX_GatherSCSIControllers(virDomainDefPtr def, char *virtualDev[4],
+ int present[4])
{
virDomainDiskDefPtr disk;
int i, controller, id;
if (disk->driverName != NULL &&
STRCASENEQ(disk->driverName, "buslogic") &&
STRCASENEQ(disk->driverName, "lsilogic")) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML entry 'devices/disk/target' to be "
"'buslogic' or 'lsilogic' but found '%s'",
disk->driverName);
return -1;
}
- if (esxVMX_SCSIDiskNameToControllerAndID(conn, disk->dst,
- &controller, &id) < 0) {
+ if (esxVMX_SCSIDiskNameToControllerAndID(disk->dst, &controller,
+ &id) < 0) {
return -1;
}
if (virtualDev[controller] == NULL) {
virtualDev[controller] = disk->driverName;
} else if (STRCASENEQ(virtualDev[controller], disk->driverName)) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Inconsistent driver usage ('%s' is not '%s') on SCSI "
"controller index %d", virtualDev[controller],
disk->driverName, controller);
char *
-esxVMX_AbsolutePathToDatastoreRelatedPath(virConnectPtr conn,
- esxVI_Context *ctx,
+esxVMX_AbsolutePathToDatastoreRelatedPath(esxVI_Context *ctx,
const char *absolutePath)
{
char *datastoreRelatedPath = NULL;
if (sscanf(absolutePath, "/vmfs/volumes/%a[^/]/%a[^\n]",
&preliminaryDatastoreName, &directoryAndFileName) != 2) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Absolute path '%s' doesn't have expected format "
"'/vmfs/volumes/<datastore>/<path>'", absolutePath);
goto failure;
}
if (ctx != NULL) {
- if (esxVI_LookupDatastoreByName(conn, ctx, preliminaryDatastoreName,
+ if (esxVI_LookupDatastoreByName(ctx, preliminaryDatastoreName,
NULL, &datastore,
esxVI_Occurrence_OptionalItem) < 0) {
goto failure;
if (STREQ(dynamicProperty->name, "summary.accessible")) {
/* Ignore it */
} else if (STREQ(dynamicProperty->name, "summary.name")) {
- if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+ if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_String) < 0) {
goto failure;
}
if (virAsprintf(&datastoreRelatedPath, "[%s] %s", datastoreName,
directoryAndFileName) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
*/
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)
{
char *src = NULL;
if (STRPREFIX(fileName, "/vmfs/volumes/")) {
/* Found absolute path referencing a file inside a datastore */
- return esxVMX_AbsolutePathToDatastoreRelatedPath(conn, ctx, fileName);
+ return esxVMX_AbsolutePathToDatastoreRelatedPath(ctx, fileName);
} else if (STRPREFIX(fileName, "/")) {
/* Found absolute path referencing a file outside a datastore */
src = strdup(fileName);
if (src == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
return NULL;
}
return src;
} else if (strchr(fileName, '/') != NULL) {
/* Found relative path, this is not supported */
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Found relative path '%s' in VMX file, this is not "
"supported", fileName);
return NULL;
/* Found single file name referencing a file inside a datastore */
if (virAsprintf(&src, "[%s] %s/%s", datastoreName, directoryName,
fileName) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
return NULL;
}
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)
{
}
if (VIR_ALLOC(def) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
def->id = -1;
/* vmx:config.version */
- if (esxUtil_GetConfigLong(conn, conf, "config.version",
- &config_version, 0, 0) < 0) {
+ if (esxUtil_GetConfigLong(conf, "config.version", &config_version, 0,
+ 0) < 0) {
goto failure;
}
if (config_version != 8) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry 'config.version' to be 8 but found "
"%lld", config_version);
goto failure;
}
/* vmx:virtualHW.version */
- if (esxUtil_GetConfigLong(conn, conf, "virtualHW.version",
- &virtualHW_version, 0, 0) < 0) {
+ if (esxUtil_GetConfigLong(conf, "virtualHW.version", &virtualHW_version, 0,
+ 0) < 0) {
goto failure;
}
switch (apiVersion) {
case esxVI_APIVersion_25:
if (virtualHW_version != 4) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry 'virtualHW.version' to be 4 for "
"VI API version 2.5 but found %lld", virtualHW_version);
goto failure;
case esxVI_APIVersion_40:
if (virtualHW_version != 4 && virtualHW_version != 7) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry 'virtualHW.version' to be 4 or 7 for "
"VI API version 4.0 but found %lld", virtualHW_version);
goto failure;
case esxVI_APIVersion_Unknown:
if (virtualHW_version != 4 && virtualHW_version != 7) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry 'virtualHW.version' to be 4 or 7 "
"but found %lld", virtualHW_version);
goto failure;
break;
default:
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VI API version 2.5 or 4.0");
goto failure;
}
/* vmx:uuid.bios -> def:uuid */
/* FIXME: Need to handle 'uuid.action = "create"' */
- if (esxUtil_GetConfigUUID(conn, conf, "uuid.bios", def->uuid, 1) < 0) {
+ if (esxUtil_GetConfigUUID(conf, "uuid.bios", def->uuid, 1) < 0) {
goto failure;
}
/* vmx:displayName -> def:name */
- if (esxUtil_GetConfigString(conn, conf, "displayName",
- &def->name, 1) < 0) {
+ if (esxUtil_GetConfigString(conf, "displayName", &def->name, 1) < 0) {
goto failure;
}
/* vmx:memsize -> def:maxmem */
- if (esxUtil_GetConfigLong(conn, conf, "memsize", &memsize, 32, 1) < 0) {
+ if (esxUtil_GetConfigLong(conf, "memsize", &memsize, 32, 1) < 0) {
goto failure;
}
if (memsize <= 0 || memsize % 4 != 0) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry 'memsize' to be an unsigned "
"integer (multiple of 4) but found %lld", memsize);
goto failure;
def->maxmem = memsize * 1024; /* Scale from megabytes to kilobytes */
/* vmx:sched.mem.max -> def:memory */
- if (esxUtil_GetConfigLong(conn, conf, "sched.mem.max", &memory,
- memsize, 1) < 0) {
+ if (esxUtil_GetConfigLong(conf, "sched.mem.max", &memory, memsize, 1) < 0) {
goto failure;
}
}
/* vmx:numvcpus -> def:vcpus */
- if (esxUtil_GetConfigLong(conn, conf, "numvcpus", &numvcpus, 1, 1) < 0) {
+ if (esxUtil_GetConfigLong(conf, "numvcpus", &numvcpus, 1, 1) < 0) {
goto failure;
}
if (numvcpus <= 0 || (numvcpus % 2 != 0 && numvcpus != 1)) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry 'numvcpus' to be an unsigned "
"integer (1 or a multiple of 2) but found %lld", numvcpus);
goto failure;
/* vmx:sched.cpu.affinity -> def:cpumask */
// VirtualMachine:config.cpuAffinity.affinitySet
- if (esxUtil_GetConfigString(conn, conf, "sched.cpu.affinity",
- &sched_cpu_affinity, 1) < 0) {
+ if (esxUtil_GetConfigString(conf, "sched.cpu.affinity", &sched_cpu_affinity,
+ 1) < 0) {
goto failure;
}
def->cpumasklen = 0;
if (VIR_ALLOC_N(def->cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
number = virParseNumber(¤t);
if (number < 0) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry 'sched.cpu.affinity' to be "
"a comma separated list of unsigned integers but "
"found '%s'", sched_cpu_affinity);
}
if (number >= VIR_DOMAIN_CPUMASK_LEN) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"VMX entry 'sched.cpu.affinity' contains a %d, this "
"value is too large", number);
goto failure;
} else if (*current == '\0') {
break;
} else {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry 'sched.cpu.affinity' to be "
"a comma separated list of unsigned integers but "
"found '%s'", sched_cpu_affinity);
}
if (count < numvcpus) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry 'sched.cpu.affinity' to contain "
"at least as many values as 'numvcpus' (%lld) but "
"found only %d value(s)", numvcpus, count);
def->os.type = strdup("hvm");
if (def->os.type == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
/* vmx:guestOS -> def:os.arch */
- if (esxUtil_GetConfigString(conn, conf, "guestOS", &guestOS, 1) < 0) {
+ if (esxUtil_GetConfigString(conf, "guestOS", &guestOS, 1) < 0) {
goto failure;
}
}
if (def->os.arch == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
/* def:graphics */
if (VIR_ALLOC_N(def->graphics, 1) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
def->ngraphics = 0;
- if (esxVMX_ParseVNC(conn, conf, &def->graphics[def->ngraphics]) < 0) {
+ if (esxVMX_ParseVNC(conf, &def->graphics[def->ngraphics]) < 0) {
goto failure;
}
/* def:disks: 4 * 15 scsi + 2 * 2 ide + 2 floppy = 66 */
if (VIR_ALLOC_N(def->disks, 66) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
for (controller = 0; controller < 4; ++controller) {
VIR_FREE(scsi_virtualDev);
- if (esxVMX_ParseSCSIController(conn, conf, controller,
- &present, &scsi_virtualDev) < 0) {
+ if (esxVMX_ParseSCSIController(conf, controller, &present,
+ &scsi_virtualDev) < 0) {
goto failure;
}
continue;
}
- if (esxVMX_ParseDisk(conn, ctx, conf, VIR_DOMAIN_DISK_DEVICE_DISK,
+ if (esxVMX_ParseDisk(ctx, conf, VIR_DOMAIN_DISK_DEVICE_DISK,
VIR_DOMAIN_DISK_BUS_SCSI, controller, id,
scsi_virtualDev, datastoreName, directoryName,
&def->disks[def->ndisks]) < 0) {
continue;
}
- if (esxVMX_ParseDisk(conn, ctx, conf, VIR_DOMAIN_DISK_DEVICE_CDROM,
+ if (esxVMX_ParseDisk(ctx, conf, VIR_DOMAIN_DISK_DEVICE_CDROM,
VIR_DOMAIN_DISK_BUS_SCSI, controller, id,
scsi_virtualDev, datastoreName, directoryName,
&def->disks[def->ndisks]) < 0) {
/* def:disks (ide) */
for (controller = 0; controller < 2; ++controller) {
for (id = 0; id < 2; ++id) {
- if (esxVMX_ParseDisk(conn, ctx, conf, VIR_DOMAIN_DISK_DEVICE_DISK,
+ if (esxVMX_ParseDisk(ctx, conf, VIR_DOMAIN_DISK_DEVICE_DISK,
VIR_DOMAIN_DISK_BUS_IDE, controller, id,
NULL, datastoreName, directoryName,
&def->disks[def->ndisks]) < 0) {
continue;
}
- if (esxVMX_ParseDisk(conn, ctx, conf, VIR_DOMAIN_DISK_DEVICE_CDROM,
+ if (esxVMX_ParseDisk(ctx, conf, VIR_DOMAIN_DISK_DEVICE_CDROM,
VIR_DOMAIN_DISK_BUS_IDE, controller, id,
NULL, datastoreName, directoryName,
&def->disks[def->ndisks]) < 0) {
/* def:disks (floppy) */
for (controller = 0; controller < 2; ++controller) {
- if (esxVMX_ParseDisk(conn, ctx, conf, VIR_DOMAIN_DISK_DEVICE_FLOPPY,
+ if (esxVMX_ParseDisk(ctx, conf, VIR_DOMAIN_DISK_DEVICE_FLOPPY,
VIR_DOMAIN_DISK_BUS_FDC, controller, -1, NULL,
datastoreName, directoryName,
&def->disks[def->ndisks]) < 0) {
/* def:nets */
if (VIR_ALLOC_N(def->nets, 4) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
def->nnets = 0;
for (controller = 0; controller < 4; ++controller) {
- if (esxVMX_ParseEthernet(conn, conf, controller,
+ if (esxVMX_ParseEthernet(conf, controller,
&def->nets[def->nnets]) < 0) {
goto failure;
}
/* def:serials */
if (VIR_ALLOC_N(def->serials, 4) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
def->nserials = 0;
for (port = 0; port < 4; ++port) {
- if (esxVMX_ParseSerial(conn, ctx, conf, port,
- datastoreName, directoryName,
+ if (esxVMX_ParseSerial(ctx, conf, port, datastoreName,
+ directoryName,
&def->serials[def->nserials]) < 0) {
goto failure;
}
/* def:parallels */
if (VIR_ALLOC_N(def->parallels, 3) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
def->nparallels = 0;
for (port = 0; port < 3; ++port) {
- if (esxVMX_ParseParallel(conn, ctx, conf, port,
- datastoreName, directoryName,
+ if (esxVMX_ParseParallel(ctx, conf, port, datastoreName,
+ directoryName,
&def->parallels[def->nparallels]) < 0) {
goto failure;
}
int
-esxVMX_ParseVNC(virConnectPtr conn, virConfPtr conf, virDomainGraphicsDefPtr *def)
+esxVMX_ParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def)
{
int enabled = 0; // boolean
long long port = 0;
if (def == NULL || *def != NULL) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
- if (esxUtil_GetConfigBoolean(conn, conf, "RemoteDisplay.vnc.enabled",
- &enabled, 0, 1) < 0) {
+ if (esxUtil_GetConfigBoolean(conf, "RemoteDisplay.vnc.enabled", &enabled,
+ 0, 1) < 0) {
return -1;
}
}
if (VIR_ALLOC(*def) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
(*def)->type = VIR_DOMAIN_GRAPHICS_TYPE_VNC;
- if (esxUtil_GetConfigLong(conn, conf, "RemoteDisplay.vnc.port",
- &port, -1, 1) < 0 ||
- esxUtil_GetConfigString(conn, conf, "RemoteDisplay.vnc.ip",
+ if (esxUtil_GetConfigLong(conf, "RemoteDisplay.vnc.port", &port, -1,
+ 1) < 0 ||
+ esxUtil_GetConfigString(conf, "RemoteDisplay.vnc.ip",
&(*def)->data.vnc.listenAddr, 1) < 0 ||
- esxUtil_GetConfigString(conn, conf, "RemoteDisplay.vnc.keymap",
+ esxUtil_GetConfigString(conf, "RemoteDisplay.vnc.keymap",
&(*def)->data.vnc.keymap, 1) < 0 ||
- esxUtil_GetConfigString(conn, conf, "RemoteDisplay.vnc.password",
+ esxUtil_GetConfigString(conf, "RemoteDisplay.vnc.password",
&(*def)->data.vnc.passwd, 1) < 0) {
goto failure;
}
int
-esxVMX_ParseSCSIController(virConnectPtr conn, virConfPtr conf, int controller,
- int *present, char **virtualDev)
+esxVMX_ParseSCSIController(virConfPtr conf, int controller, int *present,
+ char **virtualDev)
{
char present_name[32];
char virtualDev_name[32];
if (virtualDev == NULL || *virtualDev != NULL) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
if (controller < 0 || controller > 3) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"SCSI controller index %d out of [0..3] range",
controller);
return -1;
snprintf(virtualDev_name, sizeof(virtualDev_name), "scsi%d.virtualDev",
controller);
- if (esxUtil_GetConfigBoolean(conn, conf, present_name, present, 0, 1) < 0) {
+ if (esxUtil_GetConfigBoolean(conf, present_name, present, 0, 1) < 0) {
goto failure;
}
return 0;
}
- if (esxUtil_GetConfigString(conn, conf, virtualDev_name,
- virtualDev, 1) < 0) {
+ if (esxUtil_GetConfigString(conf, virtualDev_name, virtualDev, 1) < 0) {
goto failure;
}
if (*virtualDev != NULL &&
STRCASENEQ(*virtualDev, "buslogic") &&
STRCASENEQ(*virtualDev, "lsilogic")) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be 'buslogic' or 'lsilogic' "
"but found '%s'", virtualDev_name, *virtualDev);
goto failure;
};*/
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)
{
/*
* device = {VIR_DOMAIN_DISK_DEVICE_DISK, VIR_DOMAIN_DISK_DEVICE_CDROM}
int writeThrough = 0;
if (def == NULL || *def != NULL) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
if (VIR_ALLOC(*def) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
if (bus == VIR_DOMAIN_DISK_BUS_SCSI) {
if (controller < 0 || controller > 3) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"SCSI controller index %d out of [0..3] range",
controller);
goto failure;
}
if (id < 0 || id > 15 || id == 7) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"SCSI ID %d out of [0..6,8..15] range", id);
goto failure;
}
if (virAsprintf(&prefix, "scsi%d:%d", controller, id) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
(*def)->driverName = strdup(virtualDev);
if ((*def)->driverName == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
}
} else if (bus == VIR_DOMAIN_DISK_BUS_IDE) {
if (controller < 0 || controller > 1) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"IDE controller index %d out of [0..1] range",
controller);
goto failure;
}
if (id < 0 || id > 1) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"IDE ID %d out of [0..1] range", id);
goto failure;
}
if (virAsprintf(&prefix, "ide%d:%d", controller, id) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
goto failure;
}
} else {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unsupported bus type '%s' for device type '%s'",
virDomainDiskBusTypeToString(bus),
virDomainDiskDeviceTypeToString(device));
} else if (device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
if (bus == VIR_DOMAIN_DISK_BUS_FDC) {
if (controller < 0 || controller > 1) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Floppy controller index %d out of [0..1] range",
controller);
goto failure;
}
if (virAsprintf(&prefix, "floppy%d", controller) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
goto failure;
}
} else {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unsupported bus type '%s' for device type '%s'",
virDomainDiskBusTypeToString(bus),
virDomainDiskDeviceTypeToString(device));
goto failure;
}
} else {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unsupported device type '%s'",
virDomainDiskDeviceTypeToString(device));
goto failure;
ESX_BUILD_VMX_NAME(writeThrough);
/* vmx:present */
- if (esxUtil_GetConfigBoolean(conn, conf, present_name,
- &present, 0, 1) < 0) {
+ if (esxUtil_GetConfigBoolean(conf, present_name, &present, 0, 1) < 0) {
goto failure;
}
/* vmx:startConnected */
- if (esxUtil_GetConfigBoolean(conn, conf, startConnected_name,
- &startConnected, 1, 1) < 0) {
+ if (esxUtil_GetConfigBoolean(conf, startConnected_name, &startConnected,
+ 1, 1) < 0) {
goto failure;
}
}
/* vmx:deviceType -> def:type */
- if (esxUtil_GetConfigString(conn, conf, deviceType_name,
- &deviceType, 1) < 0) {
+ if (esxUtil_GetConfigString(conf, deviceType_name, &deviceType, 1) < 0) {
goto failure;
}
/* vmx:clientDevice */
- if (esxUtil_GetConfigBoolean(conn, conf, clientDevice_name,
- &clientDevice, 0, 1) < 0) {
+ if (esxUtil_GetConfigBoolean(conf, clientDevice_name, &clientDevice, 0,
+ 1) < 0) {
goto failure;
}
}
/* vmx:fileType -> def:type */
- if (esxUtil_GetConfigString(conn, conf, fileType_name, &fileType, 1) < 0) {
+ if (esxUtil_GetConfigString(conf, fileType_name, &fileType, 1) < 0) {
goto failure;
}
/* vmx:fileName -> def:src, def:type */
- if (esxUtil_GetConfigString(conn, conf, fileName_name,
- &fileName, 0) < 0) {
+ if (esxUtil_GetConfigString(conf, fileName_name, &fileName, 0) < 0) {
goto failure;
}
/* vmx:writeThrough -> def:cachemode */
- if (esxUtil_GetConfigBoolean(conn, conf, writeThrough_name,
- &writeThrough, 0, 1) < 0) {
+ if (esxUtil_GetConfigBoolean(conf, writeThrough_name, &writeThrough, 0,
+ 1) < 0) {
goto failure;
}
if (deviceType != NULL) {
if (bus == VIR_DOMAIN_DISK_BUS_SCSI &&
STRCASENEQ(deviceType, "scsi-hardDisk")) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be 'scsi-hardDisk' "
"but found '%s'", deviceType_name, deviceType);
goto failure;
} else if (bus == VIR_DOMAIN_DISK_BUS_IDE &&
STRCASENEQ(deviceType, "ata-hardDisk")) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be 'ata-hardDisk' "
"but found '%s'", deviceType_name, deviceType);
goto failure;
}
(*def)->type = VIR_DOMAIN_DISK_TYPE_FILE;
- (*def)->src = esxVMX_ParseFileName(conn, ctx, fileName,
- datastoreName, directoryName);
+ (*def)->src = esxVMX_ParseFileName(ctx, fileName, datastoreName,
+ directoryName);
(*def)->cachemode = writeThrough ? VIR_DOMAIN_DISK_CACHE_WRITETHRU
: VIR_DOMAIN_DISK_CACHE_DEFAULT;
*/
goto ignore;
} else {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Invalid or not yet handled value '%s' for VMX entry "
"'%s'", fileName, fileName_name);
goto failure;
if (virFileHasSuffix(fileName, ".iso")) {
if (deviceType != NULL) {
if (STRCASENEQ(deviceType, "cdrom-image")) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be 'cdrom-image' "
"but found '%s'", deviceType_name, deviceType);
goto failure;
}
(*def)->type = VIR_DOMAIN_DISK_TYPE_FILE;
- (*def)->src = esxVMX_ParseFileName(conn, ctx, fileName,
- datastoreName, directoryName);
+ (*def)->src = esxVMX_ParseFileName(ctx, fileName, datastoreName,
+ directoryName);
if ((*def)->src == NULL) {
goto failure;
fileName = NULL;
} else {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Invalid or not yet handled value '%s' for VMX entry "
"'%s'", fileName, fileName_name);
goto failure;
if (virFileHasSuffix(fileName, ".flp")) {
if (fileType != NULL) {
if (STRCASENEQ(fileType, "file")) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be 'file' but "
"found '%s'", fileType_name, fileType);
goto failure;
}
(*def)->type = VIR_DOMAIN_DISK_TYPE_FILE;
- (*def)->src = esxVMX_ParseFileName(conn, ctx, fileName,
- datastoreName, directoryName);
+ (*def)->src = esxVMX_ParseFileName(ctx, fileName, datastoreName,
+ directoryName);
if ((*def)->src == NULL) {
goto failure;
fileName = NULL;
} else {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Invalid or not yet handled value '%s' for VMX entry "
"'%s'", fileName, fileName_name);
goto failure;
}
} else {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
- "Unsupported device type '%s'",
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Unsupported device type '%s'",
virDomainDiskDeviceTypeToString(device));
goto failure;
}
int
-esxVMX_ParseEthernet(virConnectPtr conn, virConfPtr conf, int controller,
- virDomainNetDefPtr *def)
+esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
{
int result = 0;
char prefix[48] = "";
char *networkName = NULL;
if (def == NULL || *def != NULL) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
if (controller < 0 || controller > 3) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Ethernet controller index %d out of [0..3] range",
controller);
return -1;
}
if (VIR_ALLOC(*def) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
ESX_BUILD_VMX_NAME(vnet);
/* vmx:present */
- if (esxUtil_GetConfigBoolean(conn, conf, present_name,
- &present, 0, 1) < 0) {
+ if (esxUtil_GetConfigBoolean(conf, present_name, &present, 0, 1) < 0) {
goto failure;
}
/* vmx:startConnected */
- if (esxUtil_GetConfigBoolean(conn, conf, startConnected_name,
- &startConnected, 1, 1) < 0) {
+ if (esxUtil_GetConfigBoolean(conf, startConnected_name, &startConnected, 1,
+ 1) < 0) {
goto failure;
}
}
/* vmx:connectionType -> def:type */
- if (esxUtil_GetConfigString(conn, conf, connectionType_name,
- &connectionType, 1) < 0) {
+ if (esxUtil_GetConfigString(conf, connectionType_name, &connectionType,
+ 1) < 0) {
goto failure;
}
/* vmx:addressType, vmx:generatedAddress, vmx:address -> def:mac */
- if (esxUtil_GetConfigString(conn, conf, addressType_name,
- &addressType, 1) < 0 ||
- esxUtil_GetConfigString(conn, conf, generatedAddress_name,
- &generatedAddress, 1) < 0 ||
- esxUtil_GetConfigString(conn, conf, address_name, &address, 1) < 0) {
+ if (esxUtil_GetConfigString(conf, addressType_name, &addressType, 1) < 0 ||
+ esxUtil_GetConfigString(conf, generatedAddress_name, &generatedAddress,
+ 1) < 0 ||
+ esxUtil_GetConfigString(conf, address_name, &address, 1) < 0) {
goto failure;
}
STRCASEEQ(addressType, "vpx")) {
if (generatedAddress != NULL) {
if (virParseMacAddr(generatedAddress, (*def)->mac) < 0) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be MAC address but "
"found '%s'", generatedAddress_name,
generatedAddress);
} else if (STRCASEEQ(addressType, "static")) {
if (address != NULL) {
if (virParseMacAddr(address, (*def)->mac) < 0) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be MAC address but "
"found '%s'", address_name, address);
goto failure;
}
}
} else {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be 'generated' or 'static' or "
"'vpx' but found '%s'", addressType_name, addressType);
goto failure;
}
/* vmx:virtualDev -> def:model */
- if (esxUtil_GetConfigString(conn, conf, virtualDev_name,
- &virtualDev, 1) < 0) {
+ if (esxUtil_GetConfigString(conf, virtualDev_name, &virtualDev, 1) < 0) {
goto failure;
}
STRCASENEQ(virtualDev, "vmxnet") &&
STRCASENEQ(virtualDev, "vmxnet3") &&
STRCASENEQ(virtualDev, "e1000")) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be 'vlance' or 'vmxnet' or "
"'vmxnet3' or 'e1000' but found '%s'", virtualDev_name,
virtualDev);
if ((connectionType == NULL ||
STRCASEEQ(connectionType, "bridged") ||
STRCASEEQ(connectionType, "custom")) &&
- esxUtil_GetConfigString(conn, conf, networkName_name,
- &networkName, 0) < 0) {
+ esxUtil_GetConfigString(conf, networkName_name, &networkName, 0) < 0) {
goto failure;
}
/* vmx:vnet -> def:data.ifname */
if (connectionType != NULL && STRCASEEQ(connectionType, "custom") &&
- esxUtil_GetConfigString(conn, conf, vnet_name, &vnet, 0) < 0) {
+ esxUtil_GetConfigString(conf, vnet_name, &vnet, 0) < 0) {
goto failure;
}
networkName = NULL;
} else if (STRCASEEQ(connectionType, "hostonly")) {
/* FIXME */
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"No yet handled value '%s' for VMX entry '%s'",
connectionType, connectionType_name);
goto failure;
} else if (STRCASEEQ(connectionType, "nat")) {
/* FIXME */
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"No yet handled value '%s' for VMX entry '%s'",
connectionType, connectionType_name);
goto failure;
networkName = NULL;
vnet = NULL;
} else {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Invalid value '%s' for VMX entry '%s'", connectionType,
connectionType_name);
goto failure;
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 result = 0;
char prefix[48] = "";
char *fileName = NULL;
if (def == NULL || *def != NULL) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
if (port < 0 || port > 3) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Serial port index %d out of [0..3] range", port);
return -1;
}
if (VIR_ALLOC(*def) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
ESX_BUILD_VMX_NAME(fileName);
/* vmx:present */
- if (esxUtil_GetConfigBoolean(conn, conf, present_name,
- &present, 0, 1) < 0) {
+ if (esxUtil_GetConfigBoolean(conf, present_name, &present, 0, 1) < 0) {
goto failure;
}
/* vmx:startConnected */
- if (esxUtil_GetConfigBoolean(conn, conf, startConnected_name,
- &startConnected, 1, 1) < 0) {
+ if (esxUtil_GetConfigBoolean(conf, startConnected_name, &startConnected, 1,
+ 1) < 0) {
goto failure;
}
}
/* vmx:fileType -> def:type */
- if (esxUtil_GetConfigString(conn, conf, fileType_name, &fileType, 0) < 0) {
+ if (esxUtil_GetConfigString(conf, fileType_name, &fileType, 0) < 0) {
goto failure;
}
/* vmx:fileName -> def:data.file.path */
- if (esxUtil_GetConfigString(conn, conf, fileName_name, &fileName, 0) < 0) {
+ if (esxUtil_GetConfigString(conf, fileName_name, &fileName, 0) < 0) {
goto failure;
}
} else if (STRCASEEQ(fileType, "file")) {
(*def)->target.port = port;
(*def)->type = VIR_DOMAIN_CHR_TYPE_FILE;
- (*def)->data.file.path = esxVMX_ParseFileName(conn, ctx, fileName,
+ (*def)->data.file.path = esxVMX_ParseFileName(ctx, fileName,
datastoreName,
directoryName);
fileName = NULL;
} else {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be 'device', 'file' or 'pipe' "
"but found '%s'", fileType_name, fileType);
goto failure;
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)
{
int result = 0;
char prefix[48] = "";
char *fileName = NULL;
if (def == NULL || *def != NULL) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
if (port < 0 || port > 2) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Parallel port index %d out of [0..2] range", port);
return -1;
}
if (VIR_ALLOC(*def) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
ESX_BUILD_VMX_NAME(fileName);
/* vmx:present */
- if (esxUtil_GetConfigBoolean(conn, conf, present_name,
- &present, 0, 1) < 0) {
+ if (esxUtil_GetConfigBoolean(conf, present_name, &present, 0, 1) < 0) {
goto failure;
}
/* vmx:startConnected */
- if (esxUtil_GetConfigBoolean(conn, conf, startConnected_name,
- &startConnected, 1, 1) < 0) {
+ if (esxUtil_GetConfigBoolean(conf, startConnected_name, &startConnected, 1,
+ 1) < 0) {
goto failure;
}
}
/* vmx:fileType -> def:type */
- if (esxUtil_GetConfigString(conn, conf, fileType_name, &fileType, 0) < 0) {
+ if (esxUtil_GetConfigString(conf, fileType_name, &fileType, 0) < 0) {
goto failure;
}
/* vmx:fileName -> def:data.file.path */
- if (esxUtil_GetConfigString(conn, conf, fileName_name, &fileName, 0) < 0) {
+ if (esxUtil_GetConfigString(conf, fileName_name, &fileName, 0) < 0) {
goto failure;
}
} else if (STRCASEEQ(fileType, "file")) {
(*def)->target.port = port;
(*def)->type = VIR_DOMAIN_CHR_TYPE_FILE;
- (*def)->data.file.path = esxVMX_ParseFileName(conn, ctx, fileName,
+ (*def)->data.file.path = esxVMX_ParseFileName(ctx, fileName,
datastoreName,
directoryName);
goto failure;
}
} else {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VMX entry '%s' to be 'device' or 'file' but "
"found '%s'", fileType_name, fileType);
goto failure;
*/
char *
-esxVMX_FormatFileName(virConnectPtr conn, esxVI_Context *ctx ATTRIBUTE_UNUSED,
- const char *src)
+esxVMX_FormatFileName(esxVI_Context *ctx ATTRIBUTE_UNUSED, const char *src)
{
char *datastoreName = NULL;
char *directoryName = NULL;
if (STRPREFIX(src, "[")) {
/* Found potential datastore related path */
- if (esxUtil_ParseDatastoreRelatedPath(conn, src, &datastoreName,
+ if (esxUtil_ParseDatastoreRelatedPath(src, &datastoreName,
&directoryName, &fileName) < 0) {
goto failure;
}
if (directoryName == NULL) {
if (virAsprintf(&absolutePath, "/vmfs/volumes/%s/%s",
datastoreName, fileName) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
} else {
if (virAsprintf(&absolutePath, "/vmfs/volumes/%s/%s/%s",
datastoreName, directoryName, fileName) < 0) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
}
absolutePath = strdup(src);
if (absolutePath == NULL) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
} else {
/* Found relative path, this is not supported */
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Found relative path '%s' in domain XML, this is not "
"supported", src);
goto failure;
char *
-esxVMX_FormatConfig(virConnectPtr conn, esxVI_Context *ctx,
- virDomainDefPtr def, esxVI_APIVersion apiVersion)
+esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
+ esxVI_APIVersion apiVersion)
{
int i;
int sched_cpu_affinity_length;
memset(zero, 0, VIR_UUID_BUFLEN);
if (def->virtType != VIR_DOMAIN_VIRT_VMWARE) { /* FIXME: maybe add VIR_DOMAIN_VIRT_ESX ? */
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting virt type to be '%s' but found '%s'",
virDomainVirtTypeToString(VIR_DOMAIN_VIRT_VMWARE),
virDomainVirtTypeToString(def->virtType));
break;
default:
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting VI API version 2.5 or 4.0");
goto failure;
}
} else if (STRCASEEQ(def->os.arch, "x86_64")) {
virBufferAddLit(&buffer, "guestOS = \"other-64\"\n");
} else {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML attribute 'arch' of entry 'os/type' "
"to be 'i686' or 'x86_64' but found '%s'", def->os.arch);
goto failure;
/* def:maxmem -> vmx:memsize */
if (def->maxmem <= 0 || def->maxmem % 4096 != 0) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML entry 'memory' to be an unsigned "
"integer (multiple of 4096) but found %lld",
(unsigned long long)def->maxmem);
/* def:memory -> vmx:sched.mem.max */
if (def->memory < def->maxmem) {
if (def->memory <= 0 || def->memory % 1024 != 0) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML entry 'currentMemory' to be an "
"unsigned integer (multiple of 1024) but found %lld",
(unsigned long long)def->memory);
/* def:vcpus -> vmx:numvcpus */
if (def->vcpus <= 0 || (def->vcpus % 2 != 0 && def->vcpus != 1)) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML entry 'vcpu' to be an unsigned "
"integer (1 or a multiple of 2) but found %d",
(int)def->vcpus);
}
if (sched_cpu_affinity_length < def->vcpus) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML attribute 'cpuset' of entry "
"'vcpu' to contains at least %d CPU(s)",
(int)def->vcpus);
for (i = 0; i < def->ngraphics; ++i) {
switch (def->graphics[i]->type) {
case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
- if (esxVMX_FormatVNC(conn, def->graphics[i], &buffer) < 0) {
+ if (esxVMX_FormatVNC(def->graphics[i], &buffer) < 0) {
goto failure;
}
break;
default:
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unsupported graphics type '%s'",
virDomainGraphicsTypeToString(def->graphics[i]->type));
goto failure;
int scsi_present[4] = { 0, 0, 0, 0 };
char *scsi_virtualDev[4] = { NULL, NULL, NULL, NULL };
- if (esxVMX_GatherSCSIControllers(conn, def, scsi_virtualDev,
- scsi_present) < 0) {
+ if (esxVMX_GatherSCSIControllers(def, scsi_virtualDev, scsi_present) < 0) {
goto failure;
}
for (i = 0; i < def->ndisks; ++i) {
switch (def->disks[i]->device) {
case VIR_DOMAIN_DISK_DEVICE_DISK:
- if (esxVMX_FormatHardDisk(conn, ctx, def->disks[i], &buffer) < 0) {
+ if (esxVMX_FormatHardDisk(ctx, def->disks[i], &buffer) < 0) {
goto failure;
}
break;
case VIR_DOMAIN_DISK_DEVICE_CDROM:
- if (esxVMX_FormatCDROM(conn, ctx, def->disks[i], &buffer) < 0) {
+ if (esxVMX_FormatCDROM(ctx, def->disks[i], &buffer) < 0) {
goto failure;
}
break;
case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
- if (esxVMX_FormatFloppy(conn, ctx, def->disks[i], &buffer) < 0) {
+ if (esxVMX_FormatFloppy(ctx, def->disks[i], &buffer) < 0) {
goto failure;
}
break;
default:
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unsupported disk device type '%s'",
virDomainDiskDeviceTypeToString(def->disks[i]->device));
goto failure;
/* def:nets */
for (i = 0; i < def->nnets; ++i) {
- if (esxVMX_FormatEthernet(conn, def->nets[i], i, &buffer) < 0) {
+ if (esxVMX_FormatEthernet(def->nets[i], i, &buffer) < 0) {
goto failure;
}
}
/* def:serials */
for (i = 0; i < def->nserials; ++i) {
- if (esxVMX_FormatSerial(conn, ctx, def->serials[i], &buffer) < 0) {
+ if (esxVMX_FormatSerial(ctx, def->serials[i], &buffer) < 0) {
goto failure;
}
}
/* def:parallels */
for (i = 0; i < def->nparallels; ++i) {
- if (esxVMX_FormatParallel(conn, ctx, def->parallels[i], &buffer) < 0) {
+ if (esxVMX_FormatParallel(ctx, def->parallels[i], &buffer) < 0) {
goto failure;
}
}
/* Get final VMX output */
if (virBufferError(&buffer)) {
- virReportOOMError(conn);
+ virReportOOMError(NULL);
goto failure;
}
int
-esxVMX_FormatVNC(virConnectPtr conn, virDomainGraphicsDefPtr def, virBufferPtr buffer)
+esxVMX_FormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer)
{
if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
int
-esxVMX_FormatHardDisk(virConnectPtr conn, esxVI_Context *ctx,
- virDomainDiskDefPtr def, virBufferPtr buffer)
+esxVMX_FormatHardDisk(esxVI_Context *ctx, virDomainDiskDefPtr def,
+ virBufferPtr buffer)
{
int controller, id;
const char *busName = NULL;
char *fileName = NULL;
if (def->device != VIR_DOMAIN_DISK_DEVICE_DISK) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
entryPrefix = "scsi";
deviceTypePrefix = "scsi";
- if (esxVMX_SCSIDiskNameToControllerAndID(conn, def->dst,
- &controller, &id) < 0) {
+ if (esxVMX_SCSIDiskNameToControllerAndID(def->dst, &controller,
+ &id) < 0) {
return -1;
}
} else if (def->bus == VIR_DOMAIN_DISK_BUS_IDE) {
entryPrefix = "ide";
deviceTypePrefix = "ata";
- if (esxVMX_IDEDiskNameToControllerAndID(conn, def->dst,
- &controller, &id) < 0) {
+ if (esxVMX_IDEDiskNameToControllerAndID(def->dst, &controller,
+ &id) < 0) {
return -1;
}
} else {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unsupported bus type '%s' for harddisk",
virDomainDiskBusTypeToString(def->bus));
return -1;
}
if (def->type != VIR_DOMAIN_DISK_TYPE_FILE) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"%s harddisk '%s' has unsupported type '%s', expecting '%s'",
busName, def->dst, virDomainDiskTypeToString(def->type),
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE));
if (def->src != NULL) {
if (! virFileHasSuffix(def->src, ".vmdk")) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Image file for %s harddisk '%s' has unsupported suffix, "
"expecting '.vmdk'", busName, def->dst);
return -1;
}
- fileName = esxVMX_FormatFileName(conn, ctx, def->src);
+ fileName = esxVMX_FormatFileName(ctx, def->src);
if (fileName == NULL) {
return -1;
virBufferVSprintf(buffer, "%s%d:%d.writeThrough = \"true\"\n",
entryPrefix, controller, id);
} else if (def->cachemode != VIR_DOMAIN_DISK_CACHE_DEFAULT) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"%s harddisk '%s' has unsupported cache mode '%s'",
busName, def->dst,
virDomainDiskCacheTypeToString(def->cachemode));
int
-esxVMX_FormatCDROM(virConnectPtr conn, esxVI_Context *ctx,
- virDomainDiskDefPtr def, virBufferPtr buffer)
+esxVMX_FormatCDROM(esxVI_Context *ctx, virDomainDiskDefPtr def,
+ virBufferPtr buffer)
{
int controller, id;
const char *busName = NULL;
char *fileName = NULL;
if (def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
busName = "SCSI";
entryPrefix = "scsi";
- if (esxVMX_SCSIDiskNameToControllerAndID(conn, def->dst,
- &controller, &id) < 0) {
+ if (esxVMX_SCSIDiskNameToControllerAndID(def->dst, &controller,
+ &id) < 0) {
return -1;
}
} else if (def->bus == VIR_DOMAIN_DISK_BUS_IDE) {
busName = "IDE";
entryPrefix = "ide";
- if (esxVMX_IDEDiskNameToControllerAndID(conn, def->dst,
- &controller, &id) < 0) {
+ if (esxVMX_IDEDiskNameToControllerAndID(def->dst, &controller,
+ &id) < 0) {
return -1;
}
} else {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
- "Unsupported bus type '%s' for cdrom",
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Unsupported bus type '%s' for cdrom",
virDomainDiskBusTypeToString(def->bus));
return -1;
}
if (def->src != NULL) {
if (! virFileHasSuffix(def->src, ".iso")) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Image file for %s cdrom '%s' has unsupported "
"suffix, expecting '.iso'", busName, def->dst);
return -1;
}
- fileName = esxVMX_FormatFileName(conn, ctx, def->src);
+ fileName = esxVMX_FormatFileName(ctx, def->src);
if (fileName == NULL) {
return -1;
entryPrefix, controller, id, def->src);
}
} else {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"%s cdrom '%s' has unsupported type '%s', expecting '%s' "
"or '%s'", busName, def->dst,
virDomainDiskTypeToString(def->type),
int
-esxVMX_FormatFloppy(virConnectPtr conn, esxVI_Context *ctx,
- virDomainDiskDefPtr def, virBufferPtr buffer)
+esxVMX_FormatFloppy(esxVI_Context *ctx, virDomainDiskDefPtr def,
+ virBufferPtr buffer)
{
int controller;
char *fileName = NULL;
if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
return -1;
}
- if (esxVMX_FloppyDiskNameToController(conn, def->dst, &controller) < 0) {
+ if (esxVMX_FloppyDiskNameToController(def->dst, &controller) < 0) {
return -1;
}
if (def->src != NULL) {
if (! virFileHasSuffix(def->src, ".flp")) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Image file for floppy '%s' has unsupported suffix, "
"expecting '.flp'", def->dst);
return -1;
}
- fileName = esxVMX_FormatFileName(conn, ctx, def->src);
+ fileName = esxVMX_FormatFileName(ctx, def->src);
if (fileName == NULL) {
return -1;
controller, def->src);
}
} else {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Floppy '%s' has unsupported type '%s', expecting '%s' "
"or '%s'", def->dst,
virDomainDiskTypeToString(def->type),
int
-esxVMX_FormatEthernet(virConnectPtr conn, virDomainNetDefPtr def,
- int controller, virBufferPtr buffer)
+esxVMX_FormatEthernet(virDomainNetDefPtr def, int controller,
+ virBufferPtr buffer)
{
char mac_string[VIR_MAC_STRING_BUFLEN];
unsigned int prefix, suffix;
if (controller < 0 || controller > 3) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Ethernet controller index %d out of [0..3] range",
controller);
return -1;
STRCASENEQ(def->model, "vmxnet") &&
STRCASENEQ(def->model, "vmxnet3") &&
STRCASENEQ(def->model, "e1000")) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML entry 'devices/interfase/model' "
"to be 'vlance' or 'vmxnet' or 'vmxnet3' or 'e1000' but "
"found '%s'", def->model);
break;
default:
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
- "Unsupported net type '%s'",
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Unsupported net type '%s'",
virDomainNetTypeToString(def->type));
return -1;
}
int
-esxVMX_FormatSerial(virConnectPtr conn, esxVI_Context *ctx,
- virDomainChrDefPtr def, virBufferPtr buffer)
+esxVMX_FormatSerial(esxVI_Context *ctx, virDomainChrDefPtr def,
+ virBufferPtr buffer)
{
char *fileName = NULL;
if (def->target.port < 0 || def->target.port > 3) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Serial port index %d out of [0..3] range", def->target.port);
return -1;
}
if (def->data.file.path == NULL) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML attribute 'path' of entry "
"'devices/serial/source' to be present");
return -1;
virBufferVSprintf(buffer, "serial%d.fileType = \"file\"\n",
def->target.port);
- fileName = esxVMX_FormatFileName(conn, ctx, def->data.file.path);
+ fileName = esxVMX_FormatFileName(ctx, def->data.file.path);
if (fileName == NULL) {
return -1;
break;
default:
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unsupported character device type '%s'",
virDomainChrTypeToString(def->type));
return -1;
int
-esxVMX_FormatParallel(virConnectPtr conn, esxVI_Context *ctx,
- virDomainChrDefPtr def, virBufferPtr buffer)
+esxVMX_FormatParallel(esxVI_Context *ctx, virDomainChrDefPtr def,
+ virBufferPtr buffer)
{
char *fileName = NULL;
if (def->target.port < 0 || def->target.port > 2) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
- "Parallel port index %d out of [0..2] range", def->target.port);
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
+ "Parallel port index %d out of [0..2] range",
+ def->target.port);
return -1;
}
if (def->data.file.path == NULL) {
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting domain XML attribute 'path' of entry "
"'devices/parallel/source' to be present");
return -1;
}
- virBufferVSprintf(buffer, "parallel%d.present = \"true\"\n", def->target.port);
+ virBufferVSprintf(buffer, "parallel%d.present = \"true\"\n",
+ def->target.port);
/* def:type -> vmx:fileType and def:data.file.path -> vmx:fileName */
switch (def->type) {
virBufferVSprintf(buffer, "parallel%d.fileType = \"file\"\n",
def->target.port);
- fileName = esxVMX_FormatFileName(conn, ctx, def->data.file.path);
+ fileName = esxVMX_FormatFileName(ctx, def->data.file.path);
if (fileName == NULL) {
return -1;
break;
default:
- ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unsupported character device type '%s'",
virDomainChrTypeToString(def->type));
return -1;
#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);
*/
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);
*/
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__ */
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;
goto failure;
}
- def = esxVMX_ParseConfig(NULL, NULL, vmxData, "datastore", "directory",
+ def = esxVMX_ParseConfig(NULL, vmxData, "datastore", "directory",
apiVersion);
if (def == NULL) {
goto failure;
}
- formatted = esxVMX_FormatConfig(NULL, NULL, def, apiVersion);
+ formatted = esxVMX_FormatConfig(NULL, def, apiVersion);
if (formatted == NULL) {
goto failure;