summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2009-06-24 13:31:11 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-06-24 17:13:35 -0700
commit5052d8e23d2e3b33a185d3bd5f9eca8264238acb (patch)
tree12b7ddf2f85f0ae81269166d3e4721f3a9a7bedd /xlators
parentc15ab84a1dd687e9e97b17fb7250ba945857026e (diff)
mount script to take arguments like nfs
Ref: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=37 earlier instead of path, it used to take port number, which is an option (-o server-port=<port>), now. new syntax is bash# mount -t glusterfs <hostname>:<path/key> [mountpoint] [This patch is backward compatible with earlier syntax] bash# mount -t glusterfs <hostname>:<port> [mountpoint] Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
Diffstat (limited to 'xlators')
-rwxr-xr-xxlators/mount/fuse/utils/mount.glusterfs.in51
1 files changed, 34 insertions, 17 deletions
diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in
index cd371c8ce58..13d6ea5646c 100755
--- a/xlators/mount/fuse/utils/mount.glusterfs.in
+++ b/xlators/mount/fuse/utils/mount.glusterfs.in
@@ -93,6 +93,9 @@ function start_glusterfs ()
--volfile-server=$server_ip \
--volfile-server-port=$server_port");
fi
+ if [ -n "$volume_id" ]; then
+ cmd_line=$(echo "$cmd_line --volfile-id=$volume_id");
+ fi
else
cmd_line=$(echo "$cmd_line --volfile=$volfile_loc");
fi
@@ -101,9 +104,6 @@ function start_glusterfs ()
cmd_line=$(echo "$cmd_line --volume-name=$volume_name");
fi
- if [ -n "$volume_id" ]; then
- cmd_line=$(echo "$cmd_line --volfile-id=$volume_id");
- fi
cmd_line=$(echo "$cmd_line $mount_point");
exec $cmd_line;
@@ -126,28 +126,41 @@ function main ()
volume_name=$(echo "$options" | sed -n 's/.*volume-name=\([^,]*\).*/\1/p');
- volume_id=$(echo "$options" | sed -n 's/.*volume-id=\([^,]*\).*/\1/p');
+ volume_id=$(echo "$options" | sed -n 's/.*volume_id=\([^,]*\).*/\1/p');
volfile_check=$(echo "$options" | sed -n 's/.*volfile-check=\([^,]*\).*/\1/p');
+ server_port=$(echo "$options" | sed -n 's/.*server-port=\([^,]*\).*/\1/p');
+
volfile_loc="$1";
[ -r "$volfile_loc" ] || {
server_ip=$(echo "$volfile_loc" | sed -n 's/\([^\:]*\).*/\1/p');
- server_port=$(echo "$volfile_loc" | sed -n 's/.*:\([^ ]*\).*/\1/p');
- [ -n "$server_port" ] || {
- server_port="6996";
- }
-
+ test_str=$(echo "$volfile_loc" | sed -n 's/.*:\([^ ]*\).*/\1/p');
+ [ -n "$test_str" ] && {
+ # Backward compatibility
+ test_str1=$(echo "$test_str" | sed -e 's/[0-9]//g');
+ [ -n "$test_str1" ] && {
+ volume_id="$test_str";
+ } || {
+ server_port=$test_str;
+ }
+ }
volfile_loc="";
}
+
+ [ -n "$server_port" ] || {
+ server_port="6996";
+ }
+
new_fs_options=$(echo "$options" | sed -e 's/[,]*log-file=[^,]*//' \
- -e 's/[,]*log-level=[^,]*//' \
- -e 's/[,]*volume-name=[^,]*//' \
- -e 's/[,]*direct-io-mode=[^,]*//' \
- -e 's/[,]*volfile-check=[^,]*//' \
- -e 's/[,]*transport=[^,]*//' \
- -e 's/[,]*volume-id=[^,]*//');
+ -e 's/[,]*log-level=[^,]*//' \
+ -e 's/[,]*volume-name=[^,]*//' \
+ -e 's/[,]*direct-io-mode=[^,]*//' \
+ -e 's/[,]*volfile-check=[^,]*//' \
+ -e 's/[,]*transport=[^,]*//' \
+ -e 's/[,]*server-port=[^,]*//' \
+ -e 's/[,]*volume-id=[^,]*//');
# following line is product of love towards sed
# $2=$(echo "$@" | sed -n 's/[^ ]* \([^ ]*\).*/\1/p');
@@ -155,13 +168,17 @@ function main ()
# Simple check to avoid multiple identical mounts
if grep -q " $mount_point fuse" /etc/mtab; then
- echo "$0: according to mtab, GlusterFS is already mounted on $mount_point"
- exit 0
+ echo -n "$0: according to mtab, GlusterFS is already mounted on "
+ echo "$mount_point"
+ sleep 1;
+ exit 0;
fi
fs_options=$(echo "$fs_options,$new_fs_options");
start_glusterfs;
+
+ sleep 3;
}
_init "$@" && main "$@";