osd: Don't exit on finding own state key, arm lease timers only after the grant #186
@@ -550,6 +550,14 @@ void osd_t::acquire_lease()
|
||||
return;
|
||||
}
|
||||
etcd_lease_id = data["ID"].string_value();
|
||||
tfd->set_timer(etcd_report_interval*1000, true, [this](int timer_id)
|
||||
{
|
||||
renew_lease(false);
|
||||
});
|
||||
tfd->set_timer(etcd_stats_interval*1000, true, [this](int timer_id)
|
||||
{
|
||||
report_statistics();
|
||||
});
|
||||
create_osd_state();
|
||||
// Flush PG state reports that were held back until the lease existed
|
||||
report_pg_states();
|
||||
@@ -559,14 +567,6 @@ void osd_t::acquire_lease()
|
||||
(config["etcd_address"].is_string() ? config["etcd_address"].string_value() : config["etcd_address"].dump()).c_str(),
|
||||
etcd_report_interval, etcd_stats_interval
|
||||
);
|
||||
tfd->set_timer(etcd_report_interval*1000, true, [this](int timer_id)
|
||||
{
|
||||
renew_lease(false);
|
||||
});
|
||||
tfd->set_timer(etcd_stats_interval*1000, true, [this](int timer_id)
|
||||
{
|
||||
report_statistics();
|
||||
});
|
||||
}
|
||||
|
||||
// Report "up" state once, then keep it alive using the lease
|
||||
@@ -618,7 +618,9 @@ void osd_t::create_osd_state()
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!data["succeeded"].bool_value())
|
||||
// A key with our own lease means an earlier attempt went through but its reply was lost
|
||||
if (!data["succeeded"].bool_value() &&
|
||||
data["responses"][0]["response_range"]["kvs"][0]["lease"].string_value() != etcd_lease_id)
|
||||
{
|
||||
// OSD is already up
|
||||
auto kv = st_cli->parse_etcd_kv(data["responses"][0]["response_range"]["kvs"][0]);
|
||||
|
||||
Reference in New Issue
Block a user