managed/src/main/java/com/yugabyte/yw/common/PlacementInfoUtil.java
/**
   * Method checks if enough nodes have been configured to satiate the userIntent for an OnPrem configuration
   * @param taskParams Universe task params.
   * @param cluster Cluster to be checked.
   * @return True if provider type is not OnPrem or if enough nodes have been configured for intent, false otherwise
   */
Method checks if enough nodes have been configured to satiate the userIntent for an OnPrem configuration
@param taskParams Universe task params.
@param cluster Cluster to be checked.
@return True if provider type is not OnPrem or if enough nodes have been configured for intent, false otherwise
Method checks if enough nodes have been configured to satiate the userIntent for an OnPrem configuration @param taskParams Universe task params . @param cluster Cluster to be checked . @return True if provider type is not OnPrem or if enough nodes have been configured for intent false otherwise
public static boolean checkIfNodeParamsValid(UniverseDefinitionTaskParams taskParams, Cluster cluster) {
    if (cluster.userIntent.providerType != CloudType.onprem) {
      return true;
    }
    UserIntent userIntent = cluster.userIntent;
    String instanceType = userIntent.instanceType;
    Set<NodeDetails> clusterNodes = taskParams.getNodesInCluster(cluster.uuid);
    if (clusterNodes == null || clusterNodes.isEmpty()) {
      int totalNodesConfiguredInRegionList = 0;
      for (UUID regionUUID: userIntent.regionList) {
        for (AvailabilityZone az: Region.get(regionUUID).zones) {
          totalNodesConfiguredInRegionList += NodeInstance.listByZone(az.uuid, instanceType).size();
        }
      }
      if (totalNodesConfiguredInRegionList < userIntent.numNodes) {
        LOG.error("Not enough nodes, required: {} nodes, configured: {} nodes", userIntent.numNodes, totalNodesConfiguredInRegionList);
        return false;
      }
    } else {
      for (Map.Entry<UUID, Integer> entry : toBeAddedAzUuidToNumNodes(clusterNodes).entrySet()) {
        UUID azUUID = entry.getKey();
        int numNodesToBeAdded = entry.getValue().intValue();
        if (numNodesToBeAdded > NodeInstance.listByZone(azUUID, instanceType).size()) {
          LOG.error("Not enough nodes configured for given AZ/Instance type combo, " +
                          "required {} found {} in AZ {} for Instance type {}", numNodesToBeAdded, NodeInstance.listByZone(azUUID, instanceType).size(),
                  azUUID, instanceType);
          return false;
        }
      }
    }
    return true;
  }
public static boolean checkIfNodeParamsValid ( UniverseDefinitionTaskParams taskParams , Cluster cluster ) { if ( cluster . userIntent . providerType != CloudType . onprem ) { return true ; } UserIntent userIntent = cluster . userIntent ; String instanceType = userIntent . instanceType ; Set < NodeDetails > clusterNodes = taskParams . getNodesInCluster ( cluster . uuid ) ; if ( clusterNodes == null || clusterNodes . isEmpty ( ) ) { int totalNodesConfiguredInRegionList = 0 ; for ( UUID regionUUID : userIntent . regionList ) { for ( AvailabilityZone az : Region . get ( regionUUID ) . zones ) { totalNodesConfiguredInRegionList += NodeInstance . listByZone ( az . uuid , instanceType ) . size ( ) ; } } if ( totalNodesConfiguredInRegionList < userIntent . numNodes ) { LOG . error ( "Not enough nodes, required: {} nodes, configured: {} nodes" , userIntent . numNodes , totalNodesConfiguredInRegionList ) ; return false ; } } else { for ( Map . Entry < UUID , Integer > entry : toBeAddedAzUuidToNumNodes ( clusterNodes ) . entrySet ( ) ) { UUID azUUID = entry . getKey ( ) ; int numNodesToBeAdded = entry . getValue ( ) . intValue ( ) ; if ( numNodesToBeAdded > NodeInstance . listByZone ( azUUID , instanceType ) . size ( ) ) { LOG . error ( "Not enough nodes configured for given AZ/Instance type combo, " + "required {} found {} in AZ {} for Instance type {}" , numNodesToBeAdded , NodeInstance . listByZone ( azUUID , instanceType ) . size ( ) , azUUID , instanceType ) ; return false ; } } } return true ; }
Method checks if enough nodes have been configured to satiate the userIntent for an OnPrem configuration
 @param taskParams Universe task params.
Method checks if enough nodes have been configured to satiate the userIntent for an OnPrem configuration @param taskParams Universe task params .
// If NodeDetailsSet is null, do a high level check whether number of nodes in given config is present // Check if number of nodes in the user intent is greater than number of nodes configured for given instance type // If NodeDetailsSet is non-empty verify that the node/az combo is valid