]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDMap: Check for uneven weights & != 2 buckets stretch mode
authorKamoltat <ksirivad@redhat.com>
Thu, 22 Sep 2022 03:41:16 +0000 (03:41 +0000)
committerKamoltat <ksirivad@redhat.com>
Wed, 10 Jan 2024 09:19:38 +0000 (09:19 +0000)
Added additional health warnings in
``OSDMap::check_health()``.

1. Check for uneven weights of the two dividing
buckets if stretch mode is enabled and spit out
warnings if true.

2. Check for != 2 buckets if stretch mode is enabled
and spit out warnings if true.

Fixes: https://tracker.ceph.com/issues/57570
Signed-off-by: Kamoltat <ksirivad@redhat.com>
(cherry picked from commit 78baf23ea214dce3c1a7cf3f3515706d03f950ed)

src/osd/OSDMap.cc

index 2858934f023c1b4fe21a007e41af7212eb6bdc8a..a263d4c10c6c060264048f84d13186490ebcd6df 100644 (file)
@@ -6279,6 +6279,24 @@ void OSDMap::check_health(CephContext *cct,
                            ss.str(), 0);
     }
   }
+  // UNEQUAL_WEIGHT
+  if (stretch_mode_enabled) {
+    vector<int> subtrees;
+    crush->get_subtree_of_type(stretch_mode_bucket, &subtrees);
+    if (subtrees.size() != 2) {
+      stringstream ss;
+      ss << "Stretch mode buckets != 2";
+      checks->add("INCORRECT_NUM_BUCKETS_STRETCH_MODE", HEALTH_WARN, ss.str(), 0);
+      return;
+    }
+    int weight1 = crush->get_item_weight(subtrees[0]);
+    int weight2 = crush->get_item_weight(subtrees[1]);
+    stringstream ss;
+    if (weight1 != weight2) {
+      ss << "Stretch mode buckets have different weights!";
+      checks->add("UNEVEN_WEIGHTS_STRETCH_MODE", HEALTH_WARN, ss.str(), 0);
+    }
+  }
 }
 
 int OSDMap::parse_osd_id_list(const vector<string>& ls, set<int> *out,