2017-07-20 22:26:42 +00:00
|
|
|
#!/usr/bin/env bash
|
2017-05-16 18:57:10 +00:00
|
|
|
|
2017-07-20 22:26:42 +00:00
|
|
|
set -uex
|
2017-05-16 18:57:10 +00:00
|
|
|
|
|
|
|
# number of osds = 10
|
|
|
|
crushtool -o crushmap --build --num_osds 10 host straw 2 rack straw 2 row straw 2 root straw 0
|
|
|
|
ceph osd setcrushmap -i crushmap
|
|
|
|
ceph osd tree
|
2017-06-03 18:13:02 +00:00
|
|
|
ceph tell osd.* injectargs --osd_max_markdown_count 1024 --osd_max_markdown_period 1
|
2018-12-31 17:18:05 +00:00
|
|
|
ceph osd set noout
|
2017-05-16 18:57:10 +00:00
|
|
|
|
2017-05-22 14:09:19 +00:00
|
|
|
wait_for_healthy() {
|
|
|
|
while ceph health | grep down
|
|
|
|
do
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2017-05-16 18:57:10 +00:00
|
|
|
test_mark_two_osds_same_host_down() {
|
2017-05-22 14:09:19 +00:00
|
|
|
ceph osd set noup
|
2017-05-16 18:57:10 +00:00
|
|
|
ceph osd down osd.0 osd.1
|
|
|
|
ceph health detail
|
2017-05-22 14:09:19 +00:00
|
|
|
ceph health | grep "1 host"
|
|
|
|
ceph health | grep "2 osds"
|
2017-05-16 18:57:10 +00:00
|
|
|
ceph health detail | grep "osd.0"
|
|
|
|
ceph health detail | grep "osd.1"
|
2017-05-22 14:09:19 +00:00
|
|
|
ceph osd unset noup
|
|
|
|
wait_for_healthy
|
2017-05-16 18:57:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
test_mark_two_osds_same_rack_down() {
|
2017-05-22 14:09:19 +00:00
|
|
|
ceph osd set noup
|
2017-05-16 18:57:10 +00:00
|
|
|
ceph osd down osd.8 osd.9
|
|
|
|
ceph health detail
|
2017-05-22 14:09:19 +00:00
|
|
|
ceph health | grep "1 host"
|
|
|
|
ceph health | grep "1 rack"
|
|
|
|
ceph health | grep "1 row"
|
|
|
|
ceph health | grep "2 osds"
|
2017-05-16 18:57:10 +00:00
|
|
|
ceph health detail | grep "osd.8"
|
|
|
|
ceph health detail | grep "osd.9"
|
2017-05-22 14:09:19 +00:00
|
|
|
ceph osd unset noup
|
|
|
|
wait_for_healthy
|
2017-05-16 18:57:10 +00:00
|
|
|
}
|
|
|
|
|
2017-06-03 18:13:02 +00:00
|
|
|
test_mark_all_but_last_osds_down() {
|
2017-05-22 14:09:19 +00:00
|
|
|
ceph osd set noup
|
2017-06-03 18:13:02 +00:00
|
|
|
ceph osd down $(ceph osd ls | sed \$d)
|
2017-05-16 18:57:10 +00:00
|
|
|
ceph health detail
|
2017-06-03 18:13:02 +00:00
|
|
|
ceph health | grep "1 row"
|
|
|
|
ceph health | grep "2 racks"
|
|
|
|
ceph health | grep "4 hosts"
|
|
|
|
ceph health | grep "9 osds"
|
2017-05-22 14:09:19 +00:00
|
|
|
ceph osd unset noup
|
|
|
|
wait_for_healthy
|
2017-05-16 18:57:10 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 18:18:37 +00:00
|
|
|
test_mark_two_osds_same_host_down_with_classes() {
|
|
|
|
ceph osd set noup
|
|
|
|
ceph osd crush set-device-class ssd osd.0 osd.2 osd.4 osd.6 osd.8
|
|
|
|
ceph osd crush set-device-class hdd osd.1 osd.3 osd.5 osd.7 osd.9
|
|
|
|
ceph osd down osd.0 osd.1
|
|
|
|
ceph health detail
|
|
|
|
ceph health | grep "1 host"
|
|
|
|
ceph health | grep "2 osds"
|
|
|
|
ceph health detail | grep "osd.0"
|
|
|
|
ceph health detail | grep "osd.1"
|
|
|
|
ceph osd unset noup
|
|
|
|
wait_for_healthy
|
|
|
|
}
|
|
|
|
|
2017-05-16 18:57:10 +00:00
|
|
|
test_mark_two_osds_same_host_down
|
|
|
|
test_mark_two_osds_same_rack_down
|
2017-06-03 18:13:02 +00:00
|
|
|
test_mark_all_but_last_osds_down
|
2017-07-10 18:18:37 +00:00
|
|
|
test_mark_two_osds_same_host_down_with_classes
|
2017-05-16 18:57:10 +00:00
|
|
|
|
|
|
|
exit 0
|