]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDMap: Show health warning if a pool is configured with size 1 31416/head
authorSridhar Seshasayee <sseshasa@redhat.com>
Tue, 5 Nov 2019 10:40:14 +0000 (16:10 +0530)
committerSridhar Seshasayee <sseshasa@redhat.com>
Mon, 11 Nov 2019 05:06:35 +0000 (10:36 +0530)
Introduce a config option called 'mon_warn_on_pool_no_redundancy' that is
used to show a health warning if any pool in the ceph cluster is
configured with a size of 1. The user can mute/unmute the warning using
'ceph health mute/unmute POOL_NO_REDUNDANCY'.

Add standalone test to verify warning on setting pool size=1. Set the
associated warning to 'false' in ceph.conf.template under qa/tasks so
that existing tests do not break.

Fixes: https://tracker.ceph.com/issues/41666
Signed-off-by: Sridhar Seshasayee <sseshasa@redhat.com>
PendingReleaseNotes
doc/rados/configuration/mon-config-ref.rst
qa/standalone/mon/health-mute.sh
qa/tasks/ceph.conf.template
src/common/options.cc
src/osd/OSDMap.cc

index 9edf474c8faf463b82f091140eb9df97e5525ac8..9a5f0da523af9e1a19a9ba86b810990a3e73efa8 100644 (file)
 
     ceph config set global mon_warn_on_pool_pg_num_not_power_of_two false
 
+* Ceph will issue a health warning if a RADOS pool's ``size`` is set to 1
+  or in other words the pool is configured with no redundancy. This can
+  be fixed by setting the pool size to the minimum recommended value
+  with::
+
+    ceph osd pool set <pool-name> size <num-replicas>
+
+  The warning can be silenced with::
+
+    ceph config set global mon_warn_on_pool_no_redundancy false
+
 
 >=15.0.0
 --------
index e40b53ff96be07f650788c4dd8f7276ec188a545..dbfc20b908404583f4d50aec8e338e2593b3180e 100644 (file)
@@ -420,6 +420,14 @@ by setting it in the ``[mon]`` section of the configuration file.
 :Default: ``0``
 
 
+``mon warn on pool no redundancy``
+
+:Description: Issue a ``HEALTH_WARN`` in cluster log if any pool is
+              configured with no replicas.
+:Type: Boolean
+:Default: ``True``
+
+
 ``mon cache target full warn ratio``
 
 :Description: Position between pool's ``cache_target_full`` and
index 270d30c65d974ca15ab783a946d3a35f694b5f3e..a255798b82fbd05fb269f033af04ed938dcef924 100755 (executable)
@@ -35,6 +35,21 @@ function TEST_mute() {
     ceph osd pool application enable foo rbd --yes-i-really-mean-it
     wait_for_clean || return 1
 
+    ceph -s
+    ceph health | grep HEALTH_OK || return 1
+    # test warning on setting pool size=1
+    ceph osd pool set foo size 1
+    ceph -s
+    ceph health | grep HEALTH_WARN || return 1
+    ceph health detail | grep POOL_NO_REDUNDANCY || return 1
+    ceph health mute POOL_NO_REDUNDANCY
+    ceph -s
+    ceph health | grep HEALTH_OK | grep POOL_NO_REDUNDANCY || return 1
+    ceph health unmute POOL_NO_REDUNDANCY
+    ceph -s
+    ceph health | grep HEALTH_WARN || return 1
+    # restore pool size to default
+    ceph osd pool set foo size 3
     ceph -s
     ceph health | grep HEALTH_OK || return 1
     ceph osd set noup
index 2c7f365f0103bef392ec4a0f1d35ac017a657dbb..493eacb32caa3d0fbbb397cb767ac539efa6d352 100644 (file)
@@ -29,6 +29,7 @@
        mon warn on osd down out interval zero = false
        mon warn on too few osds = false
        mon_warn_on_pool_pg_num_not_power_of_two = false
+        mon_warn_on_pool_no_redundancy = false
 
         osd pool default erasure code profile = "plugin=jerasure technique=reed_sol_van k=2 m=1 ruleset-failure-domain=osd crush-failure-domain=osd"
 
index 1f76931f8054c25c68765cba07468f1811bb56ff..b261d63e7210c2a2cf5cf9c93fe5bec630d19f93 100644 (file)
@@ -1712,6 +1712,13 @@ std::vector<Option> get_global_options() {
     .add_service("mon")
     .set_description("issue POOL_PG_NUM_NOT_POWER_OF_TWO warning if pool has a non-power-of-two pg_num value"),
 
+    Option("mon_warn_on_pool_no_redundancy", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
+    .set_default(true)
+    .add_service("mon")
+    .set_description("Issue a health warning if any pool is configured with no replicas")
+    .add_see_also("osd_pool_default_size")
+    .add_see_also("osd_pool_default_min_size"),
+
     Option("mon_warn_on_misplaced", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
     .set_default(false)
     .add_service("mgr")
index 6b5930743a331e56bc091c57995a0dd7393f9b3d..f174e1b19dc20d9a4d6990b0fda43a16ad35d326 100644 (file)
@@ -5915,6 +5915,27 @@ void OSDMap::check_health(CephContext *cct,
       d.detail.swap(detail);
     }
   }
+
+  // POOL_NO_REDUNDANCY
+  if (cct->_conf.get_val<bool>("mon_warn_on_pool_no_redundancy"))
+  {
+    list<string> detail;
+    for (auto it : get_pools()) {
+      if (it.second.get_size() == 1) {
+        ostringstream ss;
+        ss << "pool '" << get_pool_name(it.first)
+           << "' has no replicas configured";
+        detail.push_back(ss.str());
+      }
+    }
+    if (!detail.empty()) {
+      ostringstream ss;
+      ss << detail.size() << " pool(s) have no replicas configured";
+      auto& d = checks->add("POOL_NO_REDUNDANCY", HEALTH_WARN,
+        ss.str(), detail.size());
+      d.detail.swap(detail);
+    }
+  }
 }
 
 int OSDMap::parse_osd_id_list(const vector<string>& ls, set<int> *out,