HDDS-1450. Fix nightly run failures after HDDS-976. Contributed by Xiaoyu Yao. (#757)

This commit is contained in:
Xiaoyu Yao 2019-04-23 21:38:23 -07:00 committed by Ajay Yadav
parent 3f2f4186f6
commit 64f30da428
3 changed files with 7 additions and 8 deletions

View File

@ -368,8 +368,6 @@ public final class ScmConfigKeys {
"hdds.scm.http.kerberos.keytab"; "hdds.scm.http.kerberos.keytab";
// Network topology // 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 = public static final String OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE =
"ozone.scm.network.topology.schema.file"; "ozone.scm.network.topology.schema.file";
public static final String OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE_DEFAULT = public static final String OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE_DEFAULT =

View File

@ -19,6 +19,7 @@ package org.apache.hadoop.hdds.scm.net;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions; 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.ScmConfigKeys;
import org.apache.hadoop.hdds.scm.net.NodeSchemaLoader.NodeSchemaLoadResult; import org.apache.hadoop.hdds.scm.net.NodeSchemaLoader.NodeSchemaLoadResult;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -59,16 +60,14 @@ public final class NodeSchemaManager {
/** /**
* Load schemas from network topology schema configuration file * Load schemas from network topology schema configuration file
*/ */
String schemaFileType = conf.get(
ScmConfigKeys.OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE_TYPE);
String schemaFile = conf.get( String schemaFile = conf.get(
ScmConfigKeys.OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE, ScmConfigKeys.OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE,
ScmConfigKeys.OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE_DEFAULT); ScmConfigKeys.OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE_DEFAULT);
NodeSchemaLoadResult result; NodeSchemaLoadResult result;
try { try {
if (schemaFileType.toLowerCase().compareTo("yaml") == 0) { if (FilenameUtils.getExtension(schemaFile).toLowerCase()
.compareTo("yaml") == 0) {
result = NodeSchemaLoader.getInstance().loadSchemaFromYaml(schemaFile); result = NodeSchemaLoader.getInstance().loadSchemaFromYaml(schemaFile);
} else { } else {
result = NodeSchemaLoader.getInstance().loadSchemaFromXml(schemaFile); result = NodeSchemaLoader.getInstance().loadSchemaFromXml(schemaFile);

View File

@ -2288,10 +2288,12 @@
</property> </property>
<property> <property>
<name>ozone.scm.network.topology.schema.file</name> <name>ozone.scm.network.topology.schema.file</name>
<value>network-topology-default.xm</value> <value>network-topology-default.xml</value>
<tag>OZONE, MANAGEMENT</tag> <tag>OZONE, MANAGEMENT</tag>
<description> <description>
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.
</description> </description>
</property> </property>
<property> <property>