if (esxVI_String_AppendValueToList(conn, &propertyNameList,
"hardware.cpuFeature") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, priv->host->hostFolder,
- "HostSystem", propertyNameList,
- esxVI_Boolean_True, &hostSystem) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host,
+ priv->host->hostFolder,
+ "HostSystem", propertyNameList,
+ esxVI_Boolean_True, &hostSystem) < 0) {
goto failure;
}
if (esxVI_String_AppendValueToList(conn, &propertyNameList,
"capability.vmotionSupported") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, priv->host->hostFolder,
- "HostSystem", propertyNameList,
- esxVI_Boolean_True, &hostSystem) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host,
+ priv->host->hostFolder,
+ "HostSystem", propertyNameList,
+ esxVI_Boolean_True, &hostSystem) < 0) {
goto failure;
}
(conn, &propertyNameList,
"config.network.dnsConfig.hostName\0"
"config.network.dnsConfig.domainName\0") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, priv->host->hostFolder,
- "HostSystem", propertyNameList,
- esxVI_Boolean_True, &hostSystem) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host,
+ priv->host->hostFolder,
+ "HostSystem", propertyNameList,
+ esxVI_Boolean_True, &hostSystem) < 0) {
goto failure;
}
"hardware.memorySize\0"
"hardware.numaInfo.numNodes\0"
"summary.hardware.cpuModel\0") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, priv->host->hostFolder,
- "HostSystem", propertyNameList,
- esxVI_Boolean_True, &hostSystem) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host,
+ priv->host->hostFolder,
+ "HostSystem", propertyNameList,
+ esxVI_Boolean_True, &hostSystem) < 0) {
goto failure;
}
if (esxVI_String_AppendValueToList(conn, &propertyNameList,
"runtime.powerState") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, priv->host->vmFolder,
- "VirtualMachine", propertyNameList,
- esxVI_Boolean_True, &virtualMachineList) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host, priv->host->vmFolder,
+ "VirtualMachine", propertyNameList,
+ esxVI_Boolean_True,
+ &virtualMachineList) < 0) {
goto failure;
}
return -1;
}
- return esxVI_GetNumberOfDomainsByPowerState
+ return esxVI_LookupNumberOfDomainsByPowerState
(conn, priv->host, esxVI_VirtualMachinePowerState_PoweredOn,
esxVI_Boolean_False);
}
"name\0"
"runtime.powerState\0"
"config.uuid\0") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, priv->host->vmFolder,
- "VirtualMachine", propertyNameList,
- esxVI_Boolean_True, &virtualMachineList) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host, priv->host->vmFolder,
+ "VirtualMachine", propertyNameList,
+ esxVI_Boolean_True,
+ &virtualMachineList) < 0) {
goto failure;
}
"name\0"
"runtime.powerState\0"
"config.uuid\0") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, priv->host->vmFolder,
- "VirtualMachine", propertyNameList,
- esxVI_Boolean_True, &virtualMachineList) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host, priv->host->vmFolder,
+ "VirtualMachine", propertyNameList,
+ esxVI_Boolean_True,
+ &virtualMachineList) < 0) {
goto failure;
}
"name\0"
"runtime.powerState\0"
"config.uuid\0") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, priv->host->vmFolder,
- "VirtualMachine", propertyNameList,
- esxVI_Boolean_True, &virtualMachineList) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host, priv->host->vmFolder,
+ "VirtualMachine", propertyNameList,
+ esxVI_Boolean_True,
+ &virtualMachineList) < 0) {
goto failure;
}
if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
"capability.maxSupportedVcpus") < 0 ||
- esxVI_GetObjectContent(domain->conn, priv->host,
- priv->host->hostFolder, "HostSystem",
- propertyNameList, esxVI_Boolean_True,
- &hostSystem) < 0) {
+ esxVI_LookupObjectContentByType(domain->conn, priv->host,
+ priv->host->hostFolder, "HostSystem",
+ propertyNameList, esxVI_Boolean_True,
+ &hostSystem) < 0) {
goto failure;
}
if (esxVI_String_AppendValueListToList(conn, &propertyNameList,
"name\0"
"runtime.powerState\0") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, priv->host->vmFolder,
- "VirtualMachine", propertyNameList,
- esxVI_Boolean_True, &virtualMachineList) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host, priv->host->vmFolder,
+ "VirtualMachine", propertyNameList,
+ esxVI_Boolean_True,
+ &virtualMachineList) < 0) {
goto failure;
}
return -1;
}
- return esxVI_GetNumberOfDomainsByPowerState
+ return esxVI_LookupNumberOfDomainsByPowerState
(conn, priv->host, esxVI_VirtualMachinePowerState_PoweredOn,
esxVI_Boolean_True);
}
goto failure;
}
- if (esxVI_GetResourcePool(conn, priv->host, hostSystem,
- &resourcePool) < 0) {
+ if (esxVI_LookupResourcePoolByHostSystem(conn, priv->host, hostSystem,
+ &resourcePool) < 0) {
goto failure;
}
goto failure;
}
- if (esxVI_GetResourcePool(domain->conn, priv->vCenter, hostSystem,
- &resourcePool) < 0) {
+ if (esxVI_LookupResourcePoolByHostSystem(domain->conn, priv->vCenter,
+ hostSystem, &resourcePool) < 0) {
goto failure;
}
goto failure;
}
- if (esxVI_GetResourcePool(conn, priv->host, hostSystem,
- &managedObjectReference) < 0) {
+ if (esxVI_LookupResourcePoolByHostSystem(conn, priv->host, hostSystem,
+ &managedObjectReference) < 0) {
goto failure;
}
/* Get memory usage of resource pool */
if (esxVI_String_AppendValueToList(conn, &propertyNameList,
"runtime.memory") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, managedObjectReference,
- "ResourcePool", propertyNameList,
- esxVI_Boolean_False, &resourcePool) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host,
+ managedObjectReference,
+ "ResourcePool", propertyNameList,
+ esxVI_Boolean_False,
+ &resourcePool) < 0) {
goto failure;
}
}
/* Get pointer to Datacenter for later use */
- if (esxVI_GetObjectContent(conn, ctx, ctx->service->rootFolder,
- "Datacenter", propertyNameList,
- esxVI_Boolean_True, &datacenterList) < 0) {
+ if (esxVI_LookupObjectContentByType(conn, ctx, ctx->service->rootFolder,
+ "Datacenter", propertyNameList,
+ esxVI_Boolean_True,
+ &datacenterList) < 0) {
goto failure;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Utility and Convenience Functions
+ *
+ * Function naming scheme:
+ * - 'lookup' functions query the ESX or vCenter for information
+ * - 'get' functions get information from a local object
*/
int
#else
if (esxVI_String_AppendValueToList(conn, &propertyNameList,
"currentSession") < 0 ||
- esxVI_GetObjectContent(conn, ctx, ctx->service->sessionManager,
- "SessionManager", propertyNameList,
- esxVI_Boolean_False, &sessionManager) < 0) {
+ esxVI_LookupObjectContentByType(conn, ctx,
+ ctx->service->sessionManager,
+ "SessionManager", propertyNameList,
+ esxVI_Boolean_False,
+ &sessionManager) < 0) {
goto failure;
}
int
-esxVI_GetObjectContent(virConnectPtr conn, esxVI_Context *ctx,
- esxVI_ManagedObjectReference *root,
- const char *type, esxVI_String *propertyNameList,
- esxVI_Boolean recurse,
- esxVI_ObjectContent **objectContentList)
+esxVI_LookupObjectContentByType(virConnectPtr conn, esxVI_Context *ctx,
+ esxVI_ManagedObjectReference *root,
+ const char *type,
+ esxVI_String *propertyNameList,
+ esxVI_Boolean recurse,
+ esxVI_ObjectContent **objectContentList)
{
int result = 0;
esxVI_ObjectSpec *objectSpec = NULL;
int
-esxVI_GetNumberOfDomainsByPowerState(virConnectPtr conn, esxVI_Context *ctx,
- esxVI_VirtualMachinePowerState powerState,
- esxVI_Boolean inverse)
+esxVI_LookupNumberOfDomainsByPowerState(virConnectPtr conn, esxVI_Context *ctx,
+ esxVI_VirtualMachinePowerState powerState,
+ esxVI_Boolean inverse)
{
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *virtualMachineList = NULL;
if (esxVI_String_AppendValueToList(conn, &propertyNameList,
"runtime.powerState") < 0 ||
- esxVI_GetObjectContent(conn, ctx, ctx->vmFolder, "VirtualMachine",
- propertyNameList, esxVI_Boolean_True,
- &virtualMachineList) < 0) {
+ esxVI_LookupObjectContentByType(conn, ctx, ctx->vmFolder,
+ "VirtualMachine", propertyNameList,
+ esxVI_Boolean_True,
+ &virtualMachineList) < 0) {
goto failure;
}
-int esxVI_GetResourcePool(virConnectPtr conn, esxVI_Context *ctx,
- esxVI_ObjectContent *hostSystem,
- esxVI_ManagedObjectReference **resourcePool)
+int
+esxVI_LookupResourcePoolByHostSystem
+ (virConnectPtr conn, esxVI_Context *ctx, esxVI_ObjectContent *hostSystem,
+ esxVI_ManagedObjectReference **resourcePool)
{
int result = 0;
esxVI_String *propertyNameList = NULL;
if (esxVI_String_AppendValueToList(conn, &propertyNameList,
"resourcePool") < 0 ||
- esxVI_GetObjectContent(conn, ctx, managedObjectReference,
- "ComputeResource", propertyNameList,
- esxVI_Boolean_False, &computeResource) < 0) {
+ esxVI_LookupObjectContentByType(conn, ctx, managedObjectReference,
+ "ComputeResource", propertyNameList,
+ esxVI_Boolean_False,
+ &computeResource) < 0) {
goto failure;
}
goto failure;
}
- if (esxVI_GetObjectContent(conn, ctx, managedObjectReference,
- "HostSystem", propertyNameList,
- esxVI_Boolean_False, hostSystem) < 0) {
+ if (esxVI_LookupObjectContentByType(conn, ctx, managedObjectReference,
+ "HostSystem", propertyNameList,
+ esxVI_Boolean_False, hostSystem) < 0) {
goto failure;
}
}
}
- if (esxVI_GetObjectContent(conn, ctx, managedObjectReference,
- "VirtualMachine", propertyNameList,
- esxVI_Boolean_False, virtualMachine) < 0) {
+ if (esxVI_LookupObjectContentByType(conn, ctx, managedObjectReference,
+ "VirtualMachine", propertyNameList,
+ esxVI_Boolean_False,
+ virtualMachine) < 0) {
goto failure;
}
goto failure;
}
- if (esxVI_GetObjectContent(conn, ctx, ctx->datacenter,
- "Datastore", completePropertyNameList,
- esxVI_Boolean_True, &datastoreList) < 0) {
+ if (esxVI_LookupObjectContentByType(conn, ctx, ctx->datacenter,
+ "Datastore", completePropertyNameList,
+ esxVI_Boolean_True,
+ &datastoreList) < 0) {
goto failure;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Utility and Convenience Functions
+ *
+ * Function naming scheme:
+ * - 'lookup' functions query the ESX or vCenter for information
+ * - 'get' functions get information from a local object
*/
-int
-esxVI_Alloc(virConnectPtr conn, void **ptrptr, size_t size);
+int esxVI_Alloc(virConnectPtr conn, void **ptrptr, size_t size);
-int
-esxVI_CheckSerializationNecessity(virConnectPtr conn, const char *element,
- esxVI_Boolean required);
+int esxVI_CheckSerializationNecessity(virConnectPtr conn, 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);
+
int esxVI_BuildFullTraversalSpecList
(virConnectPtr conn, esxVI_SelectionSpec **fullTraversalSpecList);
int esxVI_EnsureSession(virConnectPtr conn, esxVI_Context *ctx);
-int esxVI_GetObjectContent(virConnectPtr conn, esxVI_Context *ctx,
- esxVI_ManagedObjectReference *root,
- const char *type, esxVI_String *propertyNameList,
- esxVI_Boolean recurse,
- esxVI_ObjectContent **objectContentList);
+int esxVI_LookupObjectContentByType(virConnectPtr conn, esxVI_Context *ctx,
+ esxVI_ManagedObjectReference *root,
+ const char *type,
+ esxVI_String *propertyNameList,
+ esxVI_Boolean recurse,
+ esxVI_ObjectContent **objectContentList);
int esxVI_GetManagedEntityStatus
(virConnectPtr conn, esxVI_ObjectContent *objectContent,
(virConnectPtr conn, esxVI_ObjectContent *virtualMachine,
esxVI_VirtualMachinePowerState *powerState);
-int esxVI_GetNumberOfDomainsByPowerState
+int esxVI_LookupNumberOfDomainsByPowerState
(virConnectPtr conn, esxVI_Context *ctx,
esxVI_VirtualMachinePowerState powerState, esxVI_Boolean inverse);
esxVI_ObjectContent *virtualMachine,
int *id, char **name, unsigned char *uuid);
-int esxVI_GetResourcePool(virConnectPtr conn, esxVI_Context *ctx,
- esxVI_ObjectContent *hostSystem,
- esxVI_ManagedObjectReference **resourcePool);
+int esxVI_LookupResourcePoolByHostSystem
+ (virConnectPtr conn, esxVI_Context *ctx, esxVI_ObjectContent *hostSystem,
+ esxVI_ManagedObjectReference **resourcePool);
int esxVI_LookupHostSystemByIp(virConnectPtr conn, esxVI_Context *ctx,
const char *ipAddress,