]> git-server-git.apps.pok.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)
committerJoao Eduardo Luis <joao@redhat.com>
Mon, 22 Sep 2014 16:36:29 +0000 (17:36 +0100)
error out if available storage space is below 'mon data avail crit'

Fixes: #9502
Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
src/ceph_mon.cc

index 3ff033f7f9dee0993ceafda91a62eccb646ada5c..ef0e11bfa30ab0884fd84ba68eacb76383f96591 100644 (file)
@@ -305,6 +305,27 @@ int main(int argc, const char **argv)
     usage();
   }
 
+  {
+    // 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) {