diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfigKeys.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfigKeys.java index 2c267fb176..b097321507 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfigKeys.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfigKeys.java @@ -368,8 +368,6 @@ public final class ScmConfigKeys { "hdds.scm.http.kerberos.keytab"; // Network topology - public static final String OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE_TYPE = - "ozone.scm.network.topology.schema.file.type"; public static final String OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE = "ozone.scm.network.topology.schema.file"; public static final String OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE_DEFAULT = diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NodeSchemaManager.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NodeSchemaManager.java index 8e5d935e61..9a598c6192 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NodeSchemaManager.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NodeSchemaManager.java @@ -19,6 +19,7 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; +import org.apache.commons.io.FilenameUtils; import org.apache.hadoop.hdds.scm.ScmConfigKeys; import org.apache.hadoop.hdds.scm.net.NodeSchemaLoader.NodeSchemaLoadResult; import org.slf4j.Logger; @@ -59,16 +60,14 @@ public void init(Configuration conf) { /** * Load schemas from network topology schema configuration file */ - String schemaFileType = conf.get( - ScmConfigKeys.OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE_TYPE); - String schemaFile = conf.get( ScmConfigKeys.OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE, ScmConfigKeys.OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE_DEFAULT); NodeSchemaLoadResult result; try { - if (schemaFileType.toLowerCase().compareTo("yaml") == 0) { + if (FilenameUtils.getExtension(schemaFile).toLowerCase() + .compareTo("yaml") == 0) { result = NodeSchemaLoader.getInstance().loadSchemaFromYaml(schemaFile); } else { result = NodeSchemaLoader.getInstance().loadSchemaFromXml(schemaFile); diff --git a/hadoop-hdds/common/src/main/resources/ozone-default.xml b/hadoop-hdds/common/src/main/resources/ozone-default.xml index f40040c6fc..162c93f70d 100644 --- a/hadoop-hdds/common/src/main/resources/ozone-default.xml +++ b/hadoop-hdds/common/src/main/resources/ozone-default.xml @@ -2288,10 +2288,12 @@ ozone.scm.network.topology.schema.file - network-topology-default.xm + network-topology-default.xml OZONE, MANAGEMENT - The schema file defines the ozone network topology + The schema file defines the ozone network topology. We currently support + xml(default) and yaml format. Refer to the samples in the topology + awareness document for xml and yaml topology definition samples.