]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Use currently configure full ratio to determine available space
authorDavid Zafman <dzafman@redhat.com>
Thu, 13 Apr 2017 18:41:18 +0000 (11:41 -0700)
committerDavid Zafman <dzafman@redhat.com>
Mon, 17 Apr 2017 15:00:24 +0000 (08:00 -0700)
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>
src/mon/PGMap.cc

index ee263d3f792cdeb2be0f734c11d2b02da328766b..68f4879a538cb8157d02497c5f52f0ba90300108 100644 (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);