use of org.ovirt.engine.ui.uicommonweb.models.storage.PosixStorageModel in project ovirt-engine by oVirt.
the class AsyncDataProvider method getIsoStorageModels.
public List<IStorageModel> getIsoStorageModels() {
ArrayList<IStorageModel> models = new ArrayList<>();
NfsStorageModel nfsIsoModel = new NfsStorageModel();
models.add(nfsIsoModel);
PosixStorageModel posixIsoModel = new PosixStorageModel();
models.add(posixIsoModel);
GlusterStorageModel glusterStorageModel = new GlusterStorageModel();
models.add(glusterStorageModel);
LocalStorageModel localIsoModel = new LocalStorageModel();
models.add(localIsoModel);
addTypeToStorageModels(StorageDomainType.ISO, models);
return models;
}
use of org.ovirt.engine.ui.uicommonweb.models.storage.PosixStorageModel in project ovirt-engine by oVirt.
the class AsyncDataProvider method getExportStorageModels.
public List<IStorageModel> getExportStorageModels() {
ArrayList<IStorageModel> models = new ArrayList<>();
NfsStorageModel nfsExportModel = new NfsStorageModel();
models.add(nfsExportModel);
PosixStorageModel posixExportModel = new PosixStorageModel();
models.add(posixExportModel);
GlusterStorageModel glusterExportModel = new GlusterStorageModel();
models.add(glusterExportModel);
LocalStorageModel localExportStorageModel = new LocalStorageModel();
models.add(localExportStorageModel);
addTypeToStorageModels(StorageDomainType.ImportExport, models);
return models;
}
use of org.ovirt.engine.ui.uicommonweb.models.storage.PosixStorageModel in project ovirt-engine by oVirt.
the class AsyncDataProvider method getFileDataStorageModels.
public List<IStorageModel> getFileDataStorageModels() {
ArrayList<IStorageModel> models = new ArrayList<>();
NfsStorageModel nfsDataModel = new NfsStorageModel();
models.add(nfsDataModel);
PosixStorageModel posixDataModel = new PosixStorageModel();
models.add(posixDataModel);
GlusterStorageModel GlusterDataModel = new GlusterStorageModel();
models.add(GlusterDataModel);
LocalStorageModel localDataModel = new LocalStorageModel();
models.add(localDataModel);
addTypeToStorageModels(StorageDomainType.Data, models);
return models;
}
use of org.ovirt.engine.ui.uicommonweb.models.storage.PosixStorageModel in project ovirt-engine by oVirt.
the class DataCenterGuideModel method savePosixStorage.
private void savePosixStorage(final TaskContext context) {
this.context = context;
StorageModel model = (StorageModel) getWindow();
boolean isNew = model.getStorage() == null;
storageModel = model.getCurrentStorageItem();
PosixStorageModel posixModel = (PosixStorageModel) storageModel;
path = posixModel.getPath().getEntity();
storageDomain = new StorageDomainStatic();
storageDomain.setStorageType(isNew ? storageModel.getType() : storageDomain.getStorageType());
storageDomain.setStorageDomainType(isNew ? storageModel.getRole() : storageDomain.getStorageDomainType());
storageDomain.setStorageName(model.getName().getEntity());
storageDomain.setStorageFormat(model.getFormat().getSelectedItem());
AsyncDataProvider.getInstance().getStorageDomainsByConnection(new AsyncQuery<>(storages -> {
if (storages != null && storages.size() > 0) {
String storageName = storages.get(0).getStorageName();
onFinish(context, false, storageModel, ConstantsManager.getInstance().getMessages().createOperationFailedDcGuideMsg(storageName));
} else {
saveNewPosixStorage();
}
}), null, path);
}
use of org.ovirt.engine.ui.uicommonweb.models.storage.PosixStorageModel in project ovirt-engine by oVirt.
the class DataCenterGuideModel method saveNewPosixStorage.
private void saveNewPosixStorage() {
StorageModel model = (StorageModel) getWindow();
PosixStorageModel posixModel = (PosixStorageModel) model.getCurrentStorageItem();
VDS host = model.getHost().getSelectedItem();
hostId = host.getId();
// Create storage connection.
StorageServerConnections connection = new StorageServerConnections();
connection.setConnection(path);
connection.setStorageType(posixModel.getType());
connection.setVfsType(posixModel.getVfsType().getEntity());
connection.setMountOptions(posixModel.getMountOptions().getEntity());
this.connection = connection;
ArrayList<ActionType> actionTypes = new ArrayList<>();
ArrayList<ActionParametersBase> parameters = new ArrayList<>();
actionTypes.add(ActionType.AddStorageServerConnection);
actionTypes.add(posixModel.getAddStorageDomainVdcAction());
parameters.add(new StorageServerConnectionParametersBase(this.connection, host.getId(), false));
StorageDomainManagementParameter parameter = new StorageDomainManagementParameter(storageDomain);
parameter.setVdsId(host.getId());
StoragePool dataCenter = model.getDataCenter().getSelectedItem();
parameter.setStoragePoolId(dataCenter.getId());
parameters.add(parameter);
IFrontendActionAsyncCallback callback1 = result -> {
DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
ActionReturnValue actionReturnValue = result.getReturnValue();
dataCenterGuideModel.storageDomain.setStorage((String) actionReturnValue.getActionReturnValue());
dataCenterGuideModel.connection.setId((String) actionReturnValue.getActionReturnValue());
};
IFrontendActionAsyncCallback callback2 = result -> {
DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
ActionReturnValue actionReturnValue = result.getReturnValue();
dataCenterGuideModel.storageId = actionReturnValue.getActionReturnValue();
// Attach storage to data center as necessary.
StorageModel storageModel = (StorageModel) dataCenterGuideModel.getWindow();
StoragePool selectedDataCenter = storageModel.getDataCenter().getSelectedItem();
if (!selectedDataCenter.getId().equals(StorageModel.UnassignedDataCenterId)) {
dataCenterGuideModel.attachStorageToDataCenter(dataCenterGuideModel.storageId, selectedDataCenter.getId());
}
dataCenterGuideModel.onFinish(dataCenterGuideModel.context, true, dataCenterGuideModel.storageModel);
};
IFrontendActionAsyncCallback failureCallback = result -> {
DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
dataCenterGuideModel.cleanConnection(dataCenterGuideModel.connection, dataCenterGuideModel.hostId);
dataCenterGuideModel.onFinish(dataCenterGuideModel.context, false, dataCenterGuideModel.storageModel);
};
Frontend.getInstance().runMultipleActions(actionTypes, parameters, new ArrayList<>(Arrays.asList(new IFrontendActionAsyncCallback[] { callback1, callback2 })), failureCallback, this);
}
Aggregations