bharatviswa504 commented on a change in pull request #1921:
URL: https://github.com/apache/ozone/pull/1921#discussion_r580979938



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManager.java
##########
@@ -681,6 +688,60 @@ public static String buildRpcServerStartMessage(String 
description,
     return rpcServer;
   }
 
+  /**
+   * Routine to bootstrap the StorageContainerManager. Thsi will connect to a
+   * running SCM instance which has valid cluster id and fetch the cluster id
+   * from there. SCM ids will be also be exchanged here.
+   *
+   * TODO: once SCM HA security is enabled, CSR cerificates will be fetched 
from
+   * running scm leader instance as well.
+   *
+   * @param conf OzoneConfiguration
+   * @return true if SCM bootstrap is successful, false otherwise.
+   * @throws IOException if init fails due to I/O error
+   */
+  public static boolean scmBootstrap(OzoneConfiguration conf)
+      throws IOException {
+    if (!SCMHAUtils.isSCMHAEnabled(conf)) {
+      LOG.error("Bootstrap is not supported without SCM HA.");
+      return false;
+    }
+    // The node here will try to fetch the cluster id from any of existing
+    // running SCM instances.
+    // TODO: need to avoid failover to local SCM Node here
+    final ScmInfo scmInfo = HAUtils.getScmInfo(conf);
+    SCMStorageConfig scmStorageConfig = new SCMStorageConfig(conf);
+    final String persistedClusterId = scmStorageConfig.getClusterID();
+    final String fetchedId = scmInfo.getClusterId();
+    Preconditions.checkNotNull(fetchedId);
+    StorageState state = scmStorageConfig.getState();
+    if (state != StorageState.INITIALIZED) {

Review comment:
       @GlenGeng 
   Thanks for pointing this.
   @bshashikant  pointed out this during the offline discussion and it is being 
addressed in HDDS-4718
   
https://github.com/apache/ozone/pull/1953/files#diff-90e25a3409b1f5c4234a04a51db63e702b217aebe51e15e08525c76b2c6137d6R720
   
   To make forward progress, we committed this to the branch.




----------------------------------------------------------------
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