Initialize OSDs with a crush weight of 0 to prevent automatic rebalancing.
Weight the OSDs based on reported disk size when ceph-client chart runs. Change-Id: I9f4080a9843f1a63564cf71154841b351382bfe2
This commit is contained in:
parent
a4111037b0
commit
5efac315f7
@ -37,6 +37,13 @@ if ! ceph --cluster "${CLUSTER}" osd crush rule ls | grep -q "^same_host$"; then
|
||||
ceph --cluster "${CLUSTER}" osd crush rule create-simple same_host default osd
|
||||
fi
|
||||
|
||||
function reweight_osds () {
|
||||
for OSD_ID in $(ceph --cluster "${CLUSTER}" osd df | awk '$3 == "0" {print $1}'); do
|
||||
OSD_WEIGHT=$(ceph --cluster "${CLUSTER}" osd df --format json-pretty| grep -A7 osd.${OSD_ID} | awk '/"kb"/{ gsub(",",""); d= $2/1073741824 ; r = sprintf("%.2f", d); print r }');
|
||||
ceph --cluster "${CLUSTER}" osd crush reweight osd.${OSD_ID} ${OSD_WEIGHT};
|
||||
done
|
||||
}
|
||||
|
||||
function create_pool () {
|
||||
POOL_APPLICATION=$1
|
||||
POOL_NAME=$2
|
||||
@ -73,6 +80,8 @@ function manage_pool () {
|
||||
create_pool "${POOL_APPLICATION}" "${POOL_NAME}" "${POOL_REPLICATION}" "${POOL_PLACEMENT_GROUPS}" "${POOL_CRUSH_RULE}"
|
||||
}
|
||||
|
||||
reweight_osds
|
||||
|
||||
{{ $targetNumOSD := .Values.conf.pool.target.osd }}
|
||||
{{ $targetPGperOSD := .Values.conf.pool.target.pg_per_osd }}
|
||||
{{ $crushRuleDefault := .Values.conf.pool.default.crush_rule }}
|
||||
|
@ -124,7 +124,8 @@ OSD_ID=$(grep "${MOUNTED_PART}" /proc/mounts | awk '{print $2}' | grep -oh '[0-9
|
||||
|
||||
OSD_PATH="${OSD_PATH_BASE}-${OSD_ID}"
|
||||
OSD_KEYRING="${OSD_PATH}/keyring"
|
||||
OSD_WEIGHT=$(df -P -k "${OSD_PATH}" | tail -1 | awk '{ d= $2/1073741824 ; r = sprintf("%.2f", d); print r }')
|
||||
# NOTE(supamatt): set the initial crush weight of the OSD to 0 to prevent automatic rebalancing
|
||||
OSD_WEIGHT=0
|
||||
ceph \
|
||||
--cluster "${CLUSTER}" \
|
||||
--name="osd.${OSD_ID}" \
|
||||
|
@ -71,7 +71,8 @@ if [[ -n "$(find /var/lib/ceph/osd -prune -empty)" ]]; then
|
||||
# init data directory
|
||||
ceph-osd -i ${OSD_ID} --mkfs --osd-uuid ${UUID} --mkjournal --osd-journal ${OSD_J} --setuser ceph --setgroup ceph
|
||||
# add the osd to the crush map
|
||||
OSD_WEIGHT=$(df -P -k ${OSD_PATH} | tail -1 | awk '{ d= $2/1073741824 ; r = sprintf("%.2f", d); print r }')
|
||||
# NOTE(supamatt): set the initial crush weight of the OSD to 0 to prevent automatic rebalancing
|
||||
OSD_WEIGHT=0
|
||||
ceph --name=osd.${OSD_ID} --keyring=${OSD_KEYRING} osd crush create-or-move -- ${OSD_ID} ${OSD_WEIGHT} ${CRUSH_LOCATION}
|
||||
fi
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user