}
// unsafe runtime change?
- if (!opt.is_safe() &&
+ if (!opt.can_update_at_runtime() &&
safe_to_start_threads &&
observers.count(opt.name) == 0) {
// accept value if it is not actually a change
dump_value("min", min, f);
dump_value("max", max, f);
- f->dump_bool("can_update_at_runtime", is_safe());
+ f->dump_bool("can_update_at_runtime", can_update_at_runtime());
}
ostream& operator<<(ostream& out, const Option::value_t& v)
*out << " Minimum: " << stringify(min) << "\n"
<< " Maximum: " << stringify(max) << "\n";
}
- *out << " Can update at runtime: " << (is_safe() ? "true" : "false") << "\n";
+ *out << " Can update at runtime: "
+ << (can_update_at_runtime() ? "true" : "false") << "\n";
if (!services.empty()) {
*out << " Services: " << services << "\n";
}
"setting of 'auto' will use the v2 format if the "
"cluster is configured to require mimic or later "
"clients.")
- .set_safe(),
+ .set_flag(Option::FLAG_RUNTIME),
Option("rbd_journal_order", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
.set_min(12)
}
enum flag_t {
- FLAG_SAFE = 1,
- FLAG_NO_MON_UPDATE = 2,
+ FLAG_SAFE = 0x1, ///< option is observed and can update at runtime
+ FLAG_RUNTIME = 0x1, ///< option can change changed at runtime
+ FLAG_NO_MON_UPDATE = 0x2, ///< option cannot be changed via mon config
+ FLAG_STARTUP = 0x4, ///< option can only take effect at startup
+ FLAG_CLUSTER_CREATE = 0x8, ///< option only has effect at cluster creation
+ FLAG_DAEMON_CREATE = 0x10, ///< option only has effect at daemon creation
};
using value_t = boost::variant<
flags |= f;
return *this;
}
+ Option &set_flags(flag_t f) {
+ flags |= f;
+ return *this;
+ }
Option &set_safe() {
flags |= FLAG_SAFE;
* modified safely at runtime -- should be replaced
* with proper locking!
*/
- bool is_safe() const
+ bool can_update_at_runtime() const
{
return has_flag(FLAG_SAFE)
|| type == TYPE_BOOL || type == TYPE_INT
tbl << Option::level_to_str(i.second.opt->level);
tbl << i.first;
tbl << i.second.raw_value;
- tbl << (i.second.opt->is_safe() ? "*" : "");
+ tbl << (i.second.opt->can_update_at_runtime() ? "*" : "");
tbl << TextTable::endrow;
} else {
f->open_object_section("option");
tbl << Option::level_to_str(q->second.second->opt->level);
tbl << p->first;
tbl << p->second;
- tbl << (q->second.second->opt->is_safe() ? "*" : "");
+ tbl << (q->second.second->opt->can_update_at_runtime() ? "*" : "");
tbl << TextTable::endrow;
} else {
f->open_object_section(p->first.c_str());
f->dump_string("section", q->second.first);
f->dump_object("mask", q->second.second->mask);
f->dump_bool("can_update_at_runtime",
- q->second.second->opt->is_safe());
+ q->second.second->opt->can_update_at_runtime());
f->close_section();
}
}