use of org.ovirt.engine.core.common.action.StoragePoolManagementParameter 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.core.common.action.StoragePoolManagementParameter in project ovirt-engine by oVirt.
the class DataCenterListModel method onSaveInternal.
public void onSaveInternal() {
DataCenterModel model = (DataCenterModel) getWindow();
if (model.getProgress() != null) {
return;
}
StoragePool dataCenter = model.getIsNew() ? new StoragePool() : (StoragePool) Cloner.clone(getSelectedItem());
// cancel confirm window if there is
cancelConfirmation();
// Save changes.
dataCenter.setName(model.getName().getEntity());
dataCenter.setdescription(model.getDescription().getEntity());
dataCenter.setComment(model.getComment().getEntity());
dataCenter.setIsLocal(model.getStoragePoolType().getSelectedItem());
dataCenter.setCompatibilityVersion(model.getVersion().getSelectedItem());
dataCenter.setQuotaEnforcementType(model.getQuotaEnforceTypeListModel().getSelectedItem());
model.startProgress();
if (model.getIsNew()) {
// When adding a data center use sync action to be able present a Guide Me dialog afterwards.
Frontend.getInstance().runAction(ActionType.AddEmptyStoragePool, new StoragePoolManagementParameter(dataCenter), result -> {
DataCenterListModel localModel = (DataCenterListModel) result.getState();
localModel.postOnSaveInternal(result.getReturnValue());
}, this);
} else {
// Use async action in order to close dialog immediately.
Frontend.getInstance().runMultipleAction(ActionType.UpdateStoragePool, new ArrayList<ActionParametersBase>(Arrays.asList(new StoragePoolManagementParameter(dataCenter))), result -> {
DataCenterListModel localModel = (DataCenterListModel) result.getState();
localModel.postOnSaveInternal(result.getReturnValue().get(0));
}, this);
}
}
use of org.ovirt.engine.core.common.action.StoragePoolManagementParameter in project ovirt-engine by oVirt.
the class BackendDataCentersResource method add.
@Override
public Response add(DataCenter dataCenter) {
validateParameters(dataCenter, "name");
if (!dataCenter.isSetLocal()) {
validateParameters(dataCenter, "local");
}
StoragePool entity = map(dataCenter);
return performCreate(ActionType.AddEmptyStoragePool, new StoragePoolManagementParameter(entity), new QueryIdResolver<Guid>(QueryType.GetStoragePoolById, IdQueryParameters.class));
}
Aggregations