summaryrefslogtreecommitdiffstats
path: root/qa/workunits/mon/pool_ops.sh
diff options
context:
space:
mode:
authorDeepika Upadhyay <dupadhya@redhat.com>2020-04-02 09:01:16 +0200
committerDeepika Upadhyay <dupadhya@redhat.com>2020-04-02 09:17:34 +0200
commit0a7325a2b2ee82752b4191c240e7c7a6f14a2b3e (patch)
treebf908afea084ed696e1a07abb0cccd469ce7dea5 /qa/workunits/mon/pool_ops.sh
parentmon: calculate min_size on osd pool set size (diff)
downloadceph-0a7325a2b2ee82752b4191c240e7c7a6f14a2b3e.tar.xz
ceph-0a7325a2b2ee82752b4191c240e7c7a6f14a2b3e.zip
qa/workunits/mon: add check for min_size
verify whether min_size is recalculated when osd pool size is changed. fixes: https://tracker.ceph.com/issues/44862 Signed-off-by: Deepika Upadhyay <dupadhya@redhat.com>
Diffstat (limited to 'qa/workunits/mon/pool_ops.sh')
-rwxr-xr-xqa/workunits/mon/pool_ops.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/qa/workunits/mon/pool_ops.sh b/qa/workunits/mon/pool_ops.sh
index 198a65869c7..6baae495ddd 100755
--- a/qa/workunits/mon/pool_ops.sh
+++ b/qa/workunits/mon/pool_ops.sh
@@ -8,6 +8,41 @@ function expect_false()
if "$@"; then return 1; else return 0; fi
}
+function get_config_value_or_die()
+{
+ local pool_name config_opt raw val
+
+ pool_name=$1
+ config_opt=$2
+
+ raw="`$SUDO ceph osd pool get $pool_name $config_opt 2>/dev/null`"
+ if [[ $? -ne 0 ]]; then
+ echo "error obtaining config opt '$config_opt' from '$pool_name': $raw"
+ exit 1
+ fi
+
+ raw=`echo $raw | sed -e 's/[{} "]//g'`
+ val=`echo $raw | cut -f2 -d:`
+
+ echo "$val"
+ return 0
+}
+
+function expect_config_value()
+{
+ local pool_name config_opt expected_val val
+ pool_name=$1
+ config_opt=$2
+ expected_val=$3
+
+ val=$(get_config_value_or_die $pool_name $config_opt)
+
+ if [[ "$val" != "$expected_val" ]]; then
+ echo "expected '$expected_val', got '$val'"
+ exit 1
+ fi
+}
+
# note: we need to pass the other args or ceph_argparse.py will take
# 'invalid' that is not replicated|erasure and assume it is the next
# argument, which is a string.
@@ -20,8 +55,11 @@ ceph osd pool create foooo 123
ceph osd pool create foo 123 # idempotent
ceph osd pool set foo size 1 --yes-i-really-mean-it
+expect_config_value "foo" "min_size" 1
ceph osd pool set foo size 4
+expect_config_value "foo" "min_size" 2
ceph osd pool set foo size 10
+expect_config_value "foo" "min_size" 5
expect_false ceph osd pool set foo size 0
expect_false ceph osd pool set foo size 20