mirror of
https://github.com/ceph/ceph
synced 2024-12-19 09:57:05 +00:00
Merge pull request #18368 from kungf/scrub_week_day_bound
osd: add scrub week day constraint Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
commit
6a35e37eb9
@ -764,6 +764,8 @@ OPTION(osd_max_scrubs, OPT_INT)
|
||||
OPTION(osd_scrub_during_recovery, OPT_BOOL) // Allow new scrubs to start while recovery is active on the OSD
|
||||
OPTION(osd_scrub_begin_hour, OPT_INT)
|
||||
OPTION(osd_scrub_end_hour, OPT_INT)
|
||||
OPTION(osd_scrub_begin_week_day, OPT_INT)
|
||||
OPTION(osd_scrub_end_week_day, OPT_INT)
|
||||
OPTION(osd_scrub_load_threshold, OPT_FLOAT)
|
||||
OPTION(osd_scrub_min_interval, OPT_FLOAT) // if load is low
|
||||
OPTION(osd_scrub_max_interval, OPT_FLOAT) // regardless of load
|
||||
|
@ -2487,6 +2487,14 @@ std::vector<Option> get_global_options() {
|
||||
.set_default(24)
|
||||
.set_description(""),
|
||||
|
||||
Option("osd_scrub_begin_week_day", Option::TYPE_INT, Option::LEVEL_ADVANCED)
|
||||
.set_default(0)
|
||||
.set_description("The begin week day permits to scrub, include this day, 0 Sunday,1 Monday, .., 6 Saturday"),
|
||||
|
||||
Option("osd_scrub_end_week_day", Option::TYPE_INT, Option::LEVEL_ADVANCED)
|
||||
.set_default(7)
|
||||
.set_description("The end week day permits to scrub, not include this day, 0 Sunday,1 Monday, .., 6 Saturday"),
|
||||
|
||||
Option("osd_scrub_load_threshold", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
|
||||
.set_default(0.5)
|
||||
.set_description(""),
|
||||
|
@ -6931,6 +6931,25 @@ bool OSD::scrub_time_permit(utime_t now)
|
||||
struct tm bdt;
|
||||
time_t tt = now.sec();
|
||||
localtime_r(&tt, &bdt);
|
||||
|
||||
bool day_permit = false;
|
||||
if (cct->_conf->osd_scrub_begin_week_day < cct->_conf->osd_scrub_end_week_day) {
|
||||
if (bdt.tm_wday >= cct->_conf->osd_scrub_begin_week_day && bdt.tm_wday < cct->_conf->osd_scrub_end_week_day) {
|
||||
day_permit = true;
|
||||
}
|
||||
} else {
|
||||
if (bdt.tm_wday >= cct->_conf->osd_scrub_begin_week_day || bdt.tm_wday < cct->_conf->osd_scrub_end_week_day) {
|
||||
day_permit = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!day_permit) {
|
||||
dout(20) << __func__ << " should run between week day " << cct->_conf->osd_scrub_begin_week_day
|
||||
<< " - " << cct->_conf->osd_scrub_end_week_day
|
||||
<< " now " << bdt.tm_wday << " = no" << dendl;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool time_permit = false;
|
||||
if (cct->_conf->osd_scrub_begin_hour < cct->_conf->osd_scrub_end_hour) {
|
||||
if (bdt.tm_hour >= cct->_conf->osd_scrub_begin_hour && bdt.tm_hour < cct->_conf->osd_scrub_end_hour) {
|
||||
|
Loading…
Reference in New Issue
Block a user