1
0
mirror of https://github.com/ceph/ceph synced 2025-03-18 16:36:12 +00:00

Merge pull request from tchaikov/add-norebalance-flag

Add norebalance flag

Reviewed-by: Samuel Just <sjust@redhat.com>
Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Samuel Just 2015-02-05 06:55:58 -08:00
commit c293a0304b
8 changed files with 23 additions and 9 deletions

View File

@ -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.
@ -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

View File

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

View File

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

View File

@ -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", "")

View File

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

View File

@ -1570,6 +1570,7 @@ void OSDMap::_apply_primary_affinity(ps_t seed,
if (*p != CRUSH_ITEM_NONE &&
(*osd_primary_affinity)[*p] != CEPH_OSD_DEFAULT_PRIMARY_AFFINITY) {
any = true;
break;
}
}
if (!any)
@ -2359,6 +2360,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)
@ -2368,7 +2371,7 @@ string OSDMap::get_flag_string(unsigned f)
if (f & CEPH_OSDMAP_NOTIERAGENT)
s += ",notieragent";
if (s.length())
s = s.erase(0, 1);
s.erase(0, 1);
return s;
}

View File

@ -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();

View File

@ -10669,6 +10669,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) {