Merge PR #32046 into master

* refs/pull/32046/head:
	mgr/DaemonServer: fix 'osd ok-to-stop' for EC pools

Reviewed-by: Neha Ojha <nojha@redhat.com>
This commit is contained in:
Sage Weil 2019-12-09 15:34:57 -06:00
commit bffe2dd9e9
2 changed files with 54 additions and 2 deletions

View File

@ -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 "$@"

View File

@ -1598,7 +1598,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) {
@ -1606,7 +1608,9 @@ bool DaemonServer::_handle_command(
found = true;
continue;
}
pg_acting.insert(a);
if (a != CRUSH_ITEM_NONE) {
pg_acting.insert(a);
}
}
}
if (!found) {