mirror of
https://github.com/ceph/ceph
synced 2025-01-20 10:01:45 +00:00
mgr/DaemonServer: fix 'osd ok-to-stop' for EC pools
We need to pay attention to account for CRUSH_ITEM_NONE entries in the EC PG acting set. Fixes: https://tracker.ceph.com/issues/43151 Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
eec1d9f0d3
commit
66690ea314
@ -237,5 +237,53 @@ function TEST_0_mds() {
|
||||
kill_daemons $dir KILL mds.a
|
||||
}
|
||||
|
||||
function TEST_0_osd() {
|
||||
local dir=$1
|
||||
|
||||
CEPH_ARGS="$ORIG_CEPH_ARGS --mon-host=$CEPH_MON_A "
|
||||
|
||||
run_mon $dir a --public-addr=$CEPH_MON_A || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
run_osd $dir 1 || return 1
|
||||
run_osd $dir 2 || return 1
|
||||
run_osd $dir 3 || return 1
|
||||
|
||||
ceph osd erasure-code-profile set ec-profile m=2 k=2 crush-failure-domain=osd || return 1
|
||||
ceph osd pool create ec erasure ec-profile || return 1
|
||||
|
||||
wait_for_clean || return 1
|
||||
|
||||
# with min_size 3, we can stop only 1 osd
|
||||
ceph osd pool set ec min_size 3 || return 1
|
||||
flush_pg_stats || return 1
|
||||
|
||||
ceph osd ok-to-stop 0 || return 1
|
||||
ceph osd ok-to-stop 1 || return 1
|
||||
ceph osd ok-to-stop 2 || return 1
|
||||
ceph osd ok-to-stop 3 || return 1
|
||||
! ceph osd ok-to-stop 0 1 || return 1
|
||||
! ceph osd ok-to-stop 2 3 || return 1
|
||||
|
||||
# with min_size 2 we can stop 1 osds
|
||||
ceph osd pool set ec min_size 2 || return 1
|
||||
flush_pg_stats || return 1
|
||||
|
||||
ceph osd ok-to-stop 0 1 || return 1
|
||||
ceph osd ok-to-stop 2 3 || return 1
|
||||
! ceph osd ok-to-stop 0 1 2 || return 1
|
||||
! ceph osd ok-to-stop 1 2 3 || return 1
|
||||
|
||||
# we should get the same result with one of the osds already down
|
||||
kill_daemons $dir TERM osd.0 || return 1
|
||||
ceph osd down 0 || return 1
|
||||
flush_pg_stats || return 1
|
||||
|
||||
ceph osd ok-to-stop 0 || return 1
|
||||
ceph osd ok-to-stop 0 1 || return 1
|
||||
! ceph osd ok-to-stop 0 1 2 || return 1
|
||||
! ceph osd ok-to-stop 1 2 3 || return 1
|
||||
}
|
||||
|
||||
|
||||
main ok-to-stop "$@"
|
||||
|
@ -1588,7 +1588,9 @@ bool DaemonServer::_handle_command(
|
||||
found = true;
|
||||
continue;
|
||||
}
|
||||
pg_acting.insert(anm.osd);
|
||||
if (anm.osd != CRUSH_ITEM_NONE) {
|
||||
pg_acting.insert(anm.osd);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (auto& a : q.second.acting) {
|
||||
@ -1596,7 +1598,9 @@ bool DaemonServer::_handle_command(
|
||||
found = true;
|
||||
continue;
|
||||
}
|
||||
pg_acting.insert(a);
|
||||
if (a != CRUSH_ITEM_NONE) {
|
||||
pg_acting.insert(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
|
Loading…
Reference in New Issue
Block a user