diff options
author | Amar Tumballi <amar@gluster.com> | 2009-08-04 17:00:17 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-08-04 16:47:55 -0700 |
commit | a313fd6657cb4a5310399edebe1f0c666e6a8d00 (patch) | |
tree | c04e7075c643951800f1b283246b5f0039aed355 | |
parent | fce2911e29e68bc3bf6fed2a68761877eda2156c (diff) |
adding an option to mount.glusterfs for server failover while fetching volume files.
Thanks to Cory Meyer <cory.meyer@gmail.com>
With this option, 'single point of failure', in case of volfile server can be
avoided.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 185 (Request to support secondary volfile-server option in mount.glusterfs)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=185
-rwxr-xr-x | xlators/mount/fuse/utils/mount.glusterfs.in | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in index 4547e8c5bc0..55b230aad87 100755 --- a/xlators/mount/fuse/utils/mount.glusterfs.in +++ b/xlators/mount/fuse/utils/mount.glusterfs.in @@ -82,31 +82,40 @@ start_glusterfs () cmd_line=$(echo "$cmd_line --disable-direct-io-mode"); fi + if [ -n "$volume_name" ]; then + cmd_line=$(echo "$cmd_line --volume-name=$volume_name"); + fi + if [ -z "$volfile_loc" ]; then + cmd_line=$(echo "$cmd_line --volfile-server-port=$server_port"); + if [ -n "$transport" ]; then - cmd_line=$(echo "$cmd_line \ ---volfile-server=$server_ip \ ---volfile-server-port=$server_port \ ---volfile-server-transport=$transport"); - else - cmd_line=$(echo "$cmd_line \ ---volfile-server=$server_ip \ ---volfile-server-port=$server_port"); + cmd_line=$(echo "$cmd_line --volfile-server-transport=$transport"); fi + if [ -n "$volume_id" ]; then cmd_line=$(echo "$cmd_line --volfile-id=$volume_id"); fi + + if [ -n "$backupvolfile_server" ]; then + cmd_line1=$(echo "$cmd_line --volfile-server=$backupvolfile_server"); + fi + + cmd_line=$(echo "$cmd_line --volfile-server=$server_ip"); else cmd_line=$(echo "$cmd_line --volfile=$volfile_loc"); fi - if [ -n "$volume_name" ]; then - cmd_line=$(echo "$cmd_line --volume-name=$volume_name"); - fi - cmd_line=$(echo "$cmd_line $mount_point"); - exec $cmd_line; + $cmd_line; + # retry the failover + if [ $? != "0" ]; then + if [ -n "$cmd_line1" ]; then + cmd_line1=$(echo "$cmd_line1 $mount_point"); + $cmd_line1 + fi + fi } @@ -131,6 +140,7 @@ main () volfile_check=$(echo "$options" | sed -n 's/.*volfile-check=\([^,]*\).*/\1/p'); server_port=$(echo "$options" | sed -n 's/.*server-port=\([^,]*\).*/\1/p'); + backupvolfile_server=$(echo "$options" | sed -n 's/.*backupvolfile-server=\([^,]*\).*/\1/p'); volfile_loc="$1"; @@ -159,6 +169,7 @@ main () -e 's/[,]*direct-io-mode=[^,]*//' \ -e 's/[,]*volfile-check=[^,]*//' \ -e 's/[,]*transport=[^,]*//' \ + -e 's/[,]*backupvolfile-server=[^,]*//' \ -e 's/[,]*server-port=[^,]*//' \ -e 's/[,]*volume-id=[^,]*//'); # following line is product of love towards sed @@ -182,3 +193,4 @@ main () } _init "$@" && main "$@"; + |