From: Adam King Date: Thu, 12 Jan 2023 20:00:12 +0000 (-0500) Subject: qa/suites/orch/cephadm: teuth test for mon crush locations X-Git-Tag: v18.1.0~61^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=52d1b60fd018a68a70591ebf63167c5858861860;p=ceph-ci.git qa/suites/orch/cephadm: teuth test for mon crush locations Trying to add a feature where mon crush locations can be set through the orchestrator using the mon service spec. This is meant to be a test for that. Signed-off-by: Adam King (cherry picked from commit 8c52a0a77b2ddad077d1de47ea67b89904e47e99) --- diff --git a/qa/suites/orch/cephadm/workunits/task/test_set_mon_crush_locations.yaml b/qa/suites/orch/cephadm/workunits/task/test_set_mon_crush_locations.yaml new file mode 100644 index 00000000000..6d9bd1525d8 --- /dev/null +++ b/qa/suites/orch/cephadm/workunits/task/test_set_mon_crush_locations.yaml @@ -0,0 +1,62 @@ +roles: +- - host.a + - osd.0 + - mon.a + - mgr.a +- - host.b + - osd.1 + - mon.b + - mgr.b +- - host.c + - osd.2 + - mon.c +tasks: +- install: +- cephadm: +- cephadm.apply: + specs: + - service_type: mon + service_id: foo + placement: + count: 3 + spec: + crush_locations: + host.a: + - datacenter=a + host.b: + - datacenter=b + - rack=2 + host.c: + - datacenter=a + - rack=3 +- cephadm.shell: + host.a: + - | + set -ex + # since we don't know the real hostnames before the test, the next + # bit is in order to replace the fake hostnames "host.a/b/c" with + # the actual names cephadm knows the host by within the mon spec + ceph orch host ls --format json | jq -r '.[] | .hostname' > realnames + echo $'host.a\nhost.b\nhost.c' > fakenames + echo $'a\nb\nc' > mon_ids + echo $'{datacenter=a}\n{datacenter=b,rack=2}\n{datacenter=a,rack=3}' > crush_locs + ceph orch ls --service-name mon --export > mon.yaml + MONSPEC=`cat mon.yaml` + echo "$MONSPEC" + while read realname <&3 && read fakename <&4; do + MONSPEC="${MONSPEC//$fakename/$realname}" + done 3 mon.yaml + cat mon.yaml + # now the spec should have the real hostnames, so let's re-apply + ceph orch apply -i mon.yaml + sleep 90 + ceph orch ps --refresh + ceph orch ls --service-name mon --export > mon.yaml; ceph orch apply -i mon.yaml + sleep 90 + ceph mon dump + ceph mon dump --format json + # verify all the crush locations got set from "ceph mon dump" output + while read monid <&3 && read crushloc <&4; do + ceph mon dump --format json | jq --arg monid "$monid" --arg crushloc "$crushloc" -e '.mons | .[] | select(.name == $monid) | .crush_location == $crushloc' + done 3