提交 8cd4ca45 编写于 作者: M Matthias Bolte

esx: Fix cluster resource lookup when connecting to a vCenter

Connecting to a ESX(i) server that is part of a cluster failed
when the connection also involved a vCenter.

Accept ClusterComputeResource type in addition to ComputeResource
type in the object lookup function.

Reported by Guillaume Le Louët.
上级 831aaf4a
...@@ -538,7 +538,7 @@ esxVI_Context_LookupObjectsByPath(esxVI_Context *ctx, ...@@ -538,7 +538,7 @@ esxVI_Context_LookupObjectsByPath(esxVI_Context *ctx,
goto cleanup; goto cleanup;
} }
/* Lookup ComputeResource */ /* Lookup (Cluster)ComputeResource */
esxVI_String_Free(&propertyNameList); esxVI_String_Free(&propertyNameList);
if (esxVI_String_AppendValueListToList(&propertyNameList, if (esxVI_String_AppendValueListToList(&propertyNameList,
...@@ -699,7 +699,7 @@ esxVI_Context_LookupObjectsByHostSystemIp(esxVI_Context *ctx, ...@@ -699,7 +699,7 @@ esxVI_Context_LookupObjectsByHostSystemIp(esxVI_Context *ctx,
goto cleanup; goto cleanup;
} }
/* Lookup ComputeResource */ /* Lookup (Cluster)ComputeResource */
esxVI_String_Free(&propertyNameList); esxVI_String_Free(&propertyNameList);
if (esxVI_String_AppendValueListToList(&propertyNameList, if (esxVI_String_AppendValueListToList(&propertyNameList,
...@@ -1654,7 +1654,8 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx, ...@@ -1654,7 +1654,8 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx,
if (STRNEQ(root->type, type)) { if (STRNEQ(root->type, type)) {
if (STREQ(root->type, "Folder")) { if (STREQ(root->type, "Folder")) {
if (STREQ(type, "Datacenter") || STREQ(type, "ComputeResource")) { if (STREQ(type, "Datacenter") || STREQ(type, "ComputeResource") ||
STREQ(type, "ClusterComputeResource")) {
objectSpec->selectSet = ctx->selectSet_folderToChildEntity; objectSpec->selectSet = ctx->selectSet_folderToChildEntity;
} else { } else {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
...@@ -1662,7 +1663,8 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx, ...@@ -1662,7 +1663,8 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx,
type, root->type); type, root->type);
goto cleanup; goto cleanup;
} }
} else if (STREQ(root->type, "ComputeResource")) { } else if (STREQ(root->type, "ComputeResource") ||
STREQ(root->type, "ClusterComputeResource")) {
if (STREQ(type, "HostSystem")) { if (STREQ(type, "HostSystem")) {
objectSpec->selectSet = ctx->selectSet_computeResourceToHost; objectSpec->selectSet = ctx->selectSet_computeResourceToHost;
} else if (STREQ(type, "Datacenter")) { } else if (STREQ(type, "Datacenter")) {
...@@ -1674,7 +1676,8 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx, ...@@ -1674,7 +1676,8 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx,
goto cleanup; goto cleanup;
} }
} else if (STREQ(root->type, "HostSystem")) { } else if (STREQ(root->type, "HostSystem")) {
if (STREQ(type, "ComputeResource")) { if (STREQ(type, "ComputeResource") ||
STREQ(type, "ClusterComputeResource")) {
objectSpec->selectSet = ctx->selectSet_hostSystemToParent; objectSpec->selectSet = ctx->selectSet_hostSystemToParent;
} else if (STREQ(type, "VirtualMachine")) { } else if (STREQ(type, "VirtualMachine")) {
objectSpec->selectSet = ctx->selectSet_hostSystemToVm; objectSpec->selectSet = ctx->selectSet_hostSystemToVm;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册