]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_mon: check available storage space for mon data dir on start
authorJoao Eduardo Luis <joao@redhat.com>
Thu, 18 Sep 2014 15:53:43 +0000 (16:53 +0100)
committerSage Weil <sage@redhat.com>
Thu, 16 Oct 2014 00:18:42 +0000 (17:18 -0700)
error out if available storage space is below 'mon data avail crit'

Fixes: #9502
Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
(cherry picked from commit 2da1a2914ac7df18ce842b0aac728fffb5bed2b6)

Conflicts:
src/ceph_mon.cc

src/ceph_mon.cc

index 80b17a14946c05ceb11f0b70975673cd102f584a..5d762a97c443b2b4ba17b142e22fe43120ff4050 100644 (file)
@@ -293,6 +293,26 @@ int main(int argc, const char **argv)
     exit(0);
   }
 
+  {
+    // check fs stats. don't start if it's critically close to full.
+    ceph_data_stats_t stats;
+    int err = get_fs_stats(stats, g_conf->mon_data.c_str());
+    if (err < 0) {
+      cerr << "error checking monitor data's fs stats: " << cpp_strerror(err)
+           << std::endl;
+      exit(-err);
+    }
+    if (stats.avail_percent <= g_conf->mon_data_avail_crit) {
+      cerr << "error: monitor data filesystem reached concerning levels of"
+           << " available storage space (available: "
+           << stats.avail_percent << "% " << prettybyte_t(stats.byte_avail)
+           << ")\nyou may adjust 'mon data avail crit' to a lower value"
+           << " to make this go away (default: " << g_conf->mon_data_avail_crit
+           << "%)\n" << std::endl;
+      exit(ENOSPC);
+    }
+  }
+
   // -- mkfs --
   if (mkfs) {