From 11b42275d253f62426d6d3a6a066b49d17fe9037 Mon Sep 17 00:00:00 2001 From: Varsha Rao Date: Tue, 5 Nov 2019 16:50:20 +0530 Subject: [PATCH 1/3] vstart: Add option to deploy ganesha daemons To create Ganesha daemons with vstart following packages needs to be installed: nfs-ganesha nfs-ganesha-ceph nfs-ganesha-rados-grace Version used for these packages 2.7.6-2 on fedora 30 system. This is an experimental option, it just deploys specified number of ganesha daemons. Signed-off-by: Varsha Rao --- src/vstart.sh | 102 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 100 insertions(+), 2 deletions(-) diff --git a/src/vstart.sh b/src/vstart.sh index 88024ea2c57..a07d2cd1e27 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -110,13 +110,15 @@ export CEPH_DEV=1 [ -z "$CEPH_NUM_MGR" ] && CEPH_NUM_MGR="$MGR" [ -z "$CEPH_NUM_FS" ] && CEPH_NUM_FS="$FS" [ -z "$CEPH_NUM_RGW" ] && CEPH_NUM_RGW="$RGW" +[ -z "$GANESHA_DAEMON_NUM" ] && GANESHA_DAEMON_NUM="$GANESHA" # if none of the CEPH_NUM_* number is specified, kill the existing # cluster. if [ -z "$CEPH_NUM_MON" -a \ -z "$CEPH_NUM_OSD" -a \ -z "$CEPH_NUM_MDS" -a \ - -z "$CEPH_NUM_MGR" ]; then + -z "$CEPH_NUM_MGR" -a \ + -z "$GANESHA_DAEMON_NUM" ]; then kill_all=1 else kill_all=0 @@ -129,6 +131,7 @@ fi [ -z "$CEPH_NUM_FS" ] && CEPH_NUM_FS=1 [ -z "$CEPH_MAX_MDS" ] && CEPH_MAX_MDS=1 [ -z "$CEPH_NUM_RGW" ] && CEPH_NUM_RGW=0 +[ -z "$GANESHA_DAEMON_NUM" ] && GANESHA_DAEMON_NUM=0 [ -z "$CEPH_DIR" ] && CEPH_DIR="$PWD" [ -z "$CEPH_DEV_DIR" ] && CEPH_DEV_DIR="$CEPH_DIR/dev" @@ -196,7 +199,7 @@ inc_osd_num=0 msgr="21" -usage="usage: $0 [option]... \nex: MON=3 OSD=1 MDS=1 MGR=1 RGW=1 $0 -n -d\n" +usage="usage: $0 [option]... \nex: MON=3 OSD=1 MDS=1 MGR=1 RGW=1 GANESHA=1 $0 -n -d\n" usage=$usage"options:\n" usage=$usage"\t-d, --debug\n" usage=$usage"\t-s, --standby_mds: Generate standby-replay MDS for each active\n" @@ -473,6 +476,8 @@ if [ "$overwrite_conf" -eq 0 ]; then CEPH_NUM_MGR="$MGR" RGW=`$CEPH_BIN/ceph-conf -c $conf_fn --name $VSTART_SEC --lookup num_rgw 2>/dev/null` && \ CEPH_NUM_RGW="$RGW" + GANESHA=`$CEPH_BIN/ceph-conf -c $conf_fn --name $VSTART_SEC --lookup num_ganesha 2>/dev/null` && \ + GANESHA_DAEMON_NUM="$GANESHA" else if [ "$new" -ne 0 ]; then # only delete if -n @@ -596,6 +601,7 @@ prepare_conf() { num mds = $CEPH_NUM_MDS num mgr = $CEPH_NUM_MGR num rgw = $CEPH_NUM_RGW + num ganesha = $GANESHA_DAEMON_NUM [global] fsid = $(uuidgen) @@ -1074,6 +1080,93 @@ EOF } +start_ganesha() { + GANESHA_PORT=$(($CEPH_PORT + 4000)) + local ganesha=0 + + for name in a b c d e f g h i j k l m n o p + do + [ $ganesha -eq $GANESHA_DAEMON_NUM ] && break + + port=$(($GANESHA_PORT + ganesha)) + ganesha=$(($ganesha + 1)) + ganesha_dir="$CEPH_DEV_DIR/ganesha.$name" + + echo "Starting ganesha.$name on port: $port" + + prun rm -rf $ganesha_dir + prun mkdir -p $ganesha_dir + + echo "NFS_CORE_PARAM { + Enable_NLM = false; + Enable_RQUOTA = false; + Protocols = 4; + NFS_Port = $port; +} + +CACHEINODE { + Dir_Chunk = 0; + NParts = 1; + Cache_Size = 1; +} + +NFSv4 { + RecoveryBackend = 'rados_cluster'; + Minor_Versions = 1, 2; +} + +EXPORT { + Export_Id = 100; + Transports = TCP; + Path = /; + Pseudo = /ceph/; + Protocols = 4; + Access_Type = RW; + Attr_Expiration_Time = 0; + Squash = None; + FSAL { + Name = CEPH; + } +} + +CEPH { + Ceph_Conf = $conf_fn; +} + +RADOS_KV { + Ceph_Conf = $conf_fn; + pool = 'nfs-ganesha'; + namespace = 'ganesha'; + UserId = 'admin'; + nodeid = $name; +}" > "$ganesha_dir/ganesha.conf" + + + wconf <=8 the packages need to be +# downloaded first from https://download.nfs-ganesha.org/2.7/2.7.6/CentOS/ and +# then install it. Similarly for Ubuntu 16.04 follow the instructions on +# https://launchpad.net/~nfs-ganesha/+archive/ubuntu/nfs-ganesha-2.7 + start_ganesha() { GANESHA_PORT=$(($CEPH_PORT + 4000)) local ganesha=0