hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java
private static boolean ksmInit(OzoneConfiguration conf) throws IOException {
    KSMStorage ksmStorage = new KSMStorage(conf);
    StorageState state = ksmStorage.getState();
    if (state != StorageState.INITIALIZED) {
      try {
        ScmBlockLocationProtocol scmBlockClient = getScmBlockClient(conf);
        ScmInfo scmInfo = scmBlockClient.getScmInfo();
        String clusterId = scmInfo.getClusterId();
        String scmId = scmInfo.getScmId();
        if (clusterId == null || clusterId.isEmpty()) {
          throw new IOException("Invalid Cluster ID");
        }
        if (scmId == null || scmId.isEmpty()) {
          throw new IOException("Invalid SCM ID");
        }
        ksmStorage.setClusterId(clusterId);
        ksmStorage.setScmId(scmId);
        ksmStorage.initialize();
        System.out.println(
            "KSM initialization succeeded.Current cluster id for sd="
                + ksmStorage.getStorageDir() + ";cid=" + ksmStorage
                .getClusterID());
        return true;
      } catch (IOException ioe) {
        LOG.error("Could not initialize KSM version file", ioe);
        return false;
      }
    } else {
      System.out.println(
          "KSM already initialized.Reusing existing cluster id for sd="
              + ksmStorage.getStorageDir() + ";cid=" + ksmStorage
              .getClusterID());
      return true;
    }
  }
/**
   * Initializes the KSM instance.
   * @param conf OzoneConfiguration
   * @return true if KSM initialization succeeds , false otherwise
   * @throws IOException in case ozone metadata directory path is not accessible
   */
Initializes the KSM instance.
@param conf OzoneConfiguration
@return true if KSM initialization succeeds , false otherwise
@throws IOException in case ozone metadata directory path is not accessible
Initializes the KSM instance . @param conf OzoneConfiguration @return true if KSM initialization succeeds false otherwise @throws IOException in case ozone metadata directory path is not accessible
private static boolean ksmInit(OzoneConfiguration conf) throws IOException {
    KSMStorage ksmStorage = new KSMStorage(conf);
    StorageState state = ksmStorage.getState();
    if (state != StorageState.INITIALIZED) {
      try {
        ScmBlockLocationProtocol scmBlockClient = getScmBlockClient(conf);
        ScmInfo scmInfo = scmBlockClient.getScmInfo();
        String clusterId = scmInfo.getClusterId();
        String scmId = scmInfo.getScmId();
        if (clusterId == null || clusterId.isEmpty()) {
          throw new IOException("Invalid Cluster ID");
        }
        if (scmId == null || scmId.isEmpty()) {
          throw new IOException("Invalid SCM ID");
        }
        ksmStorage.setClusterId(clusterId);
        ksmStorage.setScmId(scmId);
        ksmStorage.initialize();
        System.out.println(
            "KSM initialization succeeded.Current cluster id for sd="
                + ksmStorage.getStorageDir() + ";cid=" + ksmStorage
                .getClusterID());
        return true;
      } catch (IOException ioe) {
        LOG.error("Could not initialize KSM version file", ioe);
        return false;
      }
    } else {
      System.out.println(
          "KSM already initialized.Reusing existing cluster id for sd="
              + ksmStorage.getStorageDir() + ";cid=" + ksmStorage
              .getClusterID());
      return true;
    }
  }
private static boolean ksmInit ( OzoneConfiguration conf ) throws IOException { KSMStorage ksmStorage = new KSMStorage ( conf ) ; StorageState state = ksmStorage . getState ( ) ; if ( state != StorageState . INITIALIZED ) { try { ScmBlockLocationProtocol scmBlockClient = getScmBlockClient ( conf ) ; ScmInfo scmInfo = scmBlockClient . getScmInfo ( ) ; String clusterId = scmInfo . getClusterId ( ) ; String scmId = scmInfo . getScmId ( ) ; if ( clusterId == null || clusterId . isEmpty ( ) ) { throw new IOException ( "Invalid Cluster ID" ) ; } if ( scmId == null || scmId . isEmpty ( ) ) { throw new IOException ( "Invalid SCM ID" ) ; } ksmStorage . setClusterId ( clusterId ) ; ksmStorage . setScmId ( scmId ) ; ksmStorage . initialize ( ) ; System . out . println ( "KSM initialization succeeded.Current cluster id for sd=" + ksmStorage . getStorageDir ( ) + ";cid=" + ksmStorage . getClusterID ( ) ) ; return true ; } catch ( IOException ioe ) { LOG . error ( "Could not initialize KSM version file" , ioe ) ; return false ; } } else { System . out . println ( "KSM already initialized.Reusing existing cluster id for sd=" + ksmStorage . getStorageDir ( ) + ";cid=" + ksmStorage . getClusterID ( ) ) ; return true ; } }
Initializes the KSM instance.
Initializes the KSM instance .