ZNRecord convert(DataNodeConfig dataNodeConfig) {
      ZNRecord record = new ZNRecord(dataNodeConfig.getInstanceName());
      record.setIntField(SCHEMA_VERSION_STR, VERSION_0);
      record.setSimpleField(HOSTNAME_FIELD, dataNodeConfig.getHostName());
      record.setIntField(PORT_FIELD, dataNodeConfig.getPort());
      record.setSimpleField(DATACENTER_STR, dataNodeConfig.getDatacenterName());
      if (dataNodeConfig.getSslPort() != null) {
        record.setIntField(SSL_PORT_STR, dataNodeConfig.getSslPort());
      }
      if (dataNodeConfig.getHttp2Port() != null) {
        record.setIntField(HTTP2_PORT_STR, dataNodeConfig.getHttp2Port());
      }
      record.setSimpleField(RACKID_STR, dataNodeConfig.getRackId());
      record.setListField(SEALED_STR, new ArrayList<>(dataNodeConfig.getSealedReplicas()));
      record.setListField(PARTIALLY_SEALED_STR, new ArrayList<>(dataNodeConfig.getPartiallySealedReplicas()));
      record.setListField(STOPPED_REPLICAS_STR, new ArrayList<>(dataNodeConfig.getStoppedReplicas()));
      record.setListField(DISABLED_REPLICAS_STR, new ArrayList<>(dataNodeConfig.getDisabledReplicas()));
      dataNodeConfig.getDiskConfigs().forEach((mountPath, diskConfig) -> {
        Map<String, String> diskProps = new HashMap<>();
        diskProps.put(DISK_STATE, diskConfig.getState() == HardwareState.AVAILABLE ? AVAILABLE_STR : UNAVAILABLE_STR);
        diskProps.put(DISK_CAPACITY_STR, Long.toString(diskConfig.getDiskCapacityInBytes()));
        StringBuilder replicasStrBuilder = new StringBuilder();
        diskConfig.getReplicaConfigs()
            .forEach((partitionName, replicaConfig) -> replicasStrBuilder.append(partitionName)
                .append(REPLICAS_STR_SEPARATOR)
                .append(replicaConfig.getReplicaCapacityInBytes())
                .append(REPLICAS_STR_SEPARATOR)
                .append(replicaConfig.getPartitionClass())
                .append(REPLICAS_DELIM_STR));
        diskProps.put(REPLICAS_STR, replicasStrBuilder.toString());
        record.setMapField(MOUNT_PREFIX + mountPath, diskProps);
      });
      return record;
    }
@param dataNodeConfig the {@link DataNodeConfig} to convert to a {@link ZNRecord} that can be stored in the
                      property store.
@return the {@link ZNRecord}.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/PropertyStoreToDataNodeConfigAdapter.java