You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.5 KiB
Bash
42 lines
1.5 KiB
Bash
#!/bin/bash -ex
|
|
|
|
PG_COUNT=16
|
|
SCHEME=${SCHEME:-replicated}
|
|
|
|
. `dirname $0`/run_3osds.sh
|
|
|
|
try_change()
|
|
{
|
|
n=$1
|
|
s=$2
|
|
|
|
$ETCDCTL put /vitastor/config/pools '{"1":{'$POOLCFG',"pg_size":'$s',"pg_minsize":'$PG_MINSIZE',"pg_count":'$n'}}'
|
|
|
|
for i in {1..10}; do
|
|
($ETCDCTL get /vitastor/config/pgs --print-value-only |\
|
|
jq -s -e '(.[0].items["1"] | map( ([ .osd_set[] | select(. != 0) ] | length) == '$s' ) | length == '$n')
|
|
and ([ .[0].items["1"] | map(.osd_set)[][] ] | sort | unique == ["1","2","3"])') && \
|
|
($ETCDCTL get --prefix /vitastor/pg/state/ --print-value-only | jq -s -e '([ .[] | select(.state == ["active"]) ] | length) == '$n'') && \
|
|
break
|
|
sleep 1
|
|
done
|
|
|
|
if ! ($ETCDCTL get /vitastor/config/pgs --print-value-only |\
|
|
jq -s -e '(.[0].items["1"] | map( ([ .osd_set[] | select(. != 0) ] | length) == '$s' ) | length == '$n')
|
|
and ([ .[0].items["1"] | map(.osd_set)[][] ] | sort | unique == ["1","2","3"])'); then
|
|
$ETCDCTL get /vitastor/config/pgs
|
|
$ETCDCTL get --prefix /vitastor/pg/state/
|
|
format_error "FAILED: PG SIZE NOT CHANGED OR SOME OSDS DO NOT HAVE PGS"
|
|
fi
|
|
|
|
if ! ($ETCDCTL get --prefix /vitastor/pg/state/ --print-value-only | jq -s -e '([ .[] | select(.state == ["active"]) ] | length) == '$n); then
|
|
$ETCDCTL get /vitastor/config/pgs
|
|
$ETCDCTL get --prefix /vitastor/pg/state/
|
|
format_error "FAILED: PGS NOT UP AFTER PG SIZE CHANGE"
|
|
fi
|
|
}
|
|
|
|
try_change 16 2
|
|
|
|
format_green OK
|