Skip to content

Commit

Permalink
osd,mon: add norebalance osdmap flag
Browse files Browse the repository at this point in the history
Fixes: ceph#10559

Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed Feb 5, 2015
1 parent dd4fa1d commit fffa5e2
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 8 deletions.
8 changes: 4 additions & 4 deletions doc/man/8/ceph.rst
Original file line number Diff line number Diff line change
Expand Up @@ -820,8 +820,8 @@ Subcommand ``set`` sets <key>.

Usage::

ceph osd set pause|noup|nodown|noout|noin|nobackfill|norecover|noscrub|
nodeep-scrub|notieragent
ceph osd set pause|noup|nodown|noout|noin|nobackfill|norebalance|norecover|
noscrub|nodeep-scrub|notieragent

Subcommand ``setcrushmap`` sets crush map from input file.

Expand Down Expand Up @@ -906,8 +906,8 @@ Subcommand ``unset`` unsets <key>.

Usage::

osd unset pause|noup|nodown|noout|noin|nobackfill|norecover|noscrub|
nodeep-scrub|notieragent
osd unset pause|noup|nodown|noout|noin|nobackfill|norebalance|norecover|
noscrub|nodeep-scrub|notieragent


pg
Expand Down
2 changes: 1 addition & 1 deletion qa/workunits/cephtool/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ function test_mon_osd()
ceph osd deep-scrub 0
ceph osd repair 0

for f in noup nodown noin noout noscrub nodeep-scrub nobackfill norecover notieragent full
for f in noup nodown noin noout noscrub nodeep-scrub nobackfill norebalance norecover notieragent full
do
ceph osd set $f
ceph osd unset $f
Expand Down
1 change: 1 addition & 0 deletions src/include/rados.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ extern const char *ceph_osd_state_name(int s);
#define CEPH_OSDMAP_NOSCRUB (1<<11) /* block periodic scrub */
#define CEPH_OSDMAP_NODEEP_SCRUB (1<<12) /* block periodic deep-scrub */
#define CEPH_OSDMAP_NOTIERAGENT (1<<13) /* disable tiering agent */
#define CEPH_OSDMAP_NOREBALANCE (1<<14) /* block osd backfill unless pg is degraded */

/*
* The error code to return when an OSD can't handle a write
Expand Down
4 changes: 2 additions & 2 deletions src/mon/MonCommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -518,10 +518,10 @@ COMMAND("osd erasure-code-profile ls", \
"list all erasure code profiles", \
"osd", "r", "cli,rest")
COMMAND("osd set " \
"name=key,type=CephChoices,strings=full|pause|noup|nodown|noout|noin|nobackfill|norecover|noscrub|nodeep-scrub|notieragent", \
"name=key,type=CephChoices,strings=full|pause|noup|nodown|noout|noin|nobackfill|norebalance|norecover|noscrub|nodeep-scrub|notieragent", \
"set <key>", "osd", "rw", "cli,rest")
COMMAND("osd unset " \
"name=key,type=CephChoices,strings=full|pause|noup|nodown|noout|noin|nobackfill|norecover|noscrub|nodeep-scrub|notieragent", \
"name=key,type=CephChoices,strings=full|pause|noup|nodown|noout|noin|nobackfill|norebalance|norecover|noscrub|nodeep-scrub|notieragent", \
"unset <key>", "osd", "rw", "cli,rest")
COMMAND("osd cluster_snap", "take cluster snapshot (disabled)", \
"osd", "r", "")
Expand Down
5 changes: 5 additions & 0 deletions src/mon/OSDMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2473,6 +2473,7 @@ void OSDMonitor::get_health(list<pair<health_status_t,string> >& summary,
CEPH_OSDMAP_NOIN |
CEPH_OSDMAP_NOOUT |
CEPH_OSDMAP_NOBACKFILL |
CEPH_OSDMAP_NOREBALANCE |
CEPH_OSDMAP_NORECOVER |
CEPH_OSDMAP_NOSCRUB |
CEPH_OSDMAP_NODEEP_SCRUB |
Expand Down Expand Up @@ -5279,6 +5280,8 @@ bool OSDMonitor::prepare_command_impl(MMonCommand *m,
return prepare_set_flag(m, CEPH_OSDMAP_NOIN);
else if (key == "nobackfill")
return prepare_set_flag(m, CEPH_OSDMAP_NOBACKFILL);
else if (key == "norebalance")
return prepare_set_flag(m, CEPH_OSDMAP_NOREBALANCE);
else if (key == "norecover")
return prepare_set_flag(m, CEPH_OSDMAP_NORECOVER);
else if (key == "noscrub")
Expand Down Expand Up @@ -5309,6 +5312,8 @@ bool OSDMonitor::prepare_command_impl(MMonCommand *m,
return prepare_unset_flag(m, CEPH_OSDMAP_NOIN);
else if (key == "nobackfill")
return prepare_unset_flag(m, CEPH_OSDMAP_NOBACKFILL);
else if (key == "norebalance")
return prepare_unset_flag(m, CEPH_OSDMAP_NOREBALANCE);
else if (key == "norecover")
return prepare_unset_flag(m, CEPH_OSDMAP_NORECOVER);
else if (key == "noscrub")
Expand Down
2 changes: 2 additions & 0 deletions src/osd/OSDMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2359,6 +2359,8 @@ string OSDMap::get_flag_string(unsigned f)
s += ",noin";
if (f & CEPH_OSDMAP_NOBACKFILL)
s += ",nobackfill";
if (f & CEPH_OSDMAP_NOREBALANCE)
s += ",norebalance";
if (f & CEPH_OSDMAP_NORECOVER)
s += ",norecover";
if (f & CEPH_OSDMAP_NOSCRUB)
Expand Down
3 changes: 2 additions & 1 deletion src/osd/PG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6413,7 +6413,8 @@ boost::statechart::result PG::RecoveryState::Active::react(const ActMap&)
}

if (!pg->is_clean() &&
!pg->get_osdmap()->test_flag(CEPH_OSDMAP_NOBACKFILL)) {
!pg->get_osdmap()->test_flag(CEPH_OSDMAP_NOBACKFILL) &&
(!pg->get_osdmap()->test_flag(CEPH_OSDMAP_NOREBALANCE) || pg->is_degraded())) {
pg->osd->queue_for_recovery(pg);
}
return forward_event();
Expand Down
4 changes: 4 additions & 0 deletions src/osd/ReplicatedPG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10661,6 +10661,10 @@ bool ReplicatedPG::start_recovery_ops(
if (get_osdmap()->test_flag(CEPH_OSDMAP_NOBACKFILL)) {
dout(10) << "deferring backfill due to NOBACKFILL" << dendl;
deferred_backfill = true;
} else if (get_osdmap()->test_flag(CEPH_OSDMAP_NOREBALANCE) &&
!is_degraded()) {
dout(10) << "deferring backfill due to NOREBALANCE" << dendl;
deferred_backfill = true;
} else if (!backfill_reserved) {
dout(10) << "deferring backfill due to !backfill_reserved" << dendl;
if (!backfill_reserving) {
Expand Down

0 comments on commit fffa5e2

Please sign in to comment.