Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,10 @@ jobs:
run: |
set -uex
lxc exec node-wrk0 -- sh -c "microceph.ceph osd crush rule ls" | grep -F microceph_auto_host
lxc exec node-wrk0 -- sh -c "microceph.ceph osd pool ls detail" | grep -F "crush_rule 2"
# Wait for pool migration to crush_rule 2 (host failure domain).
# The mgr-created .mgr pool may not yet exist when this step runs,
# so a bare `grep crush_rule 2` races against pool creation/migration.
lxc exec node-wrk0 -- /mnt/actionutils.sh wait_for_pool_crush_rule 2

- name: Add another OSD
run: |
Expand Down
25 changes: 25 additions & 0 deletions tests/scripts/actionutils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1264,6 +1264,31 @@ function add_osd_to_node() {
sleep 1
}

function wait_for_pool_crush_rule() {
# Wait until at least one pool exists on the cluster with the given
# crush_rule id. After the failure-domain auto-switch flips the default
# crush rule (e.g. osd -> host), the mgr-created .mgr pool may not yet
# exist, or pool migration may still be in flight, so an immediate
# `ceph osd pool ls detail | grep crush_rule N` race-fails.
local rule_id="${1?missing rule id}"
local tries="${2:-30}"
local out=""

for ((i=0; i<tries; i++)); do
out=$(sudo microceph.ceph osd pool ls detail 2>/dev/null || true)
if echo "$out" | grep -qF "crush_rule ${rule_id}"; then
echo "Found pool with crush_rule ${rule_id}"
return 0
fi
sleep 2
done

echo "No pool reached crush_rule ${rule_id} after ${tries} tries"
echo "--- pool ls detail ---"
echo "$out"
return 1
}

function wait_for_osds() {
local expect="${1?missing}"
local res=0
Expand Down
Loading