From: David Zafman Date: Thu, 13 Apr 2017 18:41:18 +0000 (-0700) Subject: mon: Use currently configure full ratio to determine available space X-Git-Tag: v12.0.2~51^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=afd739bed6fb56358c147af32293bff7cc2995a4;p=ceph.git mon: Use currently configure full ratio to determine available space This is a bug that would not adjust available space based on the currently configured full ratio, but rather the mon_osd_full_ratio default initial value. Signed-off-by: David Zafman --- diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index ee263d3f792c..68f4879a538c 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -1878,6 +1878,17 @@ int64_t PGMap::get_rule_avail(const OSDMap& osdmap, int ruleno) const return 0; } + float fratio; + if (osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS) && osdmap.get_full_ratio() > 0) { + fratio = osdmap.get_full_ratio(); + } else if (full_ratio > 0) { + fratio = full_ratio; + } else { + // this shouldn't really happen + fratio = g_conf->mon_osd_full_ratio; + if (fratio > 1.0) fratio /= 100; + } + int64_t min = -1; for (map::iterator p = wm.begin(); p != wm.end(); ++p) { ceph::unordered_map::const_iterator osd_info = @@ -1892,7 +1903,7 @@ int64_t PGMap::get_rule_avail(const OSDMap& osdmap, int ruleno) const continue; } double unusable = (double)osd_info->second.kb * - (1.0 - g_conf->mon_osd_full_ratio); + (1.0 - fratio); double avail = MAX(0.0, (double)osd_info->second.kb_avail - unusable); avail *= 1024.0; int64_t proj = (int64_t)(avail / (double)p->second);