use of org.ovirt.engine.core.common.action.RemoveStorageDomainParameters in project ovirt-engine by oVirt.
the class RemoveStoragePoolCommand method removeDomainFromPool.
protected boolean removeDomainFromPool(StorageDomain storageDomain, VDS vds) {
if (storageDomain.getStorageType() != StorageType.LOCALFS || storageDomain.getStorageDomainType() == StorageDomainType.ISO) {
DetachStorageDomainFromPoolParameters tempVar = new DetachStorageDomainFromPoolParameters(storageDomain.getId(), getStoragePool().getId());
tempVar.setRemoveLast(true);
tempVar.setDestroyingPool(true);
// in detach of one of storage domains
if (!Backend.getInstance().runInternalAction(ActionType.DetachStorageDomainFromPool, tempVar, cloneContext().withoutCompensationContext().withoutExecutionContext()).getSucceeded()) {
return false;
}
} else {
RemoveStorageDomainParameters tempVar = new RemoveStorageDomainParameters(storageDomain.getId());
tempVar.setDestroyingPool(true);
tempVar.setDoFormat(true);
tempVar.setVdsId(vds.getId());
if (!runInternalAction(ActionType.RemoveStorageDomain, tempVar, cloneContext().withoutLock().withoutExecutionContext()).getSucceeded()) {
return false;
}
}
return true;
}
use of org.ovirt.engine.core.common.action.RemoveStorageDomainParameters in project ovirt-engine by oVirt.
the class StorageListModel method onRemove.
private void onRemove() {
if (getSelectedItem() != null) {
StorageDomain storage = getSelectedItem();
RemoveStorageModel model = (RemoveStorageModel) getWindow();
if (!model.validate()) {
return;
}
VDS host = model.getHostList().getSelectedItem();
RemoveStorageDomainParameters tempVar = new RemoveStorageDomainParameters(storage.getId());
tempVar.setVdsId(host.getId());
tempVar.setDoFormat(model.getFormat().getEntity());
Frontend.getInstance().runAction(ActionType.RemoveStorageDomain, tempVar, null, this);
}
cancel();
}
use of org.ovirt.engine.core.common.action.RemoveStorageDomainParameters 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.action.RemoveStorageDomainParameters in project ovirt-engine by oVirt.
the class DataCenterStorageListModel method onDetach.
public void onDetach() {
final ConfirmationModel confirmModel = (ConfirmationModel) getWindow();
if (confirmModel.getProgress() != null) {
return;
}
if (!confirmModel.validate()) {
return;
}
// A list of 'detach' action parameters
setDetachParams(new ArrayList<>());
// A list of 'remove' action parameters
setRemoveParams(new ArrayList<>());
String localStorgaeDC = null;
for (StorageDomain a : getSelectedItems()) {
// For local storage - remove; otherwise - detach
if (a.getStorageType() == StorageType.LOCALFS && a.getStorageDomainType() != StorageDomainType.ISO) {
getRemoveParams().add(new RemoveStorageDomainParameters(a.getId()));
localStorgaeDC = a.getStoragePoolName();
} else {
getDetachParams().add(new DetachStorageDomainFromPoolParameters(a.getId(), getEntity().getId()));
}
}
confirmModel.startProgress();
if (getRemoveParams().size() > 0) {
AsyncDataProvider.getInstance().getLocalStorageHost(new AsyncQuery<>(locaVds -> {
for (ActionParametersBase item : getRemoveParams()) {
((RemoveStorageDomainParameters) item).setVdsId(locaVds != null ? locaVds.getId() : null);
((RemoveStorageDomainParameters) item).setDoFormat(confirmModel.getForce().getEntity());
}
postDetach(getWindow());
}), localStorgaeDC);
} else {
postDetach(confirmModel);
}
}
use of org.ovirt.engine.core.common.action.RemoveStorageDomainParameters in project ovirt-engine by oVirt.
the class BackendAttachedStorageDomainResource method remove.
@Override
public Response remove() {
StorageDomain storageDomain = get();
if (storageDomain.getStorage().getType().equals(StorageType.LOCALFS)) {
RemoveStorageDomainParameters params = new RemoveStorageDomainParameters(guid);
params.setDoFormat(true);
return performAction(ActionType.RemoveStorageDomain, params);
} else {
DetachStorageDomainFromPoolParameters params = new DetachStorageDomainFromPoolParameters(guid, dataCenterId);
return performAction(ActionType.DetachStorageDomainFromPool, params);
}
}
Aggregations