From 008b51f77c4270730305a37ecd99528d000f1b51 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Sat, 15 Mar 2025 16:42:28 +0100 Subject: [PATCH] qa/workunits/rbd: make wait_for_omap_keys() work on a non-existent object wait_for_image_in_omap() may be called on a cluster with mirroring configured but rbd-mirror daemon never started. rbd_mirror_leader object isn't expected to exist in that case. This unbreaks "TEST: check if removed images' OMAP are removed (with rbd-mirror on one cluster)". Signed-off-by: Ilya Dryomov --- qa/workunits/rbd/rbd_mirror_helpers.sh | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/qa/workunits/rbd/rbd_mirror_helpers.sh b/qa/workunits/rbd/rbd_mirror_helpers.sh index 40707dcb1eeba..13484c2065200 100755 --- a/qa/workunits/rbd/rbd_mirror_helpers.sh +++ b/qa/workunits/rbd/rbd_mirror_helpers.sh @@ -228,7 +228,7 @@ run_cmd() { run_cmd_internal "$cmd" 'true' 'false' } -# run the command but ignore any failure and return success +# run the command but ignore any failure and return the exit status try_cmd() { local cmd=$1 @@ -241,7 +241,7 @@ run_admin_cmd() { run_cmd_internal "$cmd" 'true' 'true' } -# run the command but ignore any failure and return success +# run the command but ignore any failure and return the exit status try_admin_cmd() { local cmd=$1 @@ -2103,14 +2103,6 @@ get_clone_format() }' } -list_omap_keys() -{ - local cluster=$1 - local pool=$2 - local obj_name=$3 - run_cmd "rados --cluster ${cluster} -p ${pool} listomapkeys ${obj_name}" -} - count_omap_keys_with_filter() { local cluster=$1 @@ -2119,7 +2111,8 @@ count_omap_keys_with_filter() local filter=$4 local -n _count=$5 - list_omap_keys "${cluster}" "${pool}" "${obj_name}" + # listomapkeys fails if the object doesn't exist, assume 0 keys + try_cmd "rados --cluster ${cluster} -p ${pool} listomapkeys ${obj_name}" || : _count=$(grep -c "${filter}" "$CMD_STDOUT") || return 0 } -- 2.39.5