Source:
protected boolean validate() { if (getParameters().isSkipChecks()) { return true; } if (!checkStorageDomain()) { return false; } if (!((getParameters().getIsInternal() && checkStorageDomainStatus(StorageDomainStatus.Active, StorageDomainStatus.Unknown)) || checkStorageDomainStatus(StorageDomainStatus.Active))) { return false; } if (!getParameters().getIsInternal()) { if (getStorageDomain().isHostedEngineStorage()) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_HOSTED_ENGINE_STORAGE); } if (getStorageDomain().getStorageDomainType() == StorageDomainType.Master && !validateMasterDeactivationAllowed()) { return false; } } if (!getParameters().getIsInternal() && !isNoRunningVmsWithLeasesExist()) { return false; } if (!isRunningVmsWithIsoAttached()) { return false; } if (!getParameters().getIsInternal() && !vmDao.getAllActiveForStorageDomain(getStorageDomain().getId()).isEmpty()) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_DETECTED_ACTIVE_VMS); } if (getStoragePool().getSpmVdsId() != null) { if (getStorageDomain().getStorageDomainType() == StorageDomainType.Master && asyncTaskDao.getAsyncTaskIdsByStoragePoolId(getStorageDomain().getStoragePoolId()).size() > 0) { return failValidation(EngineMessage.ERROR_CANNOT_DEACTIVATE_MASTER_DOMAIN_WITH_TASKS_ON_POOL); } else if (getStorageDomain().getStorageDomainType() != StorageDomainType.ISO && !getParameters().getIsInternal() && (asyncTaskDao.getAsyncTaskIdsByEntity(getParameters().getStorageDomainId()).size() > 0 || commandEntityDao.getCommandIdsByEntity(getParameters().getStorageDomainId()).size() > 0)) { return failValidation(EngineMessage.ERROR_CANNOT_DEACTIVATE_DOMAIN_WITH_TASKS); } } return true; }

Target:
protected boolean validate() { if (getParameters().isSkipChecks()) { return true; } if (!checkStorageDomain()) { return false; } if (!((getParameters().getIsInternal() && checkStorageDomainStatus(StorageDomainStatus.Active, StorageDomainStatus.Unknown)) || checkStorageDomainStatus(StorageDomainStatus.Active))) { return false; } if (!getParameters().getIsInternal()) { if (getStorageDomain().isHostedEngineStorage()) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_HOSTED_ENGINE_STORAGE); } if (getStorageDomain().getStorageDomainType() == StorageDomainType.Master && !validateMasterDeactivationAllowed()) { return false; } if (!isNoRunningVmsWithLeasesExist()) { return false; } } if (!isRunningVmsWithIsoAttached()) { return false; } if (!getParameters().getIsInternal() && !vmDao.getAllActiveForStorageDomain(getStorageDomain().getId()).isEmpty()) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_DETECTED_ACTIVE_VMS); } if (getStoragePool().getSpmVdsId() != null) { if (getStorageDomain().getStorageDomainType() == StorageDomainType.Master && asyncTaskDao.getAsyncTaskIdsByStoragePoolId(getStorageDomain().getStoragePoolId()).size() > 0) { return failValidation(EngineMessage.ERROR_CANNOT_DEACTIVATE_MASTER_DOMAIN_WITH_TASKS_ON_POOL); } else if (getStorageDomain().getStorageDomainType() != StorageDomainType.ISO && !getParameters().getIsInternal() && (asyncTaskDao.getAsyncTaskIdsByEntity(getParameters().getStorageDomainId()).size() > 0 || commandEntityDao.getCommandIdsByEntity(getParameters().getStorageDomainId()).size() > 0)) { return failValidation(EngineMessage.ERROR_CANNOT_DEACTIVATE_DOMAIN_WITH_TASKS); } } return true; }