]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: Add test case based on Xie script in commit comment
authorDavid Zafman <dzafman@redhat.com>
Wed, 27 Nov 2019 18:50:01 +0000 (10:50 -0800)
committerDavid Zafman <dzafman@redhat.com>
Tue, 3 Dec 2019 01:56:30 +0000 (17:56 -0800)
Other test fixes to reflect changes

Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit 9d2e0267e1f025a634ee4925c919008cacdd3d38)

Conflict:
src/test/cli/osdmaptool/upmap-out.t (older output format)
src/test/cli/osdmaptool/upmap.t (older output format)

qa/standalone/mgr/balancer.sh
src/test/cli/osdmaptool/help.t
src/test/cli/osdmaptool/upmap-out.t
src/test/cli/osdmaptool/upmap.t

index 979d70e3c2c3e561e31622ffca3f883a230b4a53..b8dffccbe8fa860aa2b692f85b11fc0275f67b5f 100755 (executable)
@@ -118,6 +118,98 @@ function TEST_balancer() {
     teardown $dir || return 1
 }
 
+function TEST_balancer2() {
+    local dir=$1
+    TEST_PGS1=118
+    TEST_PGS2=132
+    TOTAL_PGS=$(expr $TEST_PGS1 + $TEST_PGS2)
+    OSDS=5
+    DEFAULT_REPLICAS=3
+    # Integer average of PGS per OSD (70.8), so each OSD >= this
+    FINAL_PER_OSD1=$(expr \( $TEST_PGS1 \* $DEFAULT_REPLICAS \) / $OSDS)
+    # Integer average of PGS per OSD (150)
+    FINAL_PER_OSD2=$(expr \( \( $TEST_PGS1 + $TEST_PGS2 \) \* $DEFAULT_REPLICAS \) / $OSDS)
+
+    CEPH_ARGS+="--osd_pool_default_pg_autoscale_mode=off "
+    CEPH_ARGS+="--debug_osd=20 "
+    setup $dir || return 1
+    run_mon $dir a || return 1
+    run_mgr $dir x || return 1
+    for i in $(seq 0 $(expr $OSDS - 1))
+    do
+      run_osd $dir $i || return 1
+    done
+
+    ceph osd set-require-min-compat-client luminous
+    ceph balancer mode upmap || return 1
+    ceph balancer on || return 1
+    ceph config set mgr mgr/balancer/sleep_interval 5
+
+    create_pool $TEST_POOL1 $TEST_PGS1
+
+    wait_for_clean || return 1
+
+    # Wait up to 2 minutes
+    OK=no
+    for i in $(seq 1 25)
+    do
+      sleep 5
+      if grep -q "Optimization plan is almost perfect" $dir/mgr.x.log
+      then
+        OK=yes
+        break
+      fi
+    done
+    test $OK = "yes" || return 1
+    # Plan is found, but PGs still need to move
+    sleep 30
+    ceph osd df
+
+    PGS=$(ceph osd df --format=json-pretty | jq '.nodes[0].pgs')
+    test $PGS -ge $FINAL_PER_OSD1 || return 1
+    PGS=$(ceph osd df --format=json-pretty | jq '.nodes[1].pgs')
+    test $PGS -ge $FINAL_PER_OSD1 || return 1
+    PGS=$(ceph osd df --format=json-pretty | jq '.nodes[2].pgs')
+    test $PGS -ge $FINAL_PER_OSD1 || return 1
+    PGS=$(ceph osd df --format=json-pretty | jq '.nodes[3].pgs')
+    test $PGS -ge $FINAL_PER_OSD1 || return 1
+    PGS=$(ceph osd df --format=json-pretty | jq '.nodes[4].pgs')
+    test $PGS -ge $FINAL_PER_OSD1 || return 1
+
+    create_pool $TEST_POOL2 $TEST_PGS2
+
+    # Wait up to 2 minutes
+    OK=no
+    for i in $(seq 1 25)
+    do
+      sleep 5
+      COUNT=$(grep "Optimization plan is almost perfect" $dir/mgr.x.log | wc -l)
+      if test $COUNT = "2"
+      then
+        OK=yes
+        break
+      fi
+    done
+    test $OK = "yes" || return 1
+    # Plan is found, but PGs still need to move
+    sleep 30
+    ceph osd df
+
+    # FINAL_PER_OSD2 should distribute evenly
+    PGS=$(ceph osd df --format=json-pretty | jq '.nodes[0].pgs')
+    test $PGS -eq $FINAL_PER_OSD2 || return 1
+    PGS=$(ceph osd df --format=json-pretty | jq '.nodes[1].pgs')
+    test $PGS -eq $FINAL_PER_OSD2 || return 1
+    PGS=$(ceph osd df --format=json-pretty | jq '.nodes[2].pgs')
+    test $PGS -eq $FINAL_PER_OSD2 || return 1
+    PGS=$(ceph osd df --format=json-pretty | jq '.nodes[3].pgs')
+    test $PGS -eq $FINAL_PER_OSD2 || return 1
+    PGS=$(ceph osd df --format=json-pretty | jq '.nodes[4].pgs')
+    test $PGS -eq $FINAL_PER_OSD2 || return 1
+
+    teardown $dir || return 1
+}
+
 main balancer "$@"
 
 # Local Variables:
