Callable<Void>[] clusterSPs = new Callable[resourcePoolNameCount];
int i = 0;
for (Entry<String, List<String>> vcClusterRpNamesEntry : vcClusterRpNamesMap
.entrySet()) {
String vcClusterName = vcClusterRpNamesEntry.getKey();
VcCluster vcCluster = VcResourceUtils.findVcCluster(vcClusterName);
if (vcCluster == null) {
String errorMsg =
"Cannot find the vCenter Server cluster " + vcClusterName
+ ".";
logger.error(errorMsg);
throw ClusteringServiceException
.CANNOT_FIND_VC_CLUSTER(vcClusterName);
}
List<String> resourcePoolNames = vcClusterRpNamesEntry.getValue();
for (String resourcePoolName : resourcePoolNames) {
VcResourcePool parentVcResourcePool =
VcResourceUtils.findRPInVCCluster(vcClusterName,
resourcePoolName);
if (parentVcResourcePool == null) {
String errorMsg =
"Cannot find the vCenter Server resource pool "
+ resourcePoolName + ".";
logger.error(errorMsg);
throw ClusteringServiceException
.CANNOT_FIND_VC_RESOURCE_POOL(resourcePoolName);
}
CreateResourcePoolSP clusterSP =
new CreateResourcePoolSP(parentVcResourcePool,
clusterRpName);
clusterSPs[i] = clusterSP;
i++;
}
}
// execute store procedures to create cluster resource pool(s)
logger.info("ClusteringService, start to create cluster resource pool(s).");
executeResourcePoolStoreProcedures(clusterSPs, "cluster", clusterName);
/*
* define node group store procedures of resource pool(s)
*/
int nodeGroupNameCount = countResult.get("nodeGroupNameCount");
Callable<Void>[] nodeGroupSPs = new Callable[nodeGroupNameCount];
i = 0;
for (Entry<String, List<String>> vcClusterRpNamesEntry : vcClusterRpNamesMap
.entrySet()) {
String vcClusterName = vcClusterRpNamesEntry.getKey();
VcCluster vcCluster = VcResourceUtils.findVcCluster(vcClusterName);
if (vcCluster == null) {
String errorMsg =
"Cannot find the vCenter Server cluster " + vcClusterName
+ ".";
logger.error(errorMsg);
throw ClusteringServiceException
.CANNOT_FIND_VC_CLUSTER(vcClusterName);
}
if (!vcCluster.getConfig().getDRSEnabled()) {
continue;
}
List<String> resourcePoolNames = vcClusterRpNamesEntry.getValue();
for (String resourcePoolName : resourcePoolNames) {
VcResourcePool parentVcResourcePool = null;