managed/src/main/java/com/yugabyte/yw/common/PlacementInfoUtil.java
/**
   * Method takes a placementIndex and returns a NodeDetail object for it in order to add a node.
   *
   * @param cluster     The current cluster.
   * @param index       The placement index combination.
   * @param nodeIdx     Node index to be used in node name.
   * @return a NodeDetails object.
   */
Method takes a placementIndex and returns a NodeDetail object for it in order to add a node.
@param cluster     The current cluster.
@param index       The placement index combination.
@param nodeIdx     Node index to be used in node name.
@return a NodeDetails object.
Method takes a placementIndex and returns a NodeDetail object for it in order to add a node . @param cluster The current cluster . @param index The placement index combination . @param nodeIdx Node index to be used in node name . @return a NodeDetails object .
private static NodeDetails createNodeDetailsWithPlacementIndex(Cluster cluster,
                                                                 PlacementIndexes index,
                                                                 int nodeIdx) {
    NodeDetails nodeDetails = new NodeDetails();
    nodeDetails.placementUuid = cluster.uuid;
    PlacementCloud placementCloud = cluster.placementInfo.cloudList.get(index.cloudIdx);
    nodeDetails.cloudInfo = new CloudSpecificInfo();
    nodeDetails.cloudInfo.cloud = placementCloud.code;
    PlacementRegion placementRegion = placementCloud.regionList.get(index.regionIdx);
    nodeDetails.cloudInfo.region = placementRegion.code;
    PlacementAZ placementAZ = placementRegion.azList.get(index.azIdx);
    nodeDetails.azUuid = placementAZ.uuid;
    nodeDetails.cloudInfo.az = placementAZ.name;
    nodeDetails.cloudInfo.subnet_id = placementAZ.subnet;
    nodeDetails.cloudInfo.instance_type = cluster.userIntent.instanceType;
    nodeDetails.cloudInfo.assignPublicIP = cluster.userIntent.assignPublicIP;
    nodeDetails.cloudInfo.useTimeSync = cluster.userIntent.useTimeSync;
    nodeDetails.isTserver = true;
    nodeDetails.nodeIdx = nodeIdx;
    nodeDetails.state = NodeDetails.NodeState.ToBeAdded;
    LOG.debug("Placed new node [{}] at cloud:{}, region:{}, az:{}. uuid {}.",
            nodeDetails, index.cloudIdx, index.regionIdx, index.azIdx, nodeDetails.azUuid);
    return nodeDetails;
  }
private static NodeDetails createNodeDetailsWithPlacementIndex ( Cluster cluster , PlacementIndexes index , int nodeIdx ) { NodeDetails nodeDetails = new NodeDetails ( ) ; nodeDetails . placementUuid = cluster . uuid ; PlacementCloud placementCloud = cluster . placementInfo . cloudList . get ( index . cloudIdx ) ; nodeDetails . cloudInfo = new CloudSpecificInfo ( ) ; nodeDetails . cloudInfo . cloud = placementCloud . code ; PlacementRegion placementRegion = placementCloud . regionList . get ( index . regionIdx ) ; nodeDetails . cloudInfo . region = placementRegion . code ; PlacementAZ placementAZ = placementRegion . azList . get ( index . azIdx ) ; nodeDetails . azUuid = placementAZ . uuid ; nodeDetails . cloudInfo . az = placementAZ . name ; nodeDetails . cloudInfo . subnet_id = placementAZ . subnet ; nodeDetails . cloudInfo . instance_type = cluster . userIntent . instanceType ; nodeDetails . cloudInfo . assignPublicIP = cluster . userIntent . assignPublicIP ; nodeDetails . cloudInfo . useTimeSync = cluster . userIntent . useTimeSync ; nodeDetails . isTserver = true ; nodeDetails . nodeIdx = nodeIdx ; nodeDetails . state = NodeDetails . NodeState . ToBeAdded ; LOG . debug ( "Placed new node [{}] at cloud:{}, region:{}, az:{}. uuid {}." , nodeDetails , index . cloudIdx , index . regionIdx , index . azIdx , nodeDetails . azUuid ) ; return nodeDetails ; }
Method takes a placementIndex and returns a NodeDetail object for it in order to add a node.
Method takes a placementIndex and returns a NodeDetail object for it in order to add a node .
// Note: node name is set during customer task run time. // Set the cluster. // Set the cloud. // Set the region. // Set the AZ and the subnet. // Set the tablet server role to true. // Set the node id. // We are ready to add this node.