]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/standalone: Add a test for running repeer on simple ec and rep pools 66575/head
authorTom Sollers <tom.sollers@ibm.com>
Tue, 9 Dec 2025 14:36:25 +0000 (14:36 +0000)
committerTom Sollers <tom.sollers@ibm.com>
Tue, 9 Dec 2025 14:36:25 +0000 (14:36 +0000)
This commit appends a new test to the end of repeer-on-acting-back.sh which creates an ec pool and a replicated pool, performes some I/O on them, and then picks two random PG to repeer from each pool.

Signed-off-by: Tom Sollers <tom.sollers@ibm.com>
qa/standalone/osd/repeer-on-acting-back.sh

index 7aa248406764ae171e98adc78cf5b968ff7420d5..126db5b5c4c4c3d8b2f36a692777681c52c42924 100755 (executable)
@@ -147,6 +147,71 @@ function TEST_repeer_on_down_acting_member_coming_back() {
     kill_daemons $dir || return 1
 }
 
+function TEST_ceph_pg_repeer_on_simple_ec_and_rep_pools() {
+  local dir=$1
+  local pools=1
+  local OSDS=3
+
+  run_mon $dir a || return 1
+  run_mgr $dir x || return 1
+  export CEPH_ARGS
+
+  for osd in $(seq 0 $(expr $OSDS - 1))
+  do
+    run_osd $dir $osd || return 1
+  done
+
+  #setup erasure coded pool
+  EC_POOL_NAME="ecpool"
+  METADATA_POOL_NAME="ecpool_metadata"
+
+  ceph osd erasure-code-profile set ec-prof plugin=isa k=2 m=1 crush-failure-domain=osd
+  
+  ceph osd pool create $EC_POOL_NAME erasure ec-prof || return 1
+  ceph osd pool set $EC_POOL_NAME allow_ec_overwrites true || return 1
+  ceph osd pool application enable $EC_POOL_NAME rbd || return 1
+
+  #create a metadata pool for the ec pool
+  ceph osd pool create $METADATA_POOL_NAME replicated || return 1
+  rbd pool init $METADATA_POOL_NAME || return 1
+
+  #create an rbd image on the ec pool
+  rbd create -s 10G --data-pool $EC_POOL_NAME $METADATA_POOL_NAME/vol0 || return 1
+  
+  #create a replicated pool now
+  REP_POOL_NAME="reppool"
+
+  ceph osd pool create $REP_POOL_NAME replicated || return 1
+  rbd pool init $REP_POOL_NAME || return 1
+
+  #create an rbd image on the replicated pool
+  rbd create -s 10G $REP_POOL_NAME/vol0 || return 1
+
+  # Perform some I/O on both images
+  rbd bench -p $REP_POOL_NAME --image vol0 --io-size 1K --io-threads 1 --io-total 10000K --io-pattern rand --io-type readwrite || return 1
+  rbd bench -p $METADATA_POOL_NAME --image vol0 --io-size 1K --io-threads 1 --io-total 10000K --io-pattern rand --io-type readwrite || return 1
+
+  #Grab a list of all the pgs in the ec pool and the rep pool
+  ec_pgs=$(ceph pg ls-by-pool $EC_POOL_NAME | grep [0-9]. | awk '{print $1}')
+  rep_pgs=$(ceph pg ls-by-pool $REP_POOL_NAME | grep [0-9]. | awk '{print $1}')
+
+  ec_pgs_list=( $ec_pgs )
+  rep_pgs_list=( $rep_pgs )
+
+  echo ${#ec_pgs_list[@]}
+  echo ${ec_pgs_list[@]}
+
+  echo ${#rep_pgs_list[@]}
+  echo ${rep_pgs_list[@]}
+
+  #Now pick 2 pgs from each pool at random and then cause them to repeer
+  ceph pg repeer ${ec_pgs_list[ $RANDOM % ${#ec_pgs_list[@]} ]} || return 1
+  ceph pg repeer ${ec_pgs_list[ $RANDOM % ${#ec_pgs_list[@]} ]} || return 1
+  ceph pg repeer ${rep_pgs_list[ $RANDOM % ${#rep_pgs_list[@]} ]} || return 1
+  ceph pg repeer ${rep_pgs_list[ $RANDOM % ${#rep_pgs_list[@]} ]} || return 1
+
+}
+
 main repeer-on-acting-back "$@"
 
 # Local Variables: