use of org.ovirt.engine.core.common.action.ExtendSANStorageDomainParameters in project ovirt-engine by oVirt.
the class StorageListModel method saveSanStorage.
private void saveSanStorage(TaskContext context) {
this.context = context;
StorageModel model = (StorageModel) getWindow();
SanStorageModelBase sanModel = (SanStorageModelBase) model.getCurrentStorageItem();
StorageDomain storage = getSelectedItem();
boolean isNew = model.getStorage() == null;
storageDomain = isNew ? new StorageDomainStatic() : (StorageDomainStatic) Cloner.clone(storage.getStorageStaticData());
storageDomain.setStorageType(isNew ? sanModel.getType() : storageDomain.getStorageType());
storageDomain.setStorageDomainType(isNew ? sanModel.getRole() : storageDomain.getStorageDomainType());
storageDomain.setStorageFormat(isNew ? sanModel.getContainer().getFormat().getSelectedItem() : storageDomain.getStorageFormat());
storageDomain.setDescription(model.getDescription().getEntity());
storageDomain.setComment(model.getComment().getEntity());
saveCommonStorageProperties(model);
if (isNew) {
saveNewSanStorage();
} else {
Frontend.getInstance().runAction(ActionType.UpdateStorageDomain, new StorageDomainManagementParameter(storageDomain), new IFrontendActionAsyncCallback() {
@Override
public void executed(FrontendActionAsyncResult result) {
StorageListModel storageListModel = (StorageListModel) result.getState();
StorageModel storageModel = (StorageModel) getWindow();
SanStorageModelBase sanStorageModelBase = (SanStorageModelBase) storageModel.getCurrentStorageItem();
boolean force = sanStorageModelBase.isForce();
StorageDomain storageDomain1 = storageListModel.getSelectedItem();
HashSet<String> lunIds = new HashSet<>();
for (LunModel lun : sanStorageModelBase.getAddedLuns()) {
lunIds.add(lun.getLunId());
}
if (lunIds.size() > 0) {
Frontend.getInstance().runAction(ActionType.ExtendSANStorageDomain, new ExtendSANStorageDomainParameters(storageDomain1.getId(), new HashSet<>(lunIds), force), null, this);
}
Set<String> lunToRefreshIds = sanStorageModelBase.getLunsToRefresh();
if (lunToRefreshIds.size() > 0) {
Frontend.getInstance().runAction(ActionType.RefreshLunsSize, new ExtendSANStorageDomainParameters(storageDomain1.getId(), lunToRefreshIds, false), null, this);
}
if (storageDomain1.getStatus() == StorageDomainStatus.Maintenance) {
Set<String> lunsToRemoveIds = sanStorageModelBase.getLunsToRemove();
if (lunsToRemoveIds.size() > 0) {
Frontend.getInstance().runAction(ActionType.ReduceSANStorageDomainDevices, new ReduceSANStorageDomainDevicesCommandParameters(storageDomain1.getId(), new ArrayList<>(lunsToRemoveIds)), null, this);
}
}
storageListModel.onFinish(storageListModel.context, true, storageListModel.storageModel);
}
}, this);
}
}
use of org.ovirt.engine.core.common.action.ExtendSANStorageDomainParameters in project ovirt-engine by oVirt.
the class BackendStorageDomainResource method addLunsToStorageDomain.
private void addLunsToStorageDomain(List<LogicalUnit> newLuns, boolean overrideLuns) {
ExtendSANStorageDomainParameters params = createParameters(guid, newLuns, overrideLuns);
performAction(ActionType.ExtendSANStorageDomain, params);
}
use of org.ovirt.engine.core.common.action.ExtendSANStorageDomainParameters in project ovirt-engine by oVirt.
the class BackendStorageDomainResource method createParameters.
private ExtendSANStorageDomainParameters createParameters(Guid storageDomainId, List<LogicalUnit> newLuns, boolean force) {
ExtendSANStorageDomainParameters params = new ExtendSANStorageDomainParameters();
params.setStorageDomainId(storageDomainId);
Set<String> lunIds = newLuns.stream().map(LogicalUnit::getId).collect(Collectors.toSet());
params.setLunIds(lunIds);
params.setForce(force);
return params;
}
use of org.ovirt.engine.core.common.action.ExtendSANStorageDomainParameters in project ovirt-engine by oVirt.
the class BackendStorageDomainResource method refreshLuns.
@Override
public Response refreshLuns(Action action) {
List<LogicalUnit> incomingLuns;
if (action.isSetLogicalUnits()) {
incomingLuns = action.getLogicalUnits().getLogicalUnits();
} else {
incomingLuns = Collections.emptyList();
}
ExtendSANStorageDomainParameters params = createParameters(guid, incomingLuns, false);
return performAction(ActionType.RefreshLunsSize, params);
}
Aggregations