use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class StorageDRListModel method onSave.
private void onSave() {
final StorageDRModel model = (StorageDRModel) getWindow();
if (!model.validate()) {
return;
}
StorageDomain storageDomain = getEntity();
final StorageSyncSchedule syncSchedule = new StorageSyncSchedule();
syncSchedule.setFrequency(model.getFrequency().getSelectedItem());
syncSchedule.setHour(model.getHour().getSelectedItem());
syncSchedule.setMins(model.getMins().getSelectedItem());
Guid georepId = model.getGeoRepSession().getSelectedItem() != null ? model.getGeoRepSession().getSelectedItem().getId() : null;
StorageSyncScheduleParameters parameter = new StorageSyncScheduleParameters(syncSchedule, storageDomain.getId(), georepId);
model.startProgress();
Frontend.getInstance().runAction(ActionType.ScheduleGlusterStorageSync, parameter, result -> {
StorageDRListModel localModel = (StorageDRListModel) result.getState();
model.stopProgress();
localModel.postSaveAction(result.getReturnValue());
}, this);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class StorageDRListModel method newDR.
private void newDR() {
if (getWindow() != null) {
return;
}
final StorageDomain storageDomain = getEntity();
if (storageDomain == null) {
return;
}
final StorageDRModel model = new StorageDRModel();
model.setHelpTag(HelpTag.new_storage_dr);
// $NON-NLS-1$
model.setHashName("new_storage_dr");
model.setTitle(ConstantsManager.getInstance().getConstants().newDRSetup());
setWindow(model);
model.getStorageDomain().setEntity(storageDomain);
model.startProgress();
AsyncDataProvider.getInstance().getGlusterGeoRepSessionsForStorageDomain(new AsyncQuery<>(geoRepSessions -> {
model.getGeoRepSession().setItems(geoRepSessions);
// show error if there are no associated geoRepSessions
if (geoRepSessions.isEmpty()) {
model.setMessage(ConstantsManager.getInstance().getConstants().noGeoRepSessionForGlusterVolume());
}
model.stopProgress();
}), storageDomain.getId());
// $NON-NLS-1$
UICommand okCommand = UICommand.createDefaultOkUiCommand("OnSave", this);
model.getCommands().add(okCommand);
// $NON-NLS-1$
UICommand cancelCommand = UICommand.createCancelUiCommand("Cancel", this);
model.getCommands().add(cancelCommand);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class StorageDataCenterListModel method syncSearch.
@Override
protected void syncSearch() {
if (getEntity() == null) {
return;
}
super.syncSearch();
IdQueryParameters tempVar = new IdQueryParameters(getEntity().getId());
tempVar.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetStorageDomainListById, tempVar, new AsyncQuery<QueryReturnValue>(returnValue -> {
ArrayList<StorageDomain> domains = returnValue.getReturnValue();
for (StorageDomain domain : domains) {
domain.setId(domain.getStoragePoolId());
}
Collections.sort(domains, Comparator.comparing(StorageDomain::getStoragePoolName, new LexoNumericComparator()));
setItems(domains);
setIsEmpty(getItems().size() == 0);
}));
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class StorageDataCenterListModel method onDetach.
private void onDetach() {
final ConfirmationModel model = (ConfirmationModel) getWindow();
if (!model.validate()) {
return;
}
setdetachPrms(new ArrayList<ActionParametersBase>());
setremovePrms(new ArrayList<ActionParametersBase>());
for (Object item : getSelectedItems()) {
StorageDomain storageDomain = (StorageDomain) item;
if (storageDomain.getStorageType() != StorageType.LOCALFS) {
DetachStorageDomainFromPoolParameters param = new DetachStorageDomainFromPoolParameters();
param.setStorageDomainId(getEntity().getId());
if (storageDomain.getStoragePoolId() != null) {
param.setStoragePoolId(storageDomain.getStoragePoolId());
}
getdetachPrms().add(param);
} else {
AsyncDataProvider.getInstance().getLocalStorageHost(new AsyncQuery<>(locaVds -> {
StorageDomain storage = getEntity();
RemoveStorageDomainParameters tempVar = new RemoveStorageDomainParameters(storage.getId());
tempVar.setVdsId(locaVds != null ? locaVds.getId() : null);
tempVar.setDoFormat(model.getForce().getEntity());
RemoveStorageDomainParameters removeStorageDomainParameters = tempVar;
getremovePrms().add(removeStorageDomainParameters);
if (getremovePrms().size() + getdetachPrms().size() == getSelectedItems().size()) {
Frontend.getInstance().runMultipleAction(ActionType.RemoveStorageDomain, getremovePrms());
}
}), storageDomain.getStoragePoolName());
}
if (getdetachPrms().size() > 0) {
Frontend.getInstance().runMultipleAction(ActionType.DetachStorageDomainFromPool, getdetachPrms());
}
}
cancel();
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class StorageDataCenterListModel method activate.
private void activate() {
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
StorageDomain a = (StorageDomain) item;
StorageDomainPoolParametersBase parameters = new StorageDomainPoolParametersBase();
parameters.setStorageDomainId(getEntity().getId());
if (a.getStoragePoolId() != null) {
parameters.setStoragePoolId(a.getStoragePoolId());
}
list.add(parameters);
}
Frontend.getInstance().runMultipleAction(ActionType.ActivateStorageDomain, list, result -> {
}, null);
}
Aggregations