mirror of
https://github.com/ceph/ceph
synced 2025-01-21 02:31:19 +00:00
qa/standalone/crush/crush-choose-args: add weight-set tests
Verify we have the expected behavior for creates and moves that maintain bucket summation, both with and without the osd_crush_update_weight_set option enabled. Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
f20c736e99
commit
4c741c109d
@ -159,6 +159,83 @@ EOF
|
||||
CEPH_ARGS="$ORIG_CEPH_ARGS"
|
||||
}
|
||||
|
||||
function TEST_reweight() {
|
||||
# reweight and reweight-compat behave appropriately
|
||||
local dir=$1
|
||||
|
||||
ORIG_CEPH_ARGS="$CEPH_ARGS"
|
||||
CEPH_ARGS+="--osd-crush-update-weight-set=false "
|
||||
|
||||
run_mon $dir a || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
run_osd $dir 1 || return 1
|
||||
|
||||
ceph osd crush weight-set create-compat || return 1
|
||||
ceph osd crush tree
|
||||
|
||||
ceph osd crush weight-set reweight-compat osd.0 2 || return 1
|
||||
ceph osd crush tree
|
||||
ceph osd crush tree | grep host | grep '6.00000 5.00000' || return 1
|
||||
|
||||
run_osd $dir 2 || return 1
|
||||
ceph osd crush tree
|
||||
ceph osd crush tree | grep host | grep '9.00000 5.00000' || return 1
|
||||
|
||||
ceph osd crush reweight osd.2 4
|
||||
ceph osd crush tree
|
||||
ceph osd crush tree | grep host | grep '10.00000 5.00000' || return 1
|
||||
|
||||
ceph osd crush weight-set reweight-compat osd.2 4
|
||||
ceph osd crush tree
|
||||
ceph osd crush tree | grep host | grep '10.00000 9.00000' || return 1
|
||||
}
|
||||
|
||||
function TEST_move_bucket() {
|
||||
local dir=$1
|
||||
|
||||
run_mon $dir a || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
run_osd $dir 1 || return 1
|
||||
|
||||
ceph osd crush weight-set create-compat || return 1
|
||||
ceph osd crush weight-set reweight-compat osd.0 2 || return 1
|
||||
ceph osd crush weight-set reweight-compat osd.1 2 || return 1
|
||||
ceph osd crush tree
|
||||
ceph osd crush tree | grep HOST | grep '6.00000 4.00000' || return 1
|
||||
|
||||
# moving a bucket adjusts the weights
|
||||
ceph osd crush add-bucket RACK rack root=default || return 1
|
||||
ceph osd crush move HOST rack=RACK || return 1
|
||||
ceph osd crush tree
|
||||
ceph osd crush tree | grep HOST | grep '6.00000 4.00000' || return 1
|
||||
ceph osd crush tree | grep RACK | grep '6.00000 4.00000' || return 1
|
||||
|
||||
# weight-set reweight adjusts containing buckets
|
||||
ceph osd crush weight-set reweight-compat osd.0 1 || return 1
|
||||
ceph osd crush tree
|
||||
ceph osd crush tree | grep HOST | grep '6.00000 3.00000' || return 1
|
||||
ceph osd crush tree | grep RACK | grep '6.00000 3.00000' || return 1
|
||||
|
||||
# moving a leaf resets its weight-set to the canonical weight...
|
||||
ceph config set mon osd_crush_update_weight_set true || return 1
|
||||
ceph osd crush add-bucket FOO host root=default || return 1
|
||||
ceph osd crush move osd.0 host=FOO || return 1
|
||||
ceph osd crush tree
|
||||
ceph osd crush tree | grep osd.0 | grep '3.00000 3.00000' || return 1
|
||||
ceph osd crush tree | grep HOST | grep '3.00000 2.00000' || return 1
|
||||
ceph osd crush tree | grep RACK | grep '3.00000 2.00000' || return 1
|
||||
|
||||
# ...or to zero.
|
||||
ceph config set mon osd_crush_update_weight_set false || return 1
|
||||
ceph osd crush move osd.1 host=FOO || return 1
|
||||
ceph osd crush tree
|
||||
ceph osd crush tree | grep osd.0 | grep '3.00000 3.00000' || return 1
|
||||
ceph osd crush tree | grep osd.1 | grep '3.00000 0' || return 1
|
||||
ceph osd crush tree | grep FOO | grep '6.00000 3.00000' || return 1
|
||||
}
|
||||
|
||||
main crush-choose-args "$@"
|
||||
|
||||
# Local Variables:
|
||||
|
Loading…
Reference in New Issue
Block a user