diff options
-rwxr-xr-x | extras/ganesha/scripts/create-export-ganesha.sh | 7 | ||||
-rwxr-xr-x | extras/ganesha/scripts/dbus-send.sh | 17 | ||||
-rw-r--r-- | xlators/features/ganesha/src/ganesha.c | 16 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-ganesha.c | 15 |
4 files changed, 39 insertions, 16 deletions
diff --git a/extras/ganesha/scripts/create-export-ganesha.sh b/extras/ganesha/scripts/create-export-ganesha.sh index 8140a11f548..de869c4629d 100755 --- a/extras/ganesha/scripts/create-export-ganesha.sh +++ b/extras/ganesha/scripts/create-export-ganesha.sh @@ -36,7 +36,8 @@ echo -e "# WARNING : Using Gluster CLI will overwrite manual # and run ganesha-ha.sh --refresh-config." echo "EXPORT{" -echo " Export_Id = 1;" +echo " Export_Id = 2;" +echo " Path = \"/$VOL\";" echo " FSAL {" echo " name = "GLUSTER";" echo " hostname=\"localhost\";" @@ -45,8 +46,8 @@ echo " }" echo " Access_type = RW;" echo ' Squash="No_root_squash";' echo " Pseudo=\"/$VOL\";" -echo ' Protocols = "3,4" ;' -echo ' Transports = "UDP,TCP";' +echo ' Protocols = "3", "4" ;' +echo ' Transports = "UDP","TCP";' echo ' SecType = "sys";' echo " }" } diff --git a/extras/ganesha/scripts/dbus-send.sh b/extras/ganesha/scripts/dbus-send.sh index 406162f0747..170983a7a77 100755 --- a/extras/ganesha/scripts/dbus-send.sh +++ b/extras/ganesha/scripts/dbus-send.sh @@ -1,9 +1,11 @@ #/bin/bash declare -i EXPORT_ID -GANESHA_DIR=$1 -OPTION=$1 -VOL=$2 +GANESHA_DIR=${1%/} +OPTION=$2 +VOL=$3 + +CONF=$(cat /etc/sysconfig/ganesha | grep "CONFFILE" | cut -f 2 -d "=") function check_cmd_status() { @@ -38,24 +40,23 @@ function dynamic_export_add() sed -i s/Export_Id.*/"Export_Id= $EXPORT_ID ;"/ \ $GANESHA_DIR/exports/export.$VOL.conf check_cmd_status `echo $?` - dbus-send --print-reply --system \ + dbus-send --system \ --dest=org.ganesha.nfsd /org/ganesha/nfsd/ExportMgr \ org.ganesha.nfsd.exportmgr.AddExport string:$GANESHA_DIR/exports/export.$VOL.conf \ string:"EXPORT(Path=/$VOL)" - } #This function removes an export dynamically(uses the export_id of the export) function dynamic_export_remove() { removed_id=`cat $GANESHA_DIR/exports/export.$VOL.conf |\ -grep Export_Id | cut -d " " -f3` - echo $removed_id +grep Export_Id | cut -d " " -f8` check_cmd_status `echo $?` dbus-send --print-reply --system \ --dest=org.ganesha.nfsd /org/ganesha/nfsd/ExportMgr \ org.ganesha.nfsd.exportmgr.RemoveExport uint16:$removed_id check_cmd_status `echo $?` + sed -i /$VOL.conf/d $CONF rm -rf $GANESHA_DIR/exports/export.$VOL.conf } @@ -63,12 +64,10 @@ org.ganesha.nfsd.exportmgr.RemoveExport uint16:$removed_id if [ "$OPTION" = "on" ]; then dynamic_export_add $@ - check_cmd_status `echo $?` fi if [ "$OPTION" = "off" ]; then dynamic_export_remove $@ - check_cmd_status `echo $?` fi diff --git a/xlators/features/ganesha/src/ganesha.c b/xlators/features/ganesha/src/ganesha.c index f034fc00d46..a3d392e3ecf 100644 --- a/xlators/features/ganesha/src/ganesha.c +++ b/xlators/features/ganesha/src/ganesha.c @@ -18,6 +18,22 @@ #include "ganesha-mem-types.h" +int32_t +mem_acct_init (xlator_t *this) +{ + int ret = -1; + + if (!this) + return ret; + + ret = xlator_mem_acct_init (this, gf_ganesha_mt_end + 1); + + if (ret != 0) + gf_log (this->name, GF_LOG_WARNING, "Memory accounting" + "init failed"); + + return ret; +} int32_t init (xlator_t *this) diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c index 534e332cdee..fe67be187f2 100644 --- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c +++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c @@ -194,6 +194,7 @@ glusterd_op_set_ganesha (dict_t *dict, char **errstr) int32_t dict_count = 0; dict_t *vol_opts = NULL; int count = 0; + char *dup = NULL; this = THIS; GF_ASSERT (this); @@ -217,6 +218,12 @@ glusterd_op_set_ganesha (dict_t *dict, char **errstr) goto out; } + dup = gf_strdup (value); + if (!dup) { + ret = -1; + goto out; + } + ret = glusterd_handle_ganesha_op (dict, errstr, key, value); if (ret) { gf_log (this->name, GF_LOG_ERROR, @@ -422,7 +429,7 @@ ganesha_manage_export (dict_t *dict, char *value, char **op_errstr) if (ret) gf_asprintf(op_errstr, "Dynamic export" " addition/deletion failed." - "Please see log file for details"); + " Please see log file for details"); } out: return ret; @@ -436,7 +443,7 @@ tear_down_cluster(void) if (is_ganesha_host()) { runinit (&runner); - runner_add_args (&runner, "sh", CONFDIR, + runner_add_args (&runner, "sh", GANESHA_PREFIX"/ganesha-ha.sh", "teardown", CONFDIR, NULL); ret = runner_run(&runner); @@ -470,7 +477,7 @@ stop_ganesha (char **op_errstr) ret = tear_down_cluster(); if (ret == -1) { gf_asprintf (op_errstr, "Cleanup of NFS-Ganesha" - "HA config failed."); + " HA config failed."); goto out; } @@ -527,7 +534,7 @@ start_ganesha (char **op_errstr) ret = setup_cluster(); if (ret == -1) { gf_asprintf (op_errstr, "Failed to set up HA " - "config for NFS-Ganesha." + "config for NFS-Ganesha. " "Please check the log file for details"); goto out; } |