mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-29 20:11:16 +00:00
esx: split datastorePoolType helper
Move the detection of the type of a vmfs pool out of esxLookupVMFSStoragePoolType in an own helper. This way it can be used also in other functions. Signed-off-by: Pino Toscano <ptoscano@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
730a5bcf9f
commit
818bc30a71
@ -54,26 +54,12 @@ verify(VIR_CRYPTO_HASH_SIZE_MD5 == VIR_UUID_BUFLEN);
|
||||
|
||||
|
||||
static int
|
||||
esxLookupVMFSStoragePoolType(esxVI_Context *ctx, const char *poolName,
|
||||
int *poolType)
|
||||
datastorePoolType(esxVI_ObjectContent *datastore, int *poolType)
|
||||
{
|
||||
int result = -1;
|
||||
esxVI_String *propertyNameList = NULL;
|
||||
esxVI_ObjectContent *datastore = NULL;
|
||||
esxVI_DynamicProperty *dynamicProperty = NULL;
|
||||
esxVI_DatastoreInfo *datastoreInfo = NULL;
|
||||
|
||||
if (esxVI_String_AppendValueToList(&propertyNameList, "info") < 0 ||
|
||||
esxVI_LookupDatastoreByName(ctx, poolName, propertyNameList, &datastore,
|
||||
esxVI_Occurrence_OptionalItem) < 0) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!datastore) {
|
||||
/* Not found, let the base storage driver handle error reporting */
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
for (dynamicProperty = datastore->propSet; dynamicProperty;
|
||||
dynamicProperty = dynamicProperty->_next) {
|
||||
if (STREQ(dynamicProperty->name, "info")) {
|
||||
@ -100,10 +86,41 @@ esxLookupVMFSStoragePoolType(esxVI_Context *ctx, const char *poolName,
|
||||
|
||||
result = 0;
|
||||
|
||||
cleanup:
|
||||
esxVI_DatastoreInfo_Free(&datastoreInfo);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
esxLookupVMFSStoragePoolType(esxVI_Context *ctx, const char *poolName,
|
||||
int *poolType)
|
||||
{
|
||||
int result = -1;
|
||||
esxVI_String *propertyNameList = NULL;
|
||||
esxVI_ObjectContent *datastore = NULL;
|
||||
|
||||
if (esxVI_String_AppendValueToList(&propertyNameList, "info") < 0 ||
|
||||
esxVI_LookupDatastoreByName(ctx, poolName, propertyNameList, &datastore,
|
||||
esxVI_Occurrence_OptionalItem) < 0) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!datastore) {
|
||||
/* Not found, let the base storage driver handle error reporting */
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (datastorePoolType(datastore, poolType) < 0)
|
||||
goto cleanup;
|
||||
|
||||
result = 0;
|
||||
|
||||
cleanup:
|
||||
esxVI_String_Free(&propertyNameList);
|
||||
esxVI_ObjectContent_Free(&datastore);
|
||||
esxVI_DatastoreInfo_Free(&datastoreInfo);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user