]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/cephadm: test --rm-crush-entry host rm flag in host drain test
authorAdam King <adking@redhat.com>
Fri, 29 Sep 2023 20:52:37 +0000 (16:52 -0400)
committerAdam King <adking@redhat.com>
Wed, 13 Mar 2024 02:42:25 +0000 (22:42 -0400)
Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 7870538dc1e19760cd96a3d343ae3d3235f71eb2)

qa/suites/orch/cephadm/workunits/task/test_host_drain.yaml

index c73d2cdb2788d8e279f5cd0063e609277e8e4890..83173c9f8b22ee353ee789963562488b63bff738 100644 (file)
@@ -36,11 +36,27 @@ tasks:
           sleep 15
           HOST_C_DAEMONS=$(ceph orch ps --hostname $HOST_C)
         done
+        # we want to check the ability to remove the host from
+        # the CRUSH map, so we should first verify the host is in
+        # the CRUSH map.
+        ceph osd getcrushmap -o compiled-crushmap
+        crushtool -d compiled-crushmap -o crushmap.txt
+        CRUSH_MAP=$(cat crushmap.txt)
+        if ! grep -q "$HOST_C" <<< "$CRUSH_MAP"; then
+          printf "Expected to see $HOST_C in CRUSH map. Saw:\n\n$CRUSH_MAP"
+          exit 1
+        fi
         # 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
-        
-        
-        
+        ceph orch host rm $HOST_C --rm-crush-entry
+        # verify we've successfully removed the host from the CRUSH map
+        sleep 30
+        ceph osd getcrushmap -o compiled-crushmap
+        crushtool -d compiled-crushmap -o crushmap.txt
+        CRUSH_MAP=$(cat crushmap.txt)
+        if grep -q "$HOST_C" <<< "$CRUSH_MAP"; then
+          printf "Saw $HOST_C in CRUSH map after it should have been removed.\n\n$CRUSH_MAP"
+          exit 1
+        fi