]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/standalone/scrub: retry in TEST_abort_periodic_for_operator() 61941/head
authorRonen Friedman <rfriedma@redhat.com>
Thu, 20 Feb 2025 16:15:44 +0000 (10:15 -0600)
committerRonen Friedman <rfriedma@redhat.com>
Thu, 20 Feb 2025 16:15:44 +0000 (10:15 -0600)
The scenario created in the test requires two PGs that share the same
Primary, and at least one more member of their active sets.
The PR handles the (unlikely) case where the first PG tried does not
have a counterpart that matches the requirements.

A minor related fix in scrub-helpers.sh: using 'printf' to
return a value, instead of an out (ref) parameter.

Fixes: https://tracker.ceph.com/issues/69837
Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
qa/standalone/scrub/osd-scrub-test.sh
qa/standalone/scrub/scrub-helpers.sh

index 3e4664d3138d06ec98fbcb4cc0bffc0b429708a9..33b246d606767f3f23ddb0352f6a404d57762e19 100755 (executable)
@@ -790,23 +790,25 @@ function TEST_abort_periodic_for_operator() {
     (( extr_dbg >= 2 )) && ceph tell osd.2 dump_scrub_reservations --format=json-pretty
 
     # the first PG to work with:
-    local pg1="1.0"
-    # and another one, that shares its primary, and at least one more active set member
     local pg2=""
-     for pg in "${!pg_pr[@]}"; do
-      if [[ "${pg_pr[$pg]}" == "${pg_pr[$pg1]}" ]]; then
-        local -i common=0
-        count_common_active $pg $pg1 pg_ac common
-        if [[ $common -gt 1 ]]; then
-          pg2=$pg
-          break
+    for pg1 in "${!pg_pr[@]}"; do
+      for pg in "${!pg_pr[@]}"; do
+        if [[ "$pg" == "$pg1" ]]; then
+          continue
         fi
-      fi
+        if [[ "${pg_pr[$pg]}" == "${pg_pr[$pg1]}" ]]; then
+          local -i common=$(count_common_active $pg $pg1 pg_ac)
+          if [[ $common -gt 1 ]]; then
+            pg2=$pg
+            break 2
+          fi
+        fi
+      done
     done
+
     if [[ -z "$pg2" ]]; then
-      # \todo handle the case when no such PG is found
       echo "No PG found with the same primary as $pg1"
-      return 1
+      return 0 # not an error
     fi
 
     # the common primary is allowed two concurrent scrubs
index dd37b643e08f4034c8392ed0d84f4de85b6b5ec8..bb09a00a7fe9bd16e38f36ed8a3746289bdf6566 100644 (file)
@@ -358,7 +358,6 @@ function count_common_active {
   local pg1=$1
   local pg2=$2
   local -n pg_acting_dict=$3
-  local -n res=$4
 
   local -a a1=(${pg_acting_dict[$pg1]})
   local -a a2=(${pg_acting_dict[$pg2]})
@@ -372,7 +371,7 @@ function count_common_active {
     done
   done
 
-  res=$cnt
+  printf '%d' "$cnt"
 }
 
 
@@ -389,8 +388,7 @@ function find_disjoint_but_primary {
 
   for cand in "${!ac_dict[@]}"; do
     if [[ "$cand" != "$pg" ]]; then
-      local -i common=0
-      count_common_active "$pg" "$cand" ac_dict common
+      local -i common=$(count_common_active "$pg" "$cand" ac_dict)
       if [[ $common -eq 0 || ( $common -eq 1 && "${p_dict[$pg]}" == "${p_dict[$cand]}" )]]; then
         res=$cand
         return