<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffcc" text="#000066">
<tt>Same on thing on this one.<br>
<br>
</tt>
<pre class="moz-signature" cols="72">Regards,

Marcos Eduardo Matsunaga

Oracle USA
Linux Engineering

“The statements and opinions expressed here are my own and do not
necessarily represent those of Oracle Corporation.”
</pre>
<br>
<br>
Tristan Ye wrote:
<blockquote
 cite="mid:1223968457-21498-2-git-send-email-tristan.ye@oracle.com"
 type="cite">
  <pre wrap="">1.Chown and chmod working place and log dir.
2.Need to sudo run mpirun for inline-data test.

Signed-off-by: Tristan Ye <a class="moz-txt-link-rfc2396E" href="mailto:tristan.ye@oracle.com">&lt;tristan.ye@oracle.com&gt;</a>
---
 programs/inline-data/multi-inline-run.sh  |   42 ++++++++++++++--------------
 programs/inline-data/single-inline-run.sh |   24 +++++++++++++++-
 2 files changed, 43 insertions(+), 23 deletions(-)

diff --git a/programs/inline-data/multi-inline-run.sh b/programs/inline-data/multi-inline-run.sh
index b9c3fce..525080d 100755
--- a/programs/inline-data/multi-inline-run.sh
+++ b/programs/inline-data/multi-inline-run.sh
@@ -19,11 +19,9 @@
 PATH=$PATH:/sbin      # Add /sbin to the path for ocfs2 tools
 export PATH=$PATH:.
 
-MPI_RUN=`rpm -ql openmpi|grep bin|grep mpirun`
-MPI_BIN_PATH=`dirname ${MPI_RUN}`
-export PATH=$PATH:$MPI_BIN_PATH
+. ./config.sh
 
-MPIRUN_BIN="`which mpirun`"
+#MPIRUN="`which mpirun`"
 
 RM="`which rm`"
 MKDIR="`which mkdir`"
@@ -32,15 +30,19 @@ RSH_BIN="`which rsh`"
 SSH_BIN="`which ssh`"
 REMOTE_SH_BIN=${SSH_BIN}
 
+USERNAME=`/usr/bin/whoami`
+GROUPNAME=`id -gn`
+
+SUDO="`which sudo` -u root"
 AWK_BIN="`which awk`"
 TOUCH_BIN="`which touch`"
 MOUNT_BIN="`which sudo` -u root `which mount`"
-REMOTE_MOUNT_BIN="`which sudo` -u root `which remote_mount.py`"
+REMOTE_MOUNT_BIN="`which remote_mount.py`"
 UMOUNT_BIN="`which sudo` -u root `which umount`"
-REMOTE_UMOUNT_BIN="`which sudo` -u root `which remote_umount.py`"
+REMOTE_UMOUNT_BIN="`which remote_umount.py`"
 MKFS_BIN="`which sudo` -u root `which mkfs.ocfs2`"
-INLINE_DATA_BIN=`which multi-inline-data`
-INLINE_DIRS_BIN=`which multi-inline-dirs`
+INLINE_DATA_BIN="`which sudo` -u root `which multi-inline-data`"
+INLINE_DIRS_BIN="`which sudo` -u root `which multi-inline-dirs`"
 DEFAULT_LOG="multiple-inline-data-test-logs"
 LOG_OUT_DIR=
 DATA_LOG_FILE=
@@ -167,7 +169,7 @@ f_create_hostfile()
         echo ${MPI_HOSTS}|sed -e 's/,/\n/g'&gt;$TMP_FILE
 
         if [ -f "$MPI_HOSTFILE" ];then
-                ${RM} -rf ${MPI_HOSTFILE}
+               ${RM} -rf ${MPI_HOSTFILE}
         fi
 
         while read line
@@ -176,7 +178,7 @@ f_create_hostfile()
                         continue
                 fi
 
-                echo "$line      slots=2"&gt;&gt;$MPI_HOSTFILE
+                echo "$line"&gt;&gt;$MPI_HOSTFILE
 
         done&lt;$TMP_FILE
 
@@ -186,10 +188,6 @@ f_create_hostfile()
 
 f_setup()
 {
-        rpm -q --quiet openmpi ||{
-                echo "Need to install openmpi in advance"
-                exit 1
-        }
 
         f_getoptions $*
 
@@ -201,8 +199,8 @@ f_setup()
         if [ -z "${MOUNT_POINT}" ];then
                 f_usage
         else
-                if [ ! -d ${MOUNT_POINT} -o ! -w ${MOUNT_POINT} ]; then
-                        echo "Mount point ${MOUNT_POINT} does not exist or is not writable." 
+                if [ ! -d ${MOUNT_POINT} ]; then
+                        echo "Mount point ${MOUNT_POINT} does not exist." 
                         exit 1
                 else
                         if [ "`dirname ${MOUNT_POINT}`" = "/" ]; then
@@ -256,6 +254,8 @@ f_do_mkfs_and_mount()
         RET=$?
         echo_status ${RET} |tee -a ${RUN_LOG_FILE}
         exit_or_not ${RET}
+        ${SUDO} chown -R ${USERNAME}:${GROUPNAME} ${MOUNT_POINT}
+        ${SUDO} chmod -R 777 ${MOUNT_POINT}
 
 
 } 
