bshashikant commented on a change in pull request #1916:
URL: https://github.com/apache/ozone/pull/1916#discussion_r574000644



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMRatisServerImpl.java
##########
@@ -227,12 +240,62 @@ public RaftPeerId getPeerId() {
               "localHost: {}, OZONE_SCM_NAMES: {}, selfPeerId: {}",
           localHost, conf.get(ScmConfigKeys.OZONE_SCM_NAMES), selfPeerId);
 
-      raftGroupId = RaftGroupId.valueOf(UUID.nameUUIDFromBytes(
-          SCM_SERVICE_ID.getBytes(StandardCharsets.UTF_8)));
+      String groupId = clusterId == null ? SCM_SERVICE_ID : clusterId;
+      raftGroupId = RaftGroupId.valueOf(
+          UUID.nameUUIDFromBytes(groupId.getBytes(StandardCharsets.UTF_8)));
 
       raftGroup = RaftGroup.valueOf(raftGroupId, raftPeers);
     }
 
+    SCMHAGroupBuilder(final SCMHANodeDetails details, final String clusterId) {
+
+      Preconditions.checkNotNull(clusterId);
+      // RaftGroupId is the clusterId
+      raftGroupId = RaftGroupId.valueOf(buildRaftGroupId(clusterId));
+      final String scmNodeId = details.getLocalNodeDetails().getNodeId();
+      Preconditions.checkNotNull(scmNodeId);
+      selfPeerId = RaftPeerId.getRaftPeerId(scmNodeId);
+      Preconditions.checkNotNull(scmNodeId);
+      SCMNodeDetails localNodeDetails = details.getLocalNodeDetails();
+
+      InetSocketAddress ratisAddr =
+          new InetSocketAddress(localNodeDetails.getInetAddress(),
+              localNodeDetails.getRatisPort());
+
+      RaftPeer localRaftPeer =
+          RaftPeer.newBuilder().setId(selfPeerId).setAddress(ratisAddr)
+              .build();
+
+      List<RaftPeer> raftPeers = new ArrayList<>();
+      // Add this Ratis server to the Ratis ring
+      raftPeers.add(localRaftPeer);
+
+      for (SCMNodeDetails peerInfo : details.getPeerNodeDetails()) {
+        String peerNodeId = peerInfo.getNodeId();
+        RaftPeerId raftPeerId = RaftPeerId.valueOf(peerNodeId);
+        RaftPeer raftPeer;
+        if (peerInfo.isHostUnresolved()) {
+          raftPeer = RaftPeer.newBuilder().setId(raftPeerId)

Review comment:
       Its following OM model.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to