[ceph-client] Fix crush weight comparison in reweight_osds()
The recently-added crush weight comparison in reweight_osds() that checks weights for zero isn't working correctly because the expected weight is being calculated to two decimal places and then compared against "0" as a string. This updates the comparison string to "0.00" to match the calculation. Change-Id: I29387a597a21180bb7fba974b4daeadf6ffc182d
This commit is contained in:
parent
8631c79548
commit
f66f9fe560
@ -139,7 +139,7 @@ function reweight_osds () {
|
||||
for OSD_ID in $(ceph --cluster "${CLUSTER}" osd ls); do
|
||||
OSD_EXPECTED_WEIGHT=$(echo "${OSD_DF_OUTPUT}" | grep -A7 "\bosd.${OSD_ID}\b" | awk '/"kb"/{ gsub(",",""); d= $2/1073741824 ; r = sprintf("%.2f", d); print r }');
|
||||
OSD_WEIGHT=$(echo "${OSD_DF_OUTPUT}" | grep -A3 "\bosd.${OSD_ID}\b" | awk '/crush_weight/{print $2}' | cut -d',' -f1)
|
||||
if [[ "${OSD_EXPECTED_WEIGHT}" != "0" ]] && [[ "${OSD_WEIGHT}" != "${OSD_EXPECTED_WEIGHT}" ]]; then
|
||||
if [[ "${OSD_EXPECTED_WEIGHT}" != "0.00" ]] && [[ "${OSD_WEIGHT}" != "${OSD_EXPECTED_WEIGHT}" ]]; then
|
||||
ceph --cluster "${CLUSTER}" osd crush reweight osd.${OSD_ID} ${OSD_EXPECTED_WEIGHT};
|
||||
fi
|
||||
done
|
||||
|
Loading…
x
Reference in New Issue
Block a user