Source:
<code>protected boolean canDoAction() { T params = getParameters(); setVdsGroupId(params.getVdsStaticData().getVdsGroupId()); params.setVdsForUniqueId(null); boolean returnValue = validateVdsGroup(); if (returnValue) { HostValidator validator = getHostValidator(); returnValue = validate(validator.nameNotEmpty()) && validate(validator.nameLengthIsLegal()) && validate(validator.hostNameIsValid()) && validate(validator.nameNotUsed()) && validate(validator.hostNameNotUsed()) && validate(validator.portIsValid()) && validate(validator.sshUserNameNotEmpty()) && validate(validator.validateSingleHostAttachedToLocalStorage()) && validate(validator.securityKeysExists()) && validate(validator.provisioningComputeResourceValid(params.isProvisioned(), params.getComputeResource())) && validate(validator.provisioningHostGroupValid(params.isProvisioned(), params.getHostGroup())) && validate(validator.passwordNotEmpty(params.isPending(), params.getAuthMethod(), params.getPassword())) && <START> validate(validator.isHeVmManaged(params.isDeployHostedEngineAgent())); <END> } if (!(returnValue && isPowerManagementLegal(params.getVdsStaticData().isPmEnabled(), params.getFenceAgents(), getVdsGroup().getCompatibilityVersion().toString()) && canConnect(params.getvds()))) { return false; } if (params.getNetworkProviderId() != null && !validateNetworkProviderProperties(params.getNetworkProviderId(), params.getNetworkMappings())) { return false; } if (isGlusterSupportEnabled() && clusterHasNonInitializingServers()) { VDS upServer = getClusterUtils().getUpServer(getVdsGroupId()); if (upServer == null) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_NO_GLUSTER_HOST_TO_PEER_PROBE); } } return true; }</code><technical_language>misleading isHeVmManaged() returns true isDeployHostedEngineAgent() is false? explicit if (params.isDeployHostedEngineAgent()) { returnValue = returnValue && validator.isHeVmManaged(); } is a alternative</technical_language>

Target:
protected boolean canDoAction() { T params = getParameters(); setVdsGroupId(params.getVdsStaticData().getVdsGroupId()); params.setVdsForUniqueId(null); boolean returnValue = validateVdsGroup(); if (returnValue) { HostValidator validator = getHostValidator(); returnValue = validate(validator.nameNotEmpty()) && validate(validator.nameLengthIsLegal()) && validate(validator.hostNameIsValid()) && validate(validator.nameNotUsed()) && validate(validator.hostNameNotUsed()) && validate(validator.portIsValid()) && validate(validator.sshUserNameNotEmpty()) && validate(validator.validateSingleHostAttachedToLocalStorage()) && validate(validator.securityKeysExists()) && validate(validator.provisioningComputeResourceValid(params.isProvisioned(), params.getComputeResource())) && validate(validator.provisioningHostGroupValid(params.isProvisioned(), params.getHostGroup())) && validate(validator.passwordNotEmpty(params.isPending(), params.getAuthMethod(), params.getPassword())) && validate(validator.isHeVmManaged(params.getHostedEngineDeployConfiguration())); } if (!(returnValue && isPowerManagementLegal(params.getVdsStaticData().isPmEnabled(), params.getFenceAgents(), getVdsGroup().getCompatibilityVersion().toString()) && canConnect(params.getvds()))) { return false; } if (params.getNetworkProviderId() != null && !validateNetworkProviderProperties(params.getNetworkProviderId(), params.getNetworkMappings())) { return false; } if (isGlusterSupportEnabled() && clusterHasNonInitializingServers()) { VDS upServer = getClusterUtils().getUpServer(getVdsGroupId()); if (upServer == null) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_NO_GLUSTER_HOST_TO_PEER_PROBE); } } return true; }