Source:
<code>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; } } <START> if (!getParameters().getIsInternal() && !isNoRunningVmsWithLeasesExist()) { <END> 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; }</code><technical_language>please move check (!getIsInternal) if condition in line 107 (and remove condition)</technical_language>

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; }