use of org.ovirt.engine.ui.uicommonweb.models.storage.SanStorageModelBase in project ovirt-engine by oVirt.
the class DataCenterGuideModel method saveSanStorage.
private void saveSanStorage(final TaskContext context) {
this.context = context;
StorageModel model = (StorageModel) getWindow();
SanStorageModelBase sanModel = (SanStorageModelBase) model.getCurrentStorageItem();
storageDomain = new StorageDomainStatic();
storageDomain.setStorageType(sanModel.getType());
storageDomain.setStorageDomainType(sanModel.getRole());
storageDomain.setStorageFormat(sanModel.getContainer().getFormat().getSelectedItem());
storageDomain.setStorageName(model.getName().getEntity());
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 {
saveNewSanStorage();
}
getWindow().stopProgress();
}), null, path);
}
use of org.ovirt.engine.ui.uicommonweb.models.storage.SanStorageModelBase in project ovirt-engine by oVirt.
the class DataCenterGuideModel method onSaveSanStorage.
private void onSaveSanStorage() {
ConfirmationModel confirmationModel = (ConfirmationModel) getConfirmWindow();
if (confirmationModel != null && !confirmationModel.validate()) {
return;
}
cancelConfirm();
getWindow().startProgress();
StorageModel model = (StorageModel) getWindow();
SanStorageModelBase sanModel = (SanStorageModelBase) model.getCurrentStorageItem();
VDS host = model.getHost().getSelectedItem();
boolean force = sanModel.isForce();
HashSet<String> lunIds = new HashSet<>();
for (LunModel lun : sanModel.getAddedLuns()) {
lunIds.add(lun.getLunId());
}
AddSANStorageDomainParameters params = new AddSANStorageDomainParameters(storageDomain);
params.setVdsId(host.getId());
params.setLunIds(new HashSet<>(lunIds));
params.setForce(force);
Frontend.getInstance().runAction(ActionType.AddSANStorageDomain, params, result -> {
DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
StorageModel storageModel = (StorageModel) dataCenterGuideModel.getWindow();
StoragePool dataCenter = storageModel.getDataCenter().getSelectedItem();
if (!dataCenter.getId().equals(StorageModel.UnassignedDataCenterId)) {
ActionReturnValue returnValue = result.getReturnValue();
Guid storageId = returnValue.getActionReturnValue();
dataCenterGuideModel.attachStorageToDataCenter(storageId, dataCenter.getId());
}
dataCenterGuideModel.onFinish(dataCenterGuideModel.context, true, dataCenterGuideModel.storageModel);
}, this);
}
use of org.ovirt.engine.ui.uicommonweb.models.storage.SanStorageModelBase in project ovirt-engine by oVirt.
the class DataCenterGuideModel method forceCreationWarning.
private void forceCreationWarning(ArrayList<String> usedLunsMessages) {
StorageModel storageModel = (StorageModel) getWindow();
SanStorageModelBase sanStorageModelBase = (SanStorageModelBase) storageModel.getCurrentStorageItem();
sanStorageModelBase.setForce(true);
ConfirmationModel model = new ConfirmationModel();
setConfirmWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().forceStorageDomainCreation());
model.setMessage(ConstantsManager.getInstance().getConstants().lunsAlreadyInUse());
model.setHelpTag(HelpTag.force_storage_domain_creation);
// $NON-NLS-1$
model.setHashName("force_storage_domain_creation");
model.setItems(usedLunsMessages);
// $NON-NLS-1$
UICommand onSaveSanStorageCommand = UICommand.createDefaultOkUiCommand("OnSaveSanStorage", this);
model.getCommands().add(onSaveSanStorageCommand);
// $NON-NLS-1$
UICommand cancelConfirmCommand = UICommand.createCancelUiCommand("CancelConfirm", this);
model.getCommands().add(cancelConfirmCommand);
}
use of org.ovirt.engine.ui.uicommonweb.models.storage.SanStorageModelBase in project ovirt-engine by oVirt.
the class DataCenterGuideModel method saveNewSanStorage.
public void saveNewSanStorage() {
StorageModel storageModel = (StorageModel) getWindow();
final SanStorageModelBase sanStorageModelBase = (SanStorageModelBase) storageModel.getCurrentStorageItem();
Guid hostId = sanStorageModelBase.getContainer().getHost().getSelectedItem().getId();
Set<String> unkownStatusLuns = new HashSet<>();
for (LunModel lunModel : sanStorageModelBase.getAddedLuns()) {
unkownStatusLuns.add(lunModel.getLunId());
}
Frontend.getInstance().runQuery(QueryType.GetDeviceList, new GetDeviceListQueryParameters(hostId, sanStorageModelBase.getType(), true, unkownStatusLuns, false), new AsyncQuery<QueryReturnValue>(response -> {
if (response.getSucceeded()) {
List<LUNs> checkedLuns = (ArrayList<LUNs>) response.getReturnValue();
postGetLunsMessages(sanStorageModelBase.getUsedLunsMessages(checkedLuns));
} else {
sanStorageModelBase.setGetLUNsFailure(ConstantsManager.getInstance().getConstants().couldNotRetrieveLUNsLunsFailure());
}
}, true));
}
use of org.ovirt.engine.ui.uicommonweb.models.storage.SanStorageModelBase in project ovirt-engine by oVirt.
the class DiskListModel method cancelConfirm.
private void cancelConfirm() {
AbstractDiskModel model = (AbstractDiskModel) getWindow();
SanStorageModelBase sanStorageModelBase = model.getSanStorageModelBase();
sanStorageModelBase.setForce(false);
setConfirmWindow(null);
}
Aggregations