DataNodeConfig convert(ZNRecord record) {
      int schemaVersion = getSchemaVersion(record);
      if (schemaVersion != VERSION_0) {
        LOGGER.warn("Unknown InstanceConfig schema version {} in {}. Ignoring.", schemaVersion, record);
        return null;
      }

      DataNodeConfig dataNodeConfig = new DataNodeConfig(record.getId(), record.getSimpleField(HOSTNAME_FIELD),
          record.getIntField(PORT_FIELD, DataNodeId.UNKNOWN_PORT), getDcName(record), getSslPortStr(record),
          getHttp2PortStr(record), getRackId(record), DEFAULT_XID);
      dataNodeConfig.getSealedReplicas().addAll(getSealedReplicas(record));
      dataNodeConfig.getPartiallySealedReplicas().addAll(getPartiallySealedReplicas(record));
      dataNodeConfig.getStoppedReplicas().addAll(getStoppedReplicas(record));
      dataNodeConfig.getDisabledReplicas().addAll(getDisabledReplicas(record));
      record.getMapFields().forEach((key, diskProps) -> {
        if (key.startsWith(MOUNT_PREFIX)) {
          String mountPath = key.substring(MOUNT_PREFIX.length());
          DataNodeConfig.DiskConfig disk = new DataNodeConfig.DiskConfig(
              diskProps.get(DISK_STATE).equals(AVAILABLE_STR) ? HardwareState.AVAILABLE : HardwareState.UNAVAILABLE,
              Long.parseLong(diskProps.get(DISK_CAPACITY_STR)));
          String replicasStr = diskProps.get(REPLICAS_STR);
          if (!Utils.isNullOrEmpty(replicasStr)) {
            for (String replicaStr : replicasStr.split(REPLICAS_DELIM_STR)) {
              String[] replicaStrParts = replicaStr.split(REPLICAS_STR_SEPARATOR);
              // partition name and replica name are the same.
              String partitionName = replicaStrParts[0];
              long replicaCapacity = Long.parseLong(replicaStrParts[1]);
              String partitionClass = replicaStrParts.length > 2 ? replicaStrParts[2] : defaultPartitionClass;
              disk.getReplicaConfigs()
                  .put(partitionName, new DataNodeConfig.ReplicaConfig(replicaCapacity, partitionClass));
            }
          }
          dataNodeConfig.getDiskConfigs().put(mountPath, disk);
        }
      });
      return dataNodeConfig;
    }
@param record the {@link ZNRecord} to convert to a {@link DataNodeConfig} object.
@return the {@link DataNodeConfig}, or {@code null} if the {@link ZNRecord} provided has an unsupported schema
        version.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/PropertyStoreToDataNodeConfigAdapter.java