mirror of
https://github.com/ceph/ceph
synced 2025-02-20 17:37:29 +00:00
mon, crush: add some tests to build a DAG via the cli
Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
a60d7df419
commit
eae1532ca1
@ -3,6 +3,8 @@
|
||||
set -e
|
||||
|
||||
ceph osd crush dump
|
||||
|
||||
# rules
|
||||
ceph osd crush rule dump
|
||||
ceph osd crush rule ls
|
||||
ceph osd crush rule list
|
||||
@ -20,4 +22,41 @@ ceph osd crush rule rm bar
|
||||
# can't delete in-use rules, tho:
|
||||
ceph osd crush rule rm data && exit 1 || true
|
||||
|
||||
# build a simple map
|
||||
ceph osd crush add-bucket foo root
|
||||
o1=`ceph osd create`
|
||||
o2=`ceph osd create`
|
||||
ceph osd crush add $o1 1 host=host1 root=foo
|
||||
ceph osd crush add $o2 1 host=host2 root=foo
|
||||
ceph osd crush add-bucket bar root
|
||||
ceph osd crush link host1 root=bar
|
||||
ceph osd crush link host2 root=bar
|
||||
|
||||
ceph osd tree | grep -c osd.$o1 | grep -q 2
|
||||
ceph osd tree | grep -c host1 | grep -q 2
|
||||
ceph osd tree | grep -c osd.$o2 | grep -q 2
|
||||
ceph osd tree | grep -c host2 | grep -q 2
|
||||
ceph osd crush rm host1 foo && exit 1 || true # not empty
|
||||
ceph osd crush unlink host1 foo
|
||||
ceph osd crush unlink host1 foo && exit 1 || true # not there anymore
|
||||
ceph osd tree | grep -c host1 | grep -q 1
|
||||
|
||||
ceph osd crush rm foo && exit 1 || true
|
||||
ceph osd crush rm bar && exit 1 || true
|
||||
ceph osd crush unlink host1 bar
|
||||
ceph osd tree | grep -c host1 | grep -q 1 # now an orphan
|
||||
ceph osd crush rm osd.1 host1
|
||||
ceph osd crush rm host1
|
||||
ceph osd tree | grep -c host1 | grep -q 0
|
||||
|
||||
ceph osd crush rm bar && exit 1 || true
|
||||
ceph osd crush unlink host2
|
||||
ceph osd crush rm bar
|
||||
ceph osd crush rm foo
|
||||
ceph osd crush rm osd.$o2 host2
|
||||
ceph osd crush rm host2
|
||||
ceph osd crush rm osd.$o1
|
||||
ceph osd crush rm osd.$o2
|
||||
ceph osd crush rm osd.$o2 && exti 1 || true
|
||||
|
||||
echo OK
|
||||
|
@ -54,12 +54,6 @@ bool CrushWrapper::_maybe_remove_last_instance(CephContext *cct, int item, bool
|
||||
{
|
||||
// last instance?
|
||||
if (_search_item_exists(item)) {
|
||||
if (name_map.count(item)) {
|
||||
ldout(cct, 5) << "_maybe_remove_last_instance removing name for item " << item << dendl;
|
||||
name_map.erase(item);
|
||||
have_rmaps = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user