From 6ed8593d180fe653f78f0a210478555338c4685a Mon Sep 17 00:00:00 2001 From: Mukul Kumar Singh Date: Tue, 7 Aug 2018 16:09:53 +0530 Subject: [PATCH] HDDS-301. ozone command shell does not contain subcommand to run ozoneFS commands. Contributed by Nilotpal Nandi. --- .../hadoop-common/src/main/bin/hadoop-functions.sh | 1 + .../acceptance-test/src/test/acceptance/ozonefs/ozonefs.robot | 4 ++-- .../src/test/acceptance/ozonefs/ozonesinglenode.robot | 4 ++-- hadoop-ozone/common/src/main/bin/ozone | 4 ++++ hadoop-ozone/common/src/main/shellprofile.d/hadoop-ozone.sh | 1 + 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh index cbedd972188..71ba7fffc10 100755 --- a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh +++ b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh @@ -600,6 +600,7 @@ function hadoop_bootstrap HDDS_LIB_JARS_DIR=${HDDS_LIB_JARS_DIR:-"share/hadoop/hdds/lib"} OZONE_DIR=${OZONE_DIR:-"share/hadoop/ozone"} OZONE_LIB_JARS_DIR=${OZONE_LIB_JARS_DIR:-"share/hadoop/ozone/lib"} + OZONEFS_DIR=${OZONEFS_DIR:-"share/hadoop/ozonefs"} HADOOP_TOOLS_HOME=${HADOOP_TOOLS_HOME:-${HADOOP_HOME}} HADOOP_TOOLS_DIR=${HADOOP_TOOLS_DIR:-"share/hadoop/tools"} diff --git a/hadoop-ozone/acceptance-test/src/test/acceptance/ozonefs/ozonefs.robot b/hadoop-ozone/acceptance-test/src/test/acceptance/ozonefs/ozonefs.robot index ea473c0de71..1d3aa4b34cb 100644 --- a/hadoop-ozone/acceptance-test/src/test/acceptance/ozonefs/ozonefs.robot +++ b/hadoop-ozone/acceptance-test/src/test/acceptance/ozonefs/ozonefs.robot @@ -31,9 +31,9 @@ Create volume and bucket Execute on datanode ozone oz -createBucket http://ozoneManager/fstest/bucket1 Check volume from ozonefs - ${result} = Execute on hadooplast hdfs dfs -ls o3://bucket1.fstest/ + ${result} = Execute on datanode ozone fs -ls o3://bucket1.fstest/ Create directory from ozonefs - Execute on hadooplast hdfs dfs -mkdir -p o3://bucket1.fstest/testdir/deep + Execute on datanode ozone fs -mkdir -p o3://bucket1.fstest/testdir/deep ${result} = Execute on ozoneManager ozone oz -listKey o3://ozoneManager/fstest/bucket1 | grep -v WARN | jq -r '.[].keyName' Should contain ${result} testdir/deep diff --git a/hadoop-ozone/acceptance-test/src/test/acceptance/ozonefs/ozonesinglenode.robot b/hadoop-ozone/acceptance-test/src/test/acceptance/ozonefs/ozonesinglenode.robot index b844cee7981..a1a5189ad37 100644 --- a/hadoop-ozone/acceptance-test/src/test/acceptance/ozonefs/ozonesinglenode.robot +++ b/hadoop-ozone/acceptance-test/src/test/acceptance/ozonefs/ozonesinglenode.robot @@ -31,10 +31,10 @@ Create volume and bucket Execute on datanode ozone oz -createBucket http://ozoneManager/fstest/bucket1 Check volume from ozonefs - ${result} = Execute on hadooplast hdfs dfs -ls o3://bucket1.fstest/ + ${result} = Execute on datanode ozone fs -ls o3://bucket1.fstest/ Create directory from ozonefs - Execute on hadooplast hdfs dfs -mkdir -p o3://bucket1.fstest/testdir/deep + Execute on datanode ozone fs -mkdir -p o3://bucket1.fstest/testdir/deep ${result} = Execute on ozoneManager ozone oz -listKey o3://ozoneManager/fstest/bucket1 | grep -v WARN | jq -r '.[].keyName' Should contain ${result} testdir/deep Test key handling diff --git a/hadoop-ozone/common/src/main/bin/ozone b/hadoop-ozone/common/src/main/bin/ozone index 927bc84a149..5d1b6bc8805 100755 --- a/hadoop-ozone/common/src/main/bin/ozone +++ b/hadoop-ozone/common/src/main/bin/ozone @@ -34,6 +34,7 @@ function hadoop_usage hadoop_add_subcommand "classpath" client "prints the class path needed to get the hadoop jar and the required libraries" + hadoop_add_subcommand "fs" client "run a filesystem command on ozone file system" hadoop_add_subcommand "datanode" daemon "run a HDDS datanode" hadoop_add_subcommand "envvars" client "display computed Hadoop environment variables" hadoop_add_subcommand "freon" client "runs an ozone data generator" @@ -109,6 +110,9 @@ function ozonecmd_case hadoop_debug "Appending HDFS_STORAGECONTAINERMANAGER_OPTS onto HADOOP_OPTS" HADOOP_OPTS="${HADOOP_OPTS} ${HDFS_STORAGECONTAINERMANAGER_OPTS}" ;; + fs) + HADOOP_CLASSNAME=org.apache.hadoop.fs.FsShell + ;; scmcli) HADOOP_CLASSNAME=org.apache.hadoop.ozone.scm.cli.SCMCLI ;; diff --git a/hadoop-ozone/common/src/main/shellprofile.d/hadoop-ozone.sh b/hadoop-ozone/common/src/main/shellprofile.d/hadoop-ozone.sh index 2cd2bb317d2..99885abe226 100644 --- a/hadoop-ozone/common/src/main/shellprofile.d/hadoop-ozone.sh +++ b/hadoop-ozone/common/src/main/shellprofile.d/hadoop-ozone.sh @@ -40,5 +40,6 @@ function _ozone_hadoop_classpath hadoop_add_classpath "${HADOOP_HDFS_HOME}/${HDDS_DIR}"'/*' hadoop_add_classpath "${HADOOP_HDFS_HOME}/${OZONE_LIB_JARS_DIR}"'/*' hadoop_add_classpath "${HADOOP_HDFS_HOME}/${OZONE_DIR}"'/*' + hadoop_add_classpath "${HADOOP_HDFS_HOME}/${OZONEFS_DIR}"'/*' }