<!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 here. You are assuming all nodes have a common NIC name for
public or private network.<br>
<br>
Other than that, it looks good to me.<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:1255167394-21149-2-git-send-email-tristan.ye@oracle.com"
 type="cite">
  <pre wrap="">As we know, a same volume may be treated by different device name among nodes who share
the disk. and our former multi-inline-tests will definitely fail due to this reason.

To solve this issue, we try to pass UUID of a volume to mpi binary, and the binary
convert the UUID to a device name on its own, which will be later called by ocfs2_open() in 
our testing binary.

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/inline-data-utils.c |   22 ++++++++++++++++-
 programs/inline-data/multi-inline-data.c |   21 ++++++++++-----
 programs/inline-data/multi-inline-dirs.c |   39 ++++++++++++++++++++++++-----
 programs/inline-data/multi-inline-run.sh |   23 ++++++++++-------
 4 files changed, 80 insertions(+), 25 deletions(-)

diff --git a/programs/inline-data/inline-data-utils.c b/programs/inline-data/inline-data-utils.c
index 415ad2d..4e5f9fa 100644
--- a/programs/inline-data/inline-data-utils.c
+++ b/programs/inline-data/inline-data-utils.c
@@ -62,7 +62,6 @@ extern char mount_point[OCFS2_MAX_FILENAME_LEN];
 extern char work_place[OCFS2_MAX_FILENAME_LEN];
 extern char file_name[OCFS2_MAX_FILENAME_LEN];
 
-
 unsigned long get_rand(unsigned long min, unsigned long max)
 {
         if (min == 0 &amp;&amp; max == 0)
@@ -324,6 +323,27 @@ int verify_pattern_mmap(int fd, unsigned int size)
         return 0;
 }
 
