From fcb87701a337e68c1bb3b5bf4ecc85f6bfbc633e Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 4 Jan 2012 11:31:35 -0800 Subject: [PATCH] mon: independently control whether AUTOOUT OSDs are marked in on boot Add separate config option to control whether the monitor will mark AUTOOUT OSDs in on boot. Signed-off-by: Sage Weil --- src/common/config_opts.h | 3 ++- src/mon/OSDMonitor.cc | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 085e3077f856a..adca08bb8806e 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -87,7 +87,8 @@ OPTION(mon_data, OPT_STR, "") OPTION(mon_sync_fs_threshold, OPT_INT, 5) // sync() when writing this many objects; 0 to disable. OPTION(mon_tick_interval, OPT_INT, 5) OPTION(mon_subscribe_interval, OPT_DOUBLE, 300) -OPTION(mon_osd_auto_mark_in, OPT_BOOL, true) // automatically mark new osds 'in' +OPTION(mon_osd_auto_mark_in, OPT_BOOL, true) // mark booting osds 'in' +OPTION(mon_osd_auto_mark_auto_out_in, OPT_BOOL, true) // mark booting auto-marked-out osds 'in' OPTION(mon_osd_down_out_interval, OPT_INT, 300) // seconds OPTION(mon_lease, OPT_FLOAT, 5) // lease interval OPTION(mon_lease_renew_interval, OPT_FLOAT, 3) // on leader, to renew the lease diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 0c74eaf74e046..6472902264388 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -619,6 +619,10 @@ bool OSDMonitor::prepare_boot(MOSDBoot *m) return false; } + int oldstate = osdmap.exists(from) ? osdmap.get_state(from) : 0; + if (pending_inc.new_state.count(from)) + oldstate ^= pending_inc.new_state[from]; + // already up? mark down first? if (osdmap.is_up(from)) { dout(7) << "prepare_boot was up, first marking down " << osdmap.get_inst(from) << dendl; @@ -636,17 +640,17 @@ bool OSDMonitor::prepare_boot(MOSDBoot *m) paxos->wait_for_commit(new C_RetryMessage(this, m)); } else { // mark new guy up. - if (g_conf->mon_osd_auto_mark_in) - down_pending_out.erase(from); // if any - pending_inc.new_up_client[from] = m->get_orig_source_addr(); if (!m->cluster_addr.is_blank_ip()) pending_inc.new_up_internal[from] = m->cluster_addr; pending_inc.new_hb_up[from] = m->hb_addr; // mark in? - if (g_conf->mon_osd_auto_mark_in) + if ((g_conf->mon_osd_auto_mark_auto_out_in && (oldstate & CEPH_OSD_AUTOOUT)) || + (g_conf->mon_osd_auto_mark_in)) { pending_inc.new_weight[from] = CEPH_OSD_IN; + down_pending_out.erase(from); // if any + } if (m->sb.weight) osd_weight[from] = m->sb.weight; -- 2.39.5