index 643b624a7741f549692b82396f16d77aa389037c..9309cfbdcba4ff1fe3a1b05b99dc70f9e7cd75e9 100644 (file)
@@ -20,7 +20,7 @@
                              writing commands to <file> [default: - for stdout]
      --upmap-max <max-count> set max upmap entries to calculate [default: 10]
      --upmap-deviation <max-deviation>
-                             max deviation from target [default: .01]
+                             max deviation from target [default: 1]
      --upmap-pool <poolname> restrict upmap balancing to 1 or more pools
      --upmap-save            write modified OSDMap with upmap changes
   [1]
index 54a1def1a9603b848f23d1e33df4467c5b9a7b9a..8a167aba09a9281649828a080c4a70d453e21a8d 100644 (file)
@@ -7,16 +7,18 @@
   marking OSD@147 as out
   writing upmap command output to: c
   checking for upmap cleanups
-  upmap, max-count 11, max deviation 0.01
+  upmap, max-count 11, max deviation 1
   pools rbd 
   prepared 11/11 changes
   $ cat c
   ceph osd pg-upmap-items 1.7 142 145
   ceph osd pg-upmap-items 1.8 219 223
-  ceph osd pg-upmap-items 1.17 171 173 201 202
+  ceph osd pg-upmap-items 1.17 201 202 171 173
   ceph osd pg-upmap-items 1.1a 201 202
-  ceph osd pg-upmap-items 1.1c 171 173 201 202
-  ceph osd pg-upmap-items 1.20 88 87 201 202
+  ceph osd pg-upmap-items 1.1c 201 202
+  ceph osd pg-upmap-items 1.20 201 202
+  ceph osd pg-upmap-items 1.51 201 202
   ceph osd pg-upmap-items 1.62 219 223
   ceph osd pg-upmap-items 1.6f 219 223
+  ceph osd pg-upmap-items 1.82 219 223
   $ rm -f om c
index 4ff14306fe1136b3dbfc6c9058b72fded754720e..8fa1a610313649a7a869a7997179e104b59aea2d 100644 (file)
@@ -6,16 +6,18 @@
   marking all OSDs up and in
   writing upmap command output to: c
   checking for upmap cleanups
-  upmap, max-count 11, max deviation 0.01
+  upmap, max-count 11, max deviation 1
   pools rbd 
   prepared 11/11 changes
   $ cat c
   ceph osd pg-upmap-items 1.7 142 147
   ceph osd pg-upmap-items 1.8 219 223
-  ceph osd pg-upmap-items 1.17 171 173 201 202
+  ceph osd pg-upmap-items 1.17 201 202 171 173
   ceph osd pg-upmap-items 1.1a 201 202
-  ceph osd pg-upmap-items 1.1c 171 173 201 202
-  ceph osd pg-upmap-items 1.20 88 87 201 202
+  ceph osd pg-upmap-items 1.1c 201 202
+  ceph osd pg-upmap-items 1.20 201 202
+  ceph osd pg-upmap-items 1.24 232 233
   ceph osd pg-upmap-items 1.51 201 202
   ceph osd pg-upmap-items 1.62 219 223
+  ceph osd pg-upmap-items 1.6f 219 223
   $ rm -f om c