+int uuid2dev(const char *uuid, char *dev)
+{
+        FILE *df;
+        char cmd[300];
+
+        snprintf(cmd, 300, "blkid |grep %s|cut -d':' -f1", uuid);
+
+        df = popen(cmd, "r");
+
+        if (df == NULL) {
+                fprintf(stderr, "popen failed to get dev name.\n");
+                return -1;
+        }
+
+        fscanf(df, "%s\n", dev);
+
+        pclose(df);
+
+        return 0;
+}
+
 int open_ocfs2_volume(char *device_name)
 {
         int open_flags = OCFS2_FLAG_HEARTBEAT_DEV_OK | OCFS2_FLAG_RO;
diff --git a/programs/inline-data/multi-inline-data.c b/programs/inline-data/multi-inline-data.c
index 7a6b929..2529780 100755
--- a/programs/inline-data/multi-inline-data.c
+++ b/programs/inline-data/multi-inline-data.c
@@ -70,6 +70,7 @@
 
 static char *prog;
 static char device[100];
+static char uuid[100];
 
 ocfs2_filesys *fs;
 struct ocfs2_super_block *ocfs2_sb;
@@ -113,6 +114,7 @@ extern int verify_pattern(int size, char *buf);
 extern int __verify_pattern_fd(int fd, unsigned int size, int direct_read);
 extern int verify_pattern_fd(int fd, unsigned int size);
 extern int verify_pattern_mmap(int fd, unsigned int size);
+extern int uuid2dev(const char *uuid, char *dev);
 extern int open_ocfs2_volume(char *device_name);
 extern int is_file_inlined(char *dirent_name, unsigned long *i_size,
                            unsigned int *id_count);
@@ -120,11 +122,11 @@ extern int is_file_inlined(char *dirent_name, unsigned long *i_size,
 static void usage(void)
 {
         printf("Usage: multi-inline-data [-i &lt;iteration&gt;] "
-               "&lt;-d &lt;device&gt;&gt; &lt;mount_point&gt;\n"
+               "&lt;-u &lt;uuid&gt;&gt; &lt;mount_point&gt;\n"
                "Run a series of tests intended to verify I/O to and from\n"
                "files/dirs with inline data.\n\n"
                "iteration specify the running times.\n"
-               "device and mount_point are mandatory.\n");
+               "uuid and mount_point are mandatory.\n");
 
         MPI_Finalize();
 
@@ -156,7 +158,7 @@ static int parse_opts(int argc, char **argv)
 {
         int c;
         while (1) {
-                c = getopt(argc, argv, "D:d:I:i:");
+                c = getopt(argc, argv, "U:u:I:i:");
                 if (c == -1)
                         break;
                 switch (c) {
@@ -164,16 +166,16 @@ static int parse_opts(int argc, char **argv)
                 case 'I':
                         iteration = atol(optarg);
                         break;
-                case 'd':
-                case 'D':
-                        strcpy(device, optarg);
+                case 'u':
+                case 'U':
+                        strcpy(uuid, optarg);
                         break;
                 default:
                         break;
                 }
         }
 
-        if (strcmp(device, "") == 0)
+        if (strcmp(uuid, "") == 0)
                 return EINVAL;
 
         if (argc - optind != 1)
@@ -183,6 +185,11 @@ static int parse_opts(int argc, char **argv)
         if (mount_point[strlen(mount_point) - 1] == '/')
                  mount_point[strlen(mount_point) - 1] = '\0';
 
+        memset(device, 0, 100);
+
+        if (uuid2dev(uuid, device))
+                abort_printf("Failed to get device name from uuid!\n");
+
         return 0;
 
 }
diff --git a/programs/inline-data/multi-inline-dirs.c b/programs/inline-data/multi-inline-dirs.c
index e3be06b..1001e06 100644
--- a/programs/inline-data/multi-inline-dirs.c
+++ b/programs/inline-data/multi-inline-dirs.c
@@ -71,6 +71,7 @@ struct my_dirent {
 
 static char *prog;
 static char device[100];
+static char uuid[100];
 
 static ocfs2_filesys *fs;
 static struct ocfs2_super_block *ocfs2_sb;
@@ -128,13 +129,13 @@ static inline char rand_char(void)
 static void usage(void)
 {
         printf("Usage: multi-inline-dirs [-i &lt;iteration&gt;] [-s operated_entries] "
-               "&lt;-d &lt;device&gt;&gt; &lt;mount_point&gt;\n"
+               "&lt;-u &lt;uuid&gt;&gt; &lt;mount_point&gt;\n"
                "Run a series of tests intended to verify I/O to and from\n"
                "dirs with inline data.\n\n"
                "iteration specify the running times.\n"
                "operated_dir_entries specify the entires number to be "
                "operated,such as random create/unlink/rename.\n"
-               "device and mount_point are mandatory.\n");
+               "uuid and mount_point are mandatory.\n");
 
         MPI_Finalize();
         exit(1);
@@ -165,7 +166,7 @@ static int parse_opts(int argc, char **argv)
 {
         int c;
         while (1) {
-                c = getopt(argc, argv, "D:d:I:i:S:s:");
+                c = getopt(argc, argv, "U:u:I:i:S:s:");
                 if (c == -1)
                         break;
                 switch (c) {
@@ -173,9 +174,9 @@ static int parse_opts(int argc, char **argv)
                 case 'I':
                         iteration = atol(optarg);
                         break;
-                case 'd':
-                case 'D':
-                        strcpy(device, optarg);
+                case 'u':
+                case 'U':
+                        strcpy(uuid, optarg);
                         break;
                 case 's':
                 case 'S':
@@ -185,7 +186,7 @@ static int parse_opts(int argc, char **argv)
                 }
         }
 
-        if (strcmp(device, "") == 0)
+        if (strcmp(uuid, "") == 0)
                 return EINVAL;
 
         if (argc - optind != 1)
@@ -1123,6 +1124,25 @@ static void run_large_dir_tests(void)
                 abort_printf("MPI_Barrier failed: %d\n", ret);
 }
 
+static int uuid2dev(const char *uuid, char *dev)
+{
+        FILE *df;
+        char cmd[300];
+
+        snprintf(cmd, 300, "blkid |grep %s|cut -d':' -f1", uuid);
+
+        df = popen(cmd, "r");
+        if (df == NULL) {
+                fprintf(stderr, "popen failed to get dev name.\n");
+                return -1;
+        }
+
+        fscanf(df, "%s\n", dev);
+
+        pclose(df);
+        return 0;
+}
+
 static int open_ocfs2_volume(char *device_name)
 {
         int open_flags = OCFS2_FLAG_HEARTBEAT_DEV_OK | OCFS2_FLAG_RO;
@@ -1243,6 +1263,11 @@ static void setup(int argc, char *argv[])
         if (parse_opts(argc, argv))
                 usage();
 
+        memset(device, 0, 100);
+
+        if (uuid2dev(uuid, device))
+                abort_printf("Failed to get device name from uuid!\n");
+
         ret = open_ocfs2_volume(device);
         if (ret &lt; 0)
                 abort_printf("open ocfs2 volume failed!\n");
diff --git a/programs/inline-data/multi-inline-run.sh b/programs/inline-data/multi-inline-run.sh
index 6b18903..c1db4b5 100755
--- a/programs/inline-data/multi-inline-run.sh
+++ b/programs/inline-data/multi-inline-run.sh
@@ -50,6 +50,7 @@ DIRS_LOG_FILE=
 RUN_LOG_FILE=
 MOUNT_POINT=
 OCFS2_DEVICE=
+OCFS2_UUID=
 
 BLOCKSIZE=
 CLUSTERSIZE=
@@ -200,6 +201,8 @@ f_setup()
         if [ -z "$MPI_HOSTS" ];then
                 f_usage
         fi
+
+        OCFS2_UUID=`blkid |grep ${OCFS2_DEVICE}|cut -d' ' -f3|cut -d'"' -f2`
 }
 
 f_do_mkfs_and_mount()
@@ -240,9 +243,9 @@ f_run_data_test()
         echo -ne "Functionality Test For Regular File Among Nodes:"&gt;&gt; ${DATA_LOG_FILE}
         echo &gt;&gt;${DATA_LOG_FILE}
         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}
+        echo -e "Testing Binary:\t\t${INLINE_DATA_BIN} -i 1 -u ${OCFS2_UUID} ${MOUNT_POINT}"&gt;&gt;${DATA_LOG_FILE}
 
-        ${SUDO} ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -mca btl_tcp_if_include eth0 -np ${MPI_RANKS} --host ${MPI_HOSTS} ${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} --host ${MPI_HOSTS} ${INLINE_DATA_BIN} -i 1 -u ${OCFS2_UUID} ${MOUNT_POINT}&gt;&gt;${DATA_LOG_FILE} 2&gt;&amp;1
         RET=$?
         echo_status ${RET} |tee -a ${RUN_LOG_FILE}
         exit_or_not ${RET}
@@ -254,9 +257,9 @@ f_run_data_test()
         echo -ne "Stress Test For Regular File Among Nodes:"&gt;&gt; ${DATA_LOG_FILE}             
         echo &gt;&gt;${DATA_LOG_FILE}
         echo "=========================================================="&gt;&gt;${DATA_LOG_FILE}
-        echo -e "Testing Binary:\t\t${INLINE_DATA_BIN} -i 200 -d ${OCFS2_DEVICE} ${MOUNT_POINT}"&gt;&gt;${DATA_LOG_FILE}
+        echo -e "Testing Binary:\t\t${INLINE_DATA_BIN} -i 200 -u ${OCFS2_UUID} ${MOUNT_POINT}"&gt;&gt;${DATA_LOG_FILE}
 
-        ${SUDO} ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -mca btl_tcp_if_include eth0 -np ${MPI_RANKS} --host ${MPI_HOSTS} ${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} --host ${MPI_HOSTS} ${INLINE_DATA_BIN} -i 200 -u ${OCFS2_UUID} ${MOUNT_POINT}&gt;&gt;${DATA_LOG_FILE} 2&gt;&amp;1
         RET=$?
         echo_status ${RET} |tee -a ${RUN_LOG_FILE}
         exit_or_not ${RET}
@@ -271,9 +274,9 @@ f_run_dirs_test()
         echo -ne "Functionality Test For Directory Among Nodes:"&gt;&gt; ${DIRS_LOG_FILE}
         echo &gt;&gt;${DIRS_LOG_FILE}
         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}
+        echo -e "Testing Binary:\t\t${INLINE_DIRS_BIN} -i 1 -s 20 -u ${OCFS2_UUID} ${MOUNT_POINT}"&gt;&gt;${DIRS_LOG_FILE}
 
-        ${SUDO} ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -mca btl_tcp_if_include eth0 -np ${MPI_RANKS} --host ${MPI_HOSTS}  ${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} --host ${MPI_HOSTS}  ${INLINE_DIRS_BIN} -i 1 -s 20 -u ${OCFS2_UUID} ${MOUNT_POINT}&gt;&gt;${DIRS_LOG_FILE} 2&gt;&amp;1
         RET=$?
         echo_status ${RET} |tee -a ${RUN_LOG_FILE}
         exit_or_not ${RET}
@@ -285,9 +288,9 @@ f_run_dirs_test()
         echo -ne "Stress Test I Test For Directory Among Nodes:"&gt;&gt; ${DIRS_LOG_FILE}
         echo &gt;&gt;${DIRS_LOG_FILE}
         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}
