managed/src/main/java/com/yugabyte/yw/common/PlacementInfoUtil.java
/**
   * Check to confirm the following after each configure call:
   *   - node AZs and placement AZs match.
   *   - instance type of all nodes matches.
   *   - each nodes has a unique name.
   *
   * @param cluster The cluster whose placement is checked.
   * @param nodes   The nodes in this cluster.
   */
Check to confirm the following after each configure call:
- node AZs and placement AZs match.
- instance type of all nodes matches.
- each nodes has a unique name.

@param cluster The cluster whose placement is checked.
@param nodes   The nodes in this cluster.
Check to confirm the following after each configure call : - node AZs and placement AZs match . - instance type of all nodes matches . - each nodes has a unique name . @param cluster The cluster whose placement is checked . @param nodes The nodes in this cluster .
private static void finalSanityCheckConfigure(Cluster cluster,
                                                Collection<NodeDetails> nodes) {
    PlacementInfo placementInfo = cluster.placementInfo;
    CloudType cloudType = cluster.userIntent.providerType;
    String instanceType = cluster.userIntent.instanceType;
    if (cloudType != CloudType.onprem) {
      Map<UUID, Integer> placementAZToNodeMap = getAzUuidToNumNodes(placementInfo);
      Map<UUID, Integer> nodesAZToNodeMap = getAzUuidToNumNodes(nodes, true);
      if (!nodesAZToNodeMap.equals(placementAZToNodeMap)) {
        String msg = "Nodes are in different AZs compared to placement";
        LOG.error("{}. PlacementAZ={}, nodesAZ={}", msg, placementAZToNodeMap, nodesAZToNodeMap);
        throw new IllegalStateException(msg);
      }
    }
    for (NodeDetails node : nodes) {
      String nodeType = node.cloudInfo.instance_type;
      if (node.state != NodeDetails.NodeState.ToBeRemoved &&
          !instanceType.equals(nodeType)) {
        String msg = "Instance type " + instanceType + " mismatch for " +
                      node.nodeName + ", expected type " + nodeType + ".";
        LOG.error(msg);
        throw new IllegalStateException(msg);
      }
    }
  }
private static void finalSanityCheckConfigure ( Cluster cluster , Collection < NodeDetails > nodes ) { PlacementInfo placementInfo = cluster . placementInfo ; CloudType cloudType = cluster . userIntent . providerType ; String instanceType = cluster . userIntent . instanceType ; if ( cloudType != CloudType . onprem ) { Map < UUID , Integer > placementAZToNodeMap = getAzUuidToNumNodes ( placementInfo ) ; Map < UUID , Integer > nodesAZToNodeMap = getAzUuidToNumNodes ( nodes , true ) ; if ( ! nodesAZToNodeMap . equals ( placementAZToNodeMap ) ) { String msg = "Nodes are in different AZs compared to placement" ; LOG . error ( "{}. PlacementAZ={}, nodesAZ={}" , msg , placementAZToNodeMap , nodesAZToNodeMap ) ; throw new IllegalStateException ( msg ) ; } } for ( NodeDetails node : nodes ) { String nodeType = node . cloudInfo . instance_type ; if ( node . state != NodeDetails . NodeState . ToBeRemoved && ! instanceType . equals ( nodeType ) ) { String msg = "Instance type " + instanceType + " mismatch for " + node . nodeName + ", expected type " + nodeType + "." ; LOG . error ( msg ) ; throw new IllegalStateException ( msg ) ; } } }
Check to confirm the following after each configure call:
   - node AZs and placement AZs match.
Check to confirm the following after each configure call : - node AZs and placement AZs match .
// For on-prem we could choose nodes from other AZs if not enough provisioned.