]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: Add test case based on Xie script in commit comment 31774/head
authorDavid Zafman <dzafman@redhat.com>
Wed, 27 Nov 2019 18:50:01 +0000 (10:50 -0800)
committerDavid Zafman <dzafman@redhat.com>
Thu, 28 Nov 2019 00:29:29 +0000 (16:29 -0800)
Other test fixes to reflect changes

Signed-off-by: David Zafman <dzafman@redhat.com>
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 425d4de2d6da8cf659ef46c74c44a77405af0d0c..f7aba3156d360cfb919b29167d11c1d44672d323 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 e785ebb11ea9f96c8a247bf21edf47efbd95d280..807ec7c3f2cf2718cd82d2475bc1eb5168731041 100644 (file)
@@ -25,7 +25,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
      --dump <format>         displays the map in plain text when <format> is 'plain', 'json' if specified format is not supported
index 8c0f43589773c721e26d8b14d06ea295573f14d3..6bafe38b11a73460c2fd86a0eb4ee4784f4ca68f 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
   prepared 11 changes for pools(s) rbd 
   prepared 11 changes in total
   $ 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 17683eb4b25b785186005b9bd2e1111b22da4eb6..36746fbfff62d605649d2bc8d4499a385149853a 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
   prepared 11 changes for pools(s) rbd 
   prepared 11 changes in total
   $ 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