All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Ren <zren@suse.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 15/17] Handle the case when a symbolic link device is given
Date: Tue, 13 Dec 2016 13:29:33 +0800	[thread overview]
Message-ID: <1481606975-13186-16-git-send-email-zren@suse.com> (raw)
In-Reply-To: <1481606975-13186-1-git-send-email-zren@suse.com>

It's a usual case that the shared disk is given in symbolic
name, like iscsi disk "/dev/disk/by-path/disk". So work out
the typical device name in such case.

Signed-off-by: Eric Ren <zren@suse.com>
---
 programs/discontig_bg_test/discontig_runner.sh |  5 +++++
 programs/python_common/multiple_run.sh         | 13 +++++++++++++
 programs/python_common/single_run-WIP.sh       |  6 ++++++
 3 files changed, 24 insertions(+)

diff --git a/programs/discontig_bg_test/discontig_runner.sh b/programs/discontig_bg_test/discontig_runner.sh
index 4c13adb..182ca3a 100755
--- a/programs/discontig_bg_test/discontig_runner.sh
+++ b/programs/discontig_bg_test/discontig_runner.sh
@@ -126,6 +126,11 @@ function f_setup()
 	if [ -z "${DEVICE}" ];then
 		f_usage
 	fi	
+
+	# if a symbollink is given, work out the typical device name, like /dev/sda
+	if [ -L ${DEVICE} ];then
+		DEVICE=`readlink -f ${DEVICE}`
+	fi
 	
 	if [ -z "${MOUNT_POINT}" ];then
 		f_usage
diff --git a/programs/python_common/multiple_run.sh b/programs/python_common/multiple_run.sh
index 74c3531..3e11abd 100755
--- a/programs/python_common/multiple_run.sh
+++ b/programs/python_common/multiple_run.sh
@@ -135,6 +135,19 @@ f_setup()
 
 	f_getoptions $*
 
+	if [ -z ${DEVICE} ] ; then
+		${ECHO} "ERROR: No device"
+		f_usage
+	elif [ ! -b ${DEVICE} ] ; then
+		${ECHO} "ERROR: Invalid device ${DEVICE}"
+		exit 1
+	fi
+
+	# if a symbollink is given, work out the typical device name, like /dev/sda
+	if [ -L ${DEVICE} ];then
+		 DEVICE=`readlink -f ${DEVICE}`
+	fi
+
 	if [ -z "${MOUNT_POINT}" ];then
                 f_usage
         fi
diff --git a/programs/python_common/single_run-WIP.sh b/programs/python_common/single_run-WIP.sh
index 5c174f0..92d1216 100755
--- a/programs/python_common/single_run-WIP.sh
+++ b/programs/python_common/single_run-WIP.sh
@@ -1095,6 +1095,7 @@ do
     		?) usage;;
   	esac
 done
+
 if [ -z ${DEVICE} ] ; then
 	${ECHO} "ERROR: No device"
 	usage
@@ -1103,6 +1104,11 @@ elif [ ! -b ${DEVICE} ] ; then
 	exit 1
 fi
 
+# if a symbollink is given, work out the typical device name, like /dev/sda
+if [ -L ${DEVICE} ];then
+	DEVICE=`readlink -f ${DEVICE}`
+fi
+
 if [ -z ${MOUNTPOINT} ] ; then
 	${ECHO} "ERROR: No mountpoint"
 	usage
-- 
2.6.6

  parent reply	other threads:[~2016-12-13  5:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-13  5:29 [Ocfs2-devel] [PATCH 00/17] ocfs2-test: misc improvements and trivial fixes Eric Ren
2016-12-13  5:29 ` [Ocfs2-devel] [PATCH 01/17] ocfs2 test: correct the check on testcase if supported Eric Ren
2017-03-13  8:11   ` Junxiao Bi
2016-12-13  5:29 ` [Ocfs2-devel] [PATCH 02/17] Single Run: kernel building is little broken now Eric Ren
2017-03-13  8:12   ` Junxiao Bi
2017-03-13  8:29     ` Eric Ren
2016-12-13  5:29 ` [Ocfs2-devel] [PATCH 03/17] Trivial: better not to depend on where we issue testing Eric Ren
2016-12-13  5:29 ` [Ocfs2-devel] [PATCH 04/17] Trivial: fix a typo mistake Eric Ren
2016-12-13  5:29 ` [Ocfs2-devel] [PATCH 05/17] Trivial: fix checking empty return value Eric Ren
2016-12-13  5:29 ` [Ocfs2-devel] [PATCH 06/17] multi_mmap: make log messages go to right place Eric Ren
2016-12-13  5:29 ` [Ocfs2-devel] [PATCH 07/17] lvb_torture: failed when pcmk is used as cluster stack Eric Ren
2016-12-13  5:29 ` [Ocfs2-devel] [PATCH 08/17] multiple node: pass cross_delete the right log file Eric Ren
2016-12-13  5:29 ` [Ocfs2-devel] [PATCH 09/17] Single run: make blocksize and clustersize as parameters Eric Ren
2016-12-13  5:29 ` [Ocfs2-devel] [PATCH 10/17] Multiple " Eric Ren
2016-12-13  5:29 ` [Ocfs2-devel] [PATCH 11/17] discontig bg: " Eric Ren
2016-12-13  5:29 ` [Ocfs2-devel] [PATCH 12/17] Add two cluster-aware parameters: cluster stack and cluster name Eric Ren
2016-12-13  5:29 ` [Ocfs2-devel] [PATCH 13/17] Save punch_hole details into logfile for debugging convenience Eric Ren
2016-12-13  5:29 ` [Ocfs2-devel] [PATCH 14/17] Fix openmpi warning by specifying proper slot number Eric Ren
2016-12-13  5:29 ` Eric Ren [this message]
2016-12-13  5:29 ` [Ocfs2-devel] [PATCH 16/17] inline data: fix build error Eric Ren
2016-12-13  5:29 ` [Ocfs2-devel] [PATCH 17/17] discontig bg: give single and multiple node test different log file name Eric Ren
2017-01-05  6:30 ` [Ocfs2-devel] [PATCH 00/17] ocfs2-test: misc improvements and trivial fixes Eric Ren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1481606975-13186-16-git-send-email-zren@suse.com \
    --to=zren@suse.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.