diff options
Diffstat (limited to 'xlators/mount/fuse/utils/mount_glusterfs.in')
| -rwxr-xr-x | xlators/mount/fuse/utils/mount_glusterfs.in | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/xlators/mount/fuse/utils/mount_glusterfs.in b/xlators/mount/fuse/utils/mount_glusterfs.in index e0a06ea6925..3a5feb606d7 100755 --- a/xlators/mount/fuse/utils/mount_glusterfs.in +++ b/xlators/mount/fuse/utils/mount_glusterfs.in @@ -1,5 +1,6 @@ #!/bin/sh # (C) 2014 Red Hat Inc. <http://www.redhat.com> +# (C) 2015 ungleich GmbH <http://www.ungleich.ch> # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -19,7 +20,7 @@ warn () { - echo "$@" >/dev/stderr + echo "$@" >&2 } _init () @@ -172,6 +173,10 @@ start_glusterfs () cmd_line=$(echo "$cmd_line --no-root-squash"); fi + if [ -n "$capability" ]; then + cmd_line=$(echo "$cmd_line --capability"); + fi + #options with values start here if [ -n "$log_level" ]; then cmd_line=$(echo "$cmd_line --log-level=$log_level"); @@ -229,9 +234,11 @@ start_glusterfs () cmd_line=$(echo "$cmd_line --xlator-option=$xlator_option"); fi - # for rdma volume, we have to fetch volfile with '.rdma' added - # to volume name, so that it fetches the right client vol file - volume_id_rdma=""; + if [ -n "$process_name" ]; then + cmd_line=$(echo "$cmd_line --process-name fuse.$process_name"); + else + cmd_line=$(echo "$cmd_line --process-name fuse"); + fi if [ -z "$volfile_loc" ]; then if [ -n "$server_ip" ]; then @@ -271,15 +278,9 @@ start_glusterfs () if [ -n "$transport" ]; then cmd_line=$(echo "$cmd_line --volfile-server-transport=$transport"); - if [ "$transport" = "rdma" ]; then - volume_id_rdma=".rdma"; - fi fi if [ -n "$volume_id" ]; then - if [ -n "$volume_id_rdma" ]; then - volume_id="$volume_id$volume_id_rdma"; - fi cmd_line=$(echo "$cmd_line --volfile-id=$volume_id"); fi fi @@ -301,7 +302,7 @@ start_glusterfs () print_usage () { -cat << EOF >/dev/stderr +cat << EOF >&2 Usage: $0 <volumeserver>:<volumeid/volumeport> -o<options> <mountpoint> Options: man 8 $0 @@ -393,6 +394,9 @@ with_options() [ $value = "false" ] ; then no_root_squash=1; fi ;; + "process-name") + process_name=$value + ;; *) warn "Invalid option: $key" exit 1 @@ -439,6 +443,9 @@ without_options() ;; "_netdev") ;; + "capability") + capability=1 + ;; *) warn "Invalid option $option"; exit 1 @@ -449,7 +456,7 @@ without_options() parse_options() { local optarg=${1} - for pair in $(echo ${optarg//,/ }); do + for pair in $(echo $optarg | sed 's/,/ /g'); do key=$(echo "$pair" | cut -f1 -d'='); value=$(echo "$pair" | cut -f2- -d'='); if [ "$key" = "$value" ]; then @@ -462,15 +469,17 @@ parse_options() main () { +#if !defined(__FreeBSD__) ## `mount` on OSX specifies options as first argument - if [[ $1 =~ "-o" ]]; then + echo $1|grep -q -- "-o" + if [ $? -eq 0 ]; then volfile_loc=$3 mount_point=$4 else volfile_loc=$1 mount_point=$2 fi - +#endif /* __FreeBSD__ */ while getopts "Vo:h" opt; do case "${opt}" in o) @@ -491,8 +500,15 @@ main () esac done +#ifdef __FreeBSD__ + shift $((OPTIND - 1)) + volfile_loc="$1" + mount_point="$2" +#endif /* __FreeBSD__ */ + [ -r "$volfile_loc" ] || { - server_ip=$(echo "$volfile_loc" | sed -n 's/\([a-zA-Z0-9:.\-]*\):.*/\1/p'); + # '%' included to support ipv6 link local addresses + server_ip=$(echo "$volfile_loc" | sed -n 's/\([a-zA-Z0-9:%.\-]*\):.*/\1/p'); volume_str=$(echo "$volfile_loc" | sed -n 's/.*:\([^ ]*\).*/\1/p'); [ -n "$volume_str" ] && { volume_id="$volume_str"; @@ -501,7 +517,7 @@ main () } [ -z "$volume_id" -o -z "$server_ip" ] && { - cat <<EOF >/dev/stderr + cat <<EOF >&2 ERROR: Server name/volume name unspecified cannot proceed further.. Please specify correct format Usage: @@ -512,7 +528,7 @@ EOF grep_ret=$(echo ${mount_point} | grep '^\-o'); [ "x" != "x${grep_ret}" ] && { - cat <<EOF >/dev/stderr + cat <<EOF >&2 ERROR: -o options cannot be specified in either first two arguments.. Please specify correct style Usage: @@ -524,7 +540,7 @@ EOF # No need to do a ! -d test, it is taken care while initializing the # variable mount_point [ -z "$mount_point" -o ! -d "$mount_point" ] && { - cat <<EOF >/dev/stderr + cat <<EOF >&2 ERROR: Mount point does not exist Please specify a mount point Usage: |
