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); // Compensation context is not passed, as we do not want to compensate in case of failure // in detach of one of storage domains if (!Backend.getInstance() .runInternalAction( VdcActionType.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( VdcActionType.RemoveStorageDomain, tempVar, cloneContext().withoutLock().withoutExecutionContext()) .getSucceeded()) { return false; } } return true; }
protected RemoveStorageDomainParameters getParams(boolean format) { RemoveStorageDomainParameters params = new RemoveStorageDomainParameters(STORAGE_DOMAIN_ID); params.setStoragePoolId(STORAGE_POOL_ID); params.setVdsId(VDS_ID); params.setDoFormat(format); return params; }