use of org.ovirt.engine.ui.uicommonweb.models.datacenters.DataCenterModel in project ovirt-engine by oVirt.
the class AddDataCenterRM method prepare2.
private void prepare2() {
PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment;
EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
HostListModel<?> model = enlistmentContext.getModel();
ConfigureLocalStorageModel configureModel = (ConfigureLocalStorageModel) model.getWindow();
StoragePool candidate = configureModel.getCandidateDataCenter();
DataCenterModel dataCenterModel = configureModel.getDataCenter();
String dataCenterName = dataCenterModel.getName().getEntity();
if (candidate == null || !Objects.equals(candidate.getName(), dataCenterName)) {
// Try to find existing data center with the specified name.
StoragePool dataCenter = context.dataCenterFoundByName;
if (dataCenter != null) {
enlistmentContext.setDataCenterId(dataCenter.getId());
context.enlistment = null;
enlistment.prepared();
} else {
dataCenter = new StoragePool();
dataCenter.setName(dataCenterName);
dataCenter.setdescription(dataCenterModel.getDescription().getEntity());
dataCenter.setComment(dataCenterModel.getComment().getEntity());
dataCenter.setIsLocal(dataCenterModel.getStoragePoolType().getSelectedItem());
dataCenter.setCompatibilityVersion(dataCenterModel.getVersion().getSelectedItem());
StoragePoolManagementParameter parameters = new StoragePoolManagementParameter(dataCenter);
parameters.setCorrelationId(getCorrelationId());
Frontend.getInstance().runAction(ActionType.AddEmptyStoragePool, parameters, result -> {
context.addDataCenterReturnValue = result.getReturnValue();
prepare3();
});
}
} else {
enlistmentContext.setDataCenterId(configureModel.getDataCenter().getDataCenterId());
context.enlistment = null;
enlistment.prepared();
}
}
use of org.ovirt.engine.ui.uicommonweb.models.datacenters.DataCenterModel in project ovirt-engine by oVirt.
the class AddDataCenterRM method prepare1.
private void prepare1() {
EnlistmentContext enlistmentContext = (EnlistmentContext) context.enlistment.getContext();
HostListModel<?> model = enlistmentContext.getModel();
ConfigureLocalStorageModel configureModel = (ConfigureLocalStorageModel) model.getWindow();
DataCenterModel dataCenterModel = configureModel.getDataCenter();
String dataCenterName = dataCenterModel.getName().getEntity();
if (!StringHelper.isNullOrEmpty(dataCenterName)) {
AsyncDataProvider.getInstance().getDataCenterListByName(new AsyncQuery<>(returnValue -> {
context.dataCenterFoundByName = Linq.firstOrNull(returnValue);
prepare2();
}), dataCenterName);
} else {
prepare2();
}
}
Aggregations