From 1896b70f5ec94f124eaa74fcbf10be44df768408 Mon Sep 17 00:00:00 2001 From: Varsha Rao Date: Mon, 1 Jun 2020 21:02:53 +0530 Subject: [PATCH] vstart: Support deployment of ganesha daemon by cephadm with NFS option. NFS Ganesha cluster can be created in two ways with vstart cluster: 1) With test_orchestrator NFS=1 ../src/vstart.sh This type of deployment can have multiple ganesha daemons on random port. 2) With Cephadm NFS=1 ../src/vstart.sh --cephadm It can deploy only single ganesha daemon with vstart on default ganesha port. Both can create multiple cephfs exports. Fixes: https://tracker.ceph.com/issues/45830 Signed-off-by: Varsha Rao --- src/vstart.sh | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/src/vstart.sh b/src/vstart.sh index b3bed4314c7f6..88fe103386819 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -1072,8 +1072,25 @@ EOF # https://launchpad.net/~nfs-ganesha/+archive/ubuntu/nfs-ganesha-2.8 start_ganesha() { + cluster_id="vstart" GANESHA_PORT=$(($CEPH_PORT + 4000)) local ganesha=0 + test_user="ganesha-$cluster_id" + pool_name="nfs-ganesha" + namespace=$cluster_id + url="rados://$pool_name/$namespace/conf-nfs.$test_user" + + prun ceph_adm auth get-or-create client.$test_user \ + mon "allow r" \ + osd "allow rw pool=$pool_name namespace=$namespace, allow rw tag cephfs data=a" \ + mds "allow rw path=/" \ + >> "$keyring_fn" + + ceph_adm mgr module enable test_orchestrator + ceph_adm orch set backend test_orchestrator + ceph_adm test_orchestrator load_data -i $CEPH_ROOT/src/pybind/mgr/test_orchestrator/dummy_data.json + prun ceph_adm nfs cluster create cephfs $cluster_id + prun ceph_adm nfs export create cephfs "a" $cluster_id "/cephfs" for name in a b c d e f g h i j k l m n o p do @@ -1082,22 +1099,8 @@ start_ganesha() { port=$(($GANESHA_PORT + ganesha)) ganesha=$(($ganesha + 1)) ganesha_dir="$CEPH_DEV_DIR/ganesha.$name" - test_user="ganesha-$name" - pool_name="nfs-ganesha" - namespace=$name - url="rados://$pool_name/$namespace/conf-nfs.$test_user" - prun rm -rf $ganesha_dir prun mkdir -p $ganesha_dir - prun ceph_adm auth get-or-create client.$test_user \ - mon "allow r" \ - osd "allow rw pool=$pool_name namespace=$namespace, allow rw tag cephfs data=a" \ - mds "allow rw path=/" \ - >> "$keyring_fn" - - ceph_adm mgr module enable test_orchestrator - ceph_adm orch set backend test_orchestrator - prun ceph_adm nfs cluster create cephfs $name echo "NFS_CORE_PARAM { Enable_NLM = false; @@ -1139,7 +1142,6 @@ start_ganesha() { pid file = $ganesha_dir/ganesha.pid EOF - prun ceph_adm nfs export create cephfs "a" $name "/cephfs" prun ganesha-rados-grace -p $pool_name -n $namespace add $name prun ganesha-rados-grace -p $pool_name -n $namespace @@ -1154,13 +1156,12 @@ EOF $CEPH_BIN/rados -p $pool_name put "conf-$name" "$ganesha_dir/ganesha.conf" fi - echo "$test_user started on port: $port" + echo "$test_user ganesha daemon $name started on port: $port" done if $with_mgr_dashboard; then ceph_adm dashboard set-ganesha-clusters-rados-pool-namespace $pool_name fi - echo "Mount using: mount -t nfs -o port=
:" } @@ -1369,8 +1370,15 @@ EOF fi # Ganesha Daemons -if [ $GANESHA_DAEMON_NUM -gt 0 ] && [ "$cephadm" -eq 0 ]; then - start_ganesha +if [ $GANESHA_DAEMON_NUM -gt 0 ]; then + if [ "$cephadm" -gt 0 ]; then + cluster_id="vstart" + prun ceph_adm nfs cluster create cephfs $cluster_id + prun ceph_adm nfs export create cephfs "a" $cluster_id "/cephfs" + echo "Mount using: mount -t nfs -o port=2049
:/cephfs" + else + start_ganesha + fi fi do_cache() { -- 2.39.5