use of org.ovirt.engine.ui.uicompat.PreparingEnlistment in project ovirt-engine by oVirt.
the class AddStorageDomainRM method prepare5.
private void prepare5() {
PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment;
EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
HostListModel<?> model = enlistmentContext.getModel();
ConfigureLocalStorageModel configureModel = (ConfigureLocalStorageModel) model.getWindow();
ActionReturnValue returnValue = context.addStorageServerConnectionReturnValue;
if (returnValue == null || !returnValue.getSucceeded()) {
// Don't rollback.
context.enlistment = null;
enlistment.done();
} else {
StorageDomainStatic storage = new StorageDomainStatic();
storage.setStorageType(StorageType.LOCALFS);
storage.setStorageDomainType(StorageDomainType.Data);
storage.setStorageName(configureModel.getFormattedStorageName().getEntity());
storage.setStorage((String) returnValue.getActionReturnValue());
StorageDomainManagementParameter parameters = new StorageDomainManagementParameter(storage);
parameters.setVdsId(context.host.getId());
parameters.setCorrelationId(getCorrelationId());
Frontend.getInstance().runAction(ActionType.AddLocalStorageDomain, parameters, result -> {
ActionReturnValue returnValue1 = result.getReturnValue();
context.addLocalStorageDomainReturnValue = returnValue1;
prepare6();
});
}
}
use of org.ovirt.engine.ui.uicompat.PreparingEnlistment in project ovirt-engine by oVirt.
the class ChangeHostClusterRM method prepare2.
public void prepare2() {
PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment;
ActionReturnValue returnValue = context.changeVDSClusterReturnValue;
context.enlistment = null;
if (returnValue != null && returnValue.getSucceeded()) {
enlistment.prepared();
} else {
enlistment.forceRollback();
}
}
use of org.ovirt.engine.ui.uicompat.PreparingEnlistment in project ovirt-engine by oVirt.
the class ChangeHostClusterRM method prepare1.
public void prepare1() {
PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment;
EnlistmentContext enlistmentContext = (EnlistmentContext) context.enlistment.getContext();
HostListModel<?> model = enlistmentContext.getModel();
VDS host = model.getSelectedItem();
if (!enlistmentContext.getClusterId().equals(host.getClusterId())) {
enlistmentContext.setOldClusterId(host.getClusterId());
ChangeVDSClusterParameters parameters = new ChangeVDSClusterParameters(enlistmentContext.getClusterId(), host.getId());
parameters.setCorrelationId(getCorrelationId());
Frontend.getInstance().runAction(ActionType.ChangeVDSCluster, parameters, result -> {
ActionReturnValue returnValue = result.getReturnValue();
context.changeVDSClusterReturnValue = returnValue;
prepare2();
});
} else {
context.enlistment = null;
enlistment.prepared();
}
}
use of org.ovirt.engine.ui.uicompat.PreparingEnlistment in project ovirt-engine by oVirt.
the class AddClusterRM method prepare3.
private void prepare3() {
PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment;
EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
ActionReturnValue returnValue = context.addClusterReturnValue;
context.enlistment = null;
if (returnValue != null && returnValue.getSucceeded()) {
enlistmentContext.setClusterId((Guid) returnValue.getActionReturnValue());
context.enlistment = null;
enlistment.prepared();
} else {
enlistment.forceRollback();
}
}
use of org.ovirt.engine.ui.uicompat.PreparingEnlistment 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