warnings.
Fixes: https://tracker.ceph.com/issues/69707
Signed-off-by: Rishabh Dave <ridave@redhat.com>
return -ENOENT;
}
+ vector<mds_gid_t> mds_gids_to_fail;
+ for (const auto& p : fsp->get_mds_map().get_mds_info()) {
+ mds_gids_to_fail.push_back(p.first);
+ }
+
bool confirm = false;
cmd_getval(cmdmap, "yes_i_really_mean_it", confirm);
if (!confirm &&
mon->mdsmon()->has_health_warnings({
- MDS_HEALTH_TRIM, MDS_HEALTH_CACHE_OVERSIZED})) {
+ MDS_HEALTH_TRIM, MDS_HEALTH_CACHE_OVERSIZED}, mds_gids_to_fail)) {
ss << errmsg_for_unhealthy_mds;
return -EPERM;
}
};
fsmap.modify_filesystem(fsp->get_fscid(), std::move(f));
- vector<mds_gid_t> mds_gids_to_fail;
- for (const auto& p : fsp->get_mds_map().get_mds_info()) {
- mds_gids_to_fail.push_back(p.first);
- }
-
for (const auto& gid : mds_gids_to_fail) {
mon->mdsmon()->fail_mds_gid(fsmap, gid);
}
}
}
-bool MDSMonitor::has_health_warnings(vector<mds_metric_t> warnings, mds_gid_t gid)
+bool MDSMonitor::has_health_warnings(vector<mds_metric_t> warnings, const mds_gid_t& gid)
{
for (auto& [_gid, health] : pending_daemon_health) {
if (gid != MDS_GID_NONE) {
return false;
}
+bool MDSMonitor::has_health_warnings(const vector<mds_metric_t>& warnings,
+ const std::vector<mds_gid_t>& gids)
+{
+ for (auto& gid : gids) {
+ if (has_health_warnings(warnings, gid)) {
+ return true;
+ }
+ }
+ return false;
+}
+
bool MDSMonitor::has_any_health_warning()
{
return std::any_of(
bool prepare_update(MonOpRequestRef op) override;
bool should_propose(double& delay) override;
bool has_health_warnings(std::vector<mds_metric_t> warnings,
- mds_gid_t gid=MDS_GID_NONE);
+ const mds_gid_t& gid=MDS_GID_NONE);
+ bool has_health_warnings(const std::vector<mds_metric_t>& warnings,
+ const std::vector<mds_gid_t>& gids);
bool has_any_health_warning();
bool should_print_status() const {