| 368 | {} |
| 369 | |
| 370 | int handle( |
| 371 | Monitor *mon, |
| 372 | FSMap& fsmap, |
| 373 | MonOpRequestRef op, |
| 374 | const cmdmap_t& cmdmap, |
| 375 | ostream &ss) override |
| 376 | { |
| 377 | string fs_name; |
| 378 | if (!cmd_getval(cmdmap, "fs_name", fs_name) || fs_name.empty()) { |
| 379 | ss << "Missing filesystem name"; |
| 380 | return -EINVAL; |
| 381 | } |
| 382 | |
| 383 | auto* fsp = fsmap.get_filesystem(fs_name); |
| 384 | string var; |
| 385 | if (!cmd_getval(cmdmap, "var", var) || var.empty()) { |
| 386 | ss << "Invalid variable"; |
| 387 | return -EINVAL; |
| 388 | } |
| 389 | string val; |
| 390 | if (!cmd_getval(cmdmap, "val", val)) { |
| 391 | return -EINVAL; |
| 392 | } |
| 393 | |
| 394 | bool confirm = false; |
| 395 | cmd_getval(cmdmap, "yes_i_really_mean_it", confirm); |
| 396 | if (var == "max_mds" && !confirm && mon->mdsmon()->has_any_health_warning()) { |
| 397 | ss << "One or more file system health warnings are present. Modifying " |
| 398 | << "the file system setting variable \"max_mds\" may not help " |
| 399 | << "troubleshoot or recover from these warnings and may further " |
| 400 | << "destabilize the system. If you really wish to proceed, run " |
| 401 | << "again with --yes-i-really-mean-it"; |
| 402 | return -EPERM; |
| 403 | } |
| 404 | |
| 405 | return set_val(mon, fsmap, op, cmdmap, ss, fsp->get_fscid(), var, val); |
| 406 | } |
| 407 | }; |
| 408 | |
| 409 | static void modify_filesystem(FSMap& fsmap, auto&& fsv, auto&& fn) |
no test coverage detected