+ 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;
String vcRPName =
CommonUtil.isBlank(resourcePoolName) ? clusterRpName
: resourcePoolName + "/" + clusterRpName;
parentVcResourcePool =
VcResourceUtils.findRPInVCCluster(vcClusterName, vcRPName);
if (parentVcResourcePool == null) {
String errorMsg =
"Cannot find the vCenter Server resource pool "
+ vcRPName
+ (CommonUtil.isBlank(resourcePoolName) ? ""
: " in the vCenter Server resource pool "
+ resourcePoolName) + ".";
logger.error(errorMsg);
throw ClusteringServiceException
.CANNOT_FIND_SUB_VC_RESOURCE_POOL(vcRPName,
resourcePoolName);
}
String rpPath =
"/" + vcClusterName + "/" + resourcePoolName + "/" + uuid;
long rpHashCode = rpPath.hashCode();
for (NodeGroupCreate nodeGroup : rpNodeGroupsMap.get(rpHashCode)) {
AuAssert
.check(nodeGroup != null,
"create node group resource pool failed: node group cannot be null !");
if (nodeGroup.getName().length() > 80) {
throw ClusteringServiceException
.GROUP_NAME_TOO_LONG(nodeGroup.getName());
}
CreateResourcePoolSP nodeGroupSP =
new CreateResourcePoolSP(parentVcResourcePool,
nodeGroup.getName(), nodeGroup, softManager);
nodeGroupSPs[i] = nodeGroupSP;
i++;
}
}