mgr: refactor mgr module enablement

Cherry-picked from a6d6b2eef3

Change-Id: Ie6b7e94e80d625c212331cf74c0f796bb3e99858
Signed-off-by: Alexandre Marangone <amarango@redhat.com>
Signed-off-by: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
This commit is contained in:
Alexandre Marangone 2017-10-30 09:57:29 -07:00 committed by Steve Wilkerson
parent e4fa63aea9
commit 434a28e80f
3 changed files with 47 additions and 7 deletions

View File

@ -33,11 +33,30 @@ log "SUCCESS"
ceph -v
if [[ "$MGR_DASHBOARD" == 1 ]]; then
ceph ${CLI_OPTS} mgr module enable dashboard --force
ceph ${CLI_OPTS} config-key put mgr/dashboard/server_addr "$MGR_IP"
ceph ${CLI_OPTS} config-key put mgr/dashboard/server_port "$MGR_PORT"
fi
# Env. variables matching the pattern "<module>_" will be
# found and parsed for config-key settings by
# ceph config-key set mgr/<module>/<key> <value>
MODULES_TO_DISABLE=`ceph mgr dump | python -c "import json, sys; print ' '.join(json.load(sys.stdin)['modules'])"`
for module in ${ENABLED_MODULES}; do
# This module may have been enabled in the past
# remove it from the disable list if present
MODULES_TO_DISABLE=${MODULES_TO_DISABLE/$module/}
options=`env | grep ^${module}_ || true`
for option in ${options}; do
#strip module name
option=${option/${module}_/}
key=`echo $option | cut -d= -f1`
value=`echo $option | cut -d= -f2`
ceph ${CLI_OPTS} config-key set mgr/$module/$key $value
done
ceph ${CLI_OPTS} mgr module enable ${module} --force
done
for module in $MODULES_TO_DISABLE; do
ceph ${CLI_OPTS} mgr module disable ${module}
done
log "SUCCESS"
# start ceph-mgr

View File

@ -44,9 +44,7 @@ ALL_SCENARIOS="osd osd_directory osd_directory_single osd_ceph_disk osd_ceph_dis
: ${RGW_REMOTE_CGI_HOST:=0.0.0.0}
: ${RGW_USER:="cephnfs"}
: ${MGR_NAME:=${HOSTNAME}}
: ${MGR_DASHBOARD:=1}
: ${MGR_IP:=0.0.0.0}
: ${MGR_PORT:=7000}
: ${RBD_POOL_PG:=128}
# This is ONLY used for the CLI calls, e.g: ceph $CLI_OPTS health

View File

@ -316,6 +316,29 @@ bootstrap:
}
#ensure_pool volumes 8 cinder
# Uncomment below to enable mgr modules
# For a list of available modules:
# http://docs.ceph.com/docs/master/mgr/
# This overrides mgr_initial_modules (default: restful, status)
# Any module not listed here will be disabled
ceph_mgr_enabled_modules:
- restful
- status
# You can configure your mgr modules
# below. Each module has its own set
# of key/value. Refer to the doc
# above for more info. For example:
#ceph_mgr_modules_config:
# dashboard:
# port: 7000
# localpool:
# failure_domain: host
# subtree: rack
# pg_num: "128"
# num_rep: "3"
# min_size: "2"
# if you change provision_storage_class to false
# it is presumed you manage your own storage
# class definition externally