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 <dzafman@redhat.com>
This commit is contained in:
David Zafman 2017-04-13 11:41:18 -07:00
parent 1fafec2175
commit afd739bed6

View File

@ -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<int,float>::iterator p = wm.begin(); p != wm.end(); ++p) {
ceph::unordered_map<int32_t,osd_stat_t>::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);