From: Adam King Date: Fri, 29 Sep 2023 20:09:48 +0000 (-0400) Subject: qa/cephadm: add teuthology test for host draining X-Git-Tag: v17.2.8~466^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4ef8a09a12ccabd53597a96e61ab11b5b18f9795;p=ceph.git qa/cephadm: add teuthology test for host draining This was a gap in our testing in general, but I'm adding it here right now specifically to use it to test the "--rm-crush-entry" flag in a follow up commit Signed-off-by: Adam King (cherry picked from commit 13f16e8d7bb029980d6688680390521253970e9a) --- diff --git a/qa/suites/orch/cephadm/workunits/task/test_host_drain.yaml b/qa/suites/orch/cephadm/workunits/task/test_host_drain.yaml new file mode 100644 index 000000000000..c73d2cdb2788 --- /dev/null +++ b/qa/suites/orch/cephadm/workunits/task/test_host_drain.yaml @@ -0,0 +1,46 @@ +roles: +- - host.a + - mon.a + - mgr.a + - osd.0 + - osd.1 +- - host.b + - mon.b + - mgr.b + - osd.2 + - osd.3 +- - host.c + - mon.c + - osd.4 + - osd.5 +tasks: +- install: +- cephadm: +- cephadm.shell: + host.a: + - | + set -ex + HOSTNAMES=$(ceph orch host ls --format json | jq -r '.[] | .hostname') + for host in $HOSTNAMES; do + # find the hostname for "host.c" which will have no mgr + HAS_MGRS=$(ceph orch ps --hostname ${host} --format json | jq 'any(.daemon_type == "mgr")') + if [ "$HAS_MGRS" == "false" ]; then + HOST_C="${host}" + fi + done + # now drain that host + ceph orch host drain $HOST_C --zap-osd-devices + # wait for drain to complete + HOST_C_DAEMONS=$(ceph orch ps --hostname $HOST_C) + while [ "$HOST_C_DAEMONS" != "No daemons reported" ]; do + sleep 15 + HOST_C_DAEMONS=$(ceph orch ps --hostname $HOST_C) + done + # If the drain was successful, we should be able to remove the + # host without force with no issues. If there are still daemons + # we will get a response telling us to drain the host and a + # non-zero return code + ceph orch host rm $HOST_C + + +