use of org.ovirt.engine.ui.uicommonweb.models.storage.NfsStorageModel 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.NfsStorageModel 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.NfsStorageModel in project ovirt-engine by oVirt.
the class DataCenterGuideModel method saveNewNfsStorage.
public void saveNewNfsStorage() {
StorageModel model = (StorageModel) getWindow();
NfsStorageModel nfsModel = (NfsStorageModel) model.getCurrentStorageItem();
VDS host = model.getHost().getSelectedItem();
hostId = host.getId();
// Create storage connection.
StorageServerConnections tempVar = new StorageServerConnections();
tempVar.setConnection(path);
tempVar.setStorageType(nfsModel.getType());
connection = tempVar;
ArrayList<ActionType> actionTypes = new ArrayList<>();
ArrayList<ActionParametersBase> parameters = new ArrayList<>();
actionTypes.add(ActionType.AddStorageServerConnection);
actionTypes.add(ActionType.AddNFSStorageDomain);
actionTypes.add(ActionType.DisconnectStorageServerConnection);
parameters.add(new StorageServerConnectionParametersBase(connection, host.getId(), false));
StorageDomainManagementParameter tempVar2 = new StorageDomainManagementParameter(storageDomain);
tempVar2.setVdsId(host.getId());
parameters.add(tempVar2);
parameters.add(new StorageServerConnectionParametersBase(connection, host.getId(), false));
IFrontendActionAsyncCallback callback1 = result -> {
DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
ActionReturnValue actionReturnValue = result.getReturnValue();
dataCenterGuideModel.storageDomain.setStorage((String) actionReturnValue.getActionReturnValue());
};
IFrontendActionAsyncCallback callback2 = result -> {
DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
ActionReturnValue actionReturnValue = result.getReturnValue();
dataCenterGuideModel.storageId = actionReturnValue.getActionReturnValue();
};
IFrontendActionAsyncCallback callback3 = result -> {
DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
StorageModel storageModel = (StorageModel) dataCenterGuideModel.getWindow();
// Attach storage to data center as neccessary.
StoragePool dataCenter = storageModel.getDataCenter().getSelectedItem();
if (!dataCenter.getId().equals(StorageModel.UnassignedDataCenterId)) {
dataCenterGuideModel.attachStorageToDataCenter(dataCenterGuideModel.storageId, dataCenter.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, callback3 })), failureCallback, this);
}
use of org.ovirt.engine.ui.uicommonweb.models.storage.NfsStorageModel 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.NfsStorageModel in project ovirt-engine by oVirt.
the class DataCenterGuideModel method saveNfsStorage.
private void saveNfsStorage(final TaskContext context) {
this.context = context;
StorageModel model = (StorageModel) getWindow();
boolean isNew = model.getStorage() == null;
storageModel = model.getCurrentStorageItem();
NfsStorageModel nfsModel = (NfsStorageModel) storageModel;
path = nfsModel.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 {
saveNewNfsStorage();
}
}), null, path);
}
Aggregations