+        echo -e "Testing Binary:\t\t${INLINE_DIRS_BIN} -i 1 -s 100 -u ${OCFS2_UUID} ${MOUNT_POINT}"&gt;&gt;${DIRS_LOG_FILE}
 
-        ${SUDO} ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -mca btl_tcp_if_include eth0 -np ${MPI_RANKS} --host ${MPI_HOSTS}  ${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} --host ${MPI_HOSTS}  ${INLINE_DIRS_BIN} -i 1 -s 100 -u ${OCFS2_UUID} ${MOUNT_POINT}&gt;&gt;${DIRS_LOG_FILE} 2&gt;&amp;1
         RET=$?
         echo_status ${RET} |tee -a ${RUN_LOG_FILE}
         exit_or_not ${RET}
@@ -299,9 +302,9 @@ f_run_dirs_test()
         echo -ne "Stress Test II Test For Directory Among Nodes:"&gt;&gt; ${DIRS_LOG_FILE}
         echo &gt;&gt;${DIRS_LOG_FILE}
         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}
+        echo -e "Testing Binary:\t\t${INLINE_DIRS_BIN} -i 5 -s 20 -u ${OCFS2_UUID} ${MOUNT_POINT}"&gt;&gt;${DIRS_LOG_FILE}
 
-        ${SUDO} ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -mca btl_tcp_if_include eth0 -np ${MPI_RANKS} --host ${MPI_HOSTS}  ${INLINE_DIRS_BIN} -i 5 -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} --host ${MPI_HOSTS}  ${INLINE_DIRS_BIN} -i 5 -s 20 -u ${OCFS2_UUID} ${MOUNT_POINT}&gt;&gt;${DIRS_LOG_FILE} 2&gt;&amp;1
         RET=$?
         echo_status ${RET} |tee -a ${RUN_LOG_FILE}
         exit_or_not ${RET}
  </pre>
</blockquote>
</body>
</html>