use of org.ovirt.engine.core.common.action.ClusterOperationParameters in project ovirt-engine by oVirt.
the class AddClusterRM method prepare2.
public void prepare2() {
PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment;
EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
HostListModel<?> model = enlistmentContext.getModel();
ConfigureLocalStorageModel configureModel = (ConfigureLocalStorageModel) model.getWindow();
Cluster candidate = configureModel.getCandidateCluster();
ClusterModel clusterModel = configureModel.getCluster();
String clusterName = clusterModel.getName().getEntity();
if (candidate == null || !Objects.equals(candidate.getName(), clusterName)) {
// Try to find existing cluster with the specified name.
Cluster cluster = context.clusterFoundByName;
if (cluster != null) {
enlistmentContext.setClusterId(cluster.getId());
context.enlistment = null;
enlistment.prepared();
} else {
Version version = clusterModel.getVersion().getSelectedItem();
cluster = new Cluster();
cluster.setName(clusterName);
cluster.setDescription(clusterModel.getDescription().getEntity());
cluster.setStoragePoolId(enlistmentContext.getDataCenterId());
cluster.setCpuName(clusterModel.getCPU().getSelectedItem().getCpuName());
cluster.setMaxVdsMemoryOverCommit(clusterModel.getMemoryOverCommit());
cluster.setCountThreadsAsCores(Boolean.TRUE.equals(clusterModel.getVersionSupportsCpuThreads().getEntity()) && Boolean.TRUE.equals(clusterModel.getCountThreadsAsCores().getEntity()));
cluster.setTransparentHugepages(true);
cluster.setCompatibilityVersion(version);
cluster.setMigrateOnError(clusterModel.getMigrateOnErrorOption());
ClusterOperationParameters parameters = new ManagementNetworkOnClusterOperationParameters(cluster);
parameters.setCorrelationId(getCorrelationId());
Frontend.getInstance().runAction(ActionType.AddCluster, parameters, result -> {
ActionReturnValue returnValue = result.getReturnValue();
context.addClusterReturnValue = returnValue;
prepare3();
});
}
} else {
enlistmentContext.setClusterId(configureModel.getCluster().getClusterId());
context.enlistment = null;
enlistment.prepared();
}
}
Aggregations