@@ -290,7 +290,7 @@ f_run_data_test()
         echo "=========================================================="&gt;&gt;${DATA_LOG_FILE}
         echo -e "Testing Binary:\t\t${INLINE_DATA_BIN} -i 1 -d ${OCFS2_DEVICE} ${MOUNT_POINT}"&gt;&gt;${DATA_LOG_FILE}
 
-        ${MPIRUN_BIN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -mca btl_tcp_if_include eth0 -np ${MPI_RANKS} --hostfile ${MPI_HOSTFILE} ${INLINE_DATA_BIN} -i 1 -d ${OCFS2_DEVICE} ${MOUNT_POINT}&gt;&gt;${DATA_LOG_FILE} 2&gt;&amp;1
+        ${SUDO} ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -mca btl_tcp_if_include eth0 -np ${MPI_RANKS} --hostfile ${MPI_HOSTFILE} ${INLINE_DATA_BIN} -i 1 -d ${OCFS2_DEVICE} ${MOUNT_POINT}&gt;&gt;${DATA_LOG_FILE} 2&gt;&amp;1
         RET=$?
         echo_status ${RET} |tee -a ${RUN_LOG_FILE}
         exit_or_not ${RET}
@@ -304,7 +304,7 @@ f_run_data_test()
         echo "=========================================================="&gt;&gt;${DATA_LOG_FILE}
         echo -e "Testing Binary:\t\t${INLINE_DATA_BIN} -i 50 -d ${OCFS2_DEVICE} ${MOUNT_POINT}"&gt;&gt;${DATA_LOG_FILE}
 
-        ${MPIRUN_BIN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -mca btl_tcp_if_include eth0 -np ${MPI_RANKS} --hostfile ${MPI_HOSTFILE} ${INLINE_DATA_BIN} -i 200  -d ${OCFS2_DEVICE} ${MOUNT_POINT}&gt;&gt;${DATA_LOG_FILE} 2&gt;&amp;1
+        ${SUDO} ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -mca btl_tcp_if_include eth0 -np ${MPI_RANKS} --hostfile ${MPI_HOSTFILE} ${INLINE_DATA_BIN} -i 200  -d ${OCFS2_DEVICE} ${MOUNT_POINT}&gt;&gt;${DATA_LOG_FILE} 2&gt;&amp;1
         RET=$?
         echo_status ${RET} |tee -a ${RUN_LOG_FILE}
         exit_or_not ${RET}
@@ -321,7 +321,7 @@ f_run_dirs_test()
         echo "=========================================================="&gt;&gt;${DIRS_LOG_FILE}
         echo -e "Testing Binary:\t\t${INLINE_DIRS_BIN} -i 1 -s 20 -d ${OCFS2_DEVICE} ${MOUNT_POINT}"&gt;&gt;${DIRS_LOG_FILE}
 
-        ${MPIRUN_BIN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -mca btl_tcp_if_include eth0 -np ${MPI_RANKS} --hostfile ${MPI_HOSTFILE}  ${INLINE_DIRS_BIN} -i 1 -s 20 -d ${OCFS2_DEVICE} ${MOUNT_POINT}&gt;&gt;${DIRS_LOG_FILE} 2&gt;&amp;1
+        ${SUDO} ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -mca btl_tcp_if_include eth0 -np ${MPI_RANKS} --hostfile ${MPI_HOSTFILE}  ${INLINE_DIRS_BIN} -i 1 -s 20 -d ${OCFS2_DEVICE} ${MOUNT_POINT}&gt;&gt;${DIRS_LOG_FILE} 2&gt;&amp;1
         RET=$?
         echo_status ${RET} |tee -a ${RUN_LOG_FILE}
         exit_or_not ${RET}
@@ -335,7 +335,7 @@ f_run_dirs_test()
         echo "=========================================================="&gt;&gt;${DIRS_LOG_FILE}
         echo -e "Testing Binary:\t\t${INLINE_DIRS_BIN} -i 1 -s 100 -d ${OCFS2_DEVICE} ${MOUNT_POINT}"&gt;&gt;${DIRS_LOG_FILE}
 
-        ${MPIRUN_BIN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -mca btl_tcp_if_include eth0 -np ${MPI_RANKS} --hostfile ${MPI_HOSTFILE}  ${INLINE_DIRS_BIN} -i 1 -s 100 -d ${OCFS2_DEVICE} ${MOUNT_POINT}&gt;&gt;${DIRS_LOG_FILE} 2&gt;&amp;1
+        ${SUDO} ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -mca btl_tcp_if_include eth0 -np ${MPI_RANKS} --hostfile ${MPI_HOSTFILE}  ${INLINE_DIRS_BIN} -i 1 -s 100 -d ${OCFS2_DEVICE} ${MOUNT_POINT}&gt;&gt;${DIRS_LOG_FILE} 2&gt;&amp;1
         RET=$?
         echo_status ${RET} |tee -a ${RUN_LOG_FILE}
         exit_or_not ${RET}
@@ -349,7 +349,7 @@ f_run_dirs_test()
         echo "=========================================================="&gt;&gt;${DIRS_LOG_FILE}
         echo -e "Testing Binary:\t\t${INLINE_DIRS_BIN} -i 5 -s 20 -d ${OCFS2_DEVICE} ${MOUNT_POINT}"&gt;&gt;${DIRS_LOG_FILE}
 
-        ${MPIRUN_BIN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -mca btl_tcp_if_include eth0 -np ${MPI_RANKS} --hostfile ${MPI_HOSTFILE}  ${INLINE_DIRS_BIN} -i 1 -s 20 -d ${OCFS2_DEVICE} ${MOUNT_POINT}&gt;&gt;${DIRS_LOG_FILE} 2&gt;&amp;1
+        ${SUDO} ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -mca btl_tcp_if_include eth0 -np ${MPI_RANKS} --hostfile ${MPI_HOSTFILE}  ${INLINE_DIRS_BIN} -i 1 -s 20 -d ${OCFS2_DEVICE} ${MOUNT_POINT}&gt;&gt;${DIRS_LOG_FILE} 2&gt;&amp;1
         RET=$?
         echo_status ${RET} |tee -a ${RUN_LOG_FILE}
         exit_or_not ${RET}
diff --git a/programs/inline-data/single-inline-run.sh b/programs/inline-data/single-inline-run.sh
index ceecee3..6e34253 100755
--- a/programs/inline-data/single-inline-run.sh
+++ b/programs/inline-data/single-inline-run.sh
@@ -18,14 +18,19 @@
 ################################################################################
 PATH=$PATH:/sbin      # Add /sbin to the path for ocfs2 tools
 export PATH=$PATH:.
+
+USERNAME=`/usr/bin/whoami`
+GROUPNAME=`id -gn`
+
+SUDO="`which sudo` -u root"
 RM="`which rm`"
 MKDIR="`which mkdir`"
 TOUCH_BIN="`which touch`"
 MOUNT_BIN="`which sudo` -u root `which mount`"
 UMOUNT_BIN="`which sudo` -u root `which umount`"
 MKFS_BIN="`which sudo` -u root `which mkfs.ocfs2`"
-INLINE_DATA_BIN=`which inline-data`
-INLINE_DIRS_BIN=`which inline-dirs`
+INLINE_DATA_BIN="`which sudo` -u root `which inline-data`"
+INLINE_DIRS_BIN="`which sudo` -u root `which inline-dirs`"
 DEFAULT_LOG="inline-data-test-logs"
 LOG_OUT_DIR=
 DATA_LOG_FILE=
@@ -134,6 +139,18 @@ f_setup()
 
         if [ -z "${MOUNT_POINT}" ];then
                 f_usage
+        else
+                if [ ! -d ${MOUNT_POINT} ]; then
+                        echo "Mount point ${MOUNT_POINT} does not exist."
+                        exit 1
+                else
+                        #To assure that mount point will not end with a trailing '/'
+                        if [ "`dirname ${MOUNT_POINT}`" = "/" ]; then
+                                MOUNT_POINT="`dirname ${MOUNT_POINT}``basename ${MOUNT_POINT}`"
+                        else
+                                MOUNT_POINT="`dirname ${MOUNT_POINT}`/`basename ${MOUNT_POINT}`"
+                        fi
+                fi
         fi
 
         LOG_OUT_DIR=${LOG_OUT_DIR:-$DEFAULT_LOG}
@@ -164,6 +181,9 @@ f_do_mkfs_and_mount()
         RET=$?
         echo_status ${RET} |tee -a ${RUN_LOG_FILE}
         exit_or_not ${RET}
+
+        ${SUDO} chown -R ${USERNAME}:${GROUPNAME} ${MOUNT_POINT}
+        ${SUDO} chmod -R 777 ${MOUNT_POINT}
 } 
 
 f_run_data_test()
  </pre>
</blockquote>
</body>
</html>