createSpec.setDistroVendor(stack.getVendor());
createSpec.setDistroVersion(stack.getFullVersion());
// create auto rps if vc cluster/rp is specified
createAutoRps(createSpec);
ClusterCreate clusterSpec =
ClusterSpecFactory.getCustomizedSpec(createSpec, softMgr.getType());
createSpec.verifyClusterNameLength();
clusterSpec.validateNodeGroupNames();
//Check the cpu, memory max configuration according vm hardware version
if (clusterSpec != null && clusterSpec.getNodeGroups() != null) {
for (NodeGroupCreate ng : clusterSpec.getNodeGroups()) {
String templateVmId = clusteringService.getTemplateVmId();
if (templateVmId != null) {
VcResourceUtils.checkVmMaxConfiguration(templateVmId,
ng.getCpuNum() == null ? 0 : ng.getCpuNum(),
ng.getMemCapacityMB() == null ? 0 : ng.getMemCapacityMB());
}
}
}
String name = clusterSpec.getName();
logger.info("ClusteringService, creating cluster " + name);
List<String> dsNames = getUsedDS(clusterSpec.getDsNames());
if (dsNames.isEmpty()) {
throw ClusterConfigException.NO_DATASTORE_ADDED();
}
List<VcCluster> vcClusters = getUsedVcClusters(clusterSpec.getRpNames());
if (vcClusters == null || vcClusters.isEmpty()) {
throw ClusterConfigException.NO_RESOURCE_POOL_ADDED();
}
// validate accessibility
validateDatastore(dsNames, vcClusters);