Merge pull request #53722 from rishabh-d-dave/mon-authmon

mon/AuthMonitor: clean up AuthMonitor

Reviewed-by: Leonid Usov <leonid.usov@ibm.com>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Kotresh HR <khiremat@redhat.com>
Reviewed-by: Laura Flores <lflores@redhat.com>
This commit is contained in:
Rishabh Dave 2023-10-09 22:53:42 +05:30 committed by GitHub
commit f9626b5969
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,10 +42,6 @@
#define dout_prefix _prefix(_dout, mon, get_last_committed())
using namespace TOPNSPC::common;
using std::cerr;
using std::cout;
using std::dec;
using std::hex;
using std::list;
using std::map;
using std::make_pair;
@ -53,23 +49,16 @@ using std::ostream;
using std::ostringstream;
using std::pair;
using std::set;
using std::setfill;
using std::string;
using std::stringstream;
using std::to_string;
using std::vector;
using std::unique_ptr;
using ceph::bufferlist;
using ceph::decode;
using ceph::encode;
using ceph::Formatter;
using ceph::JSONFormatter;
using ceph::make_message;
using ceph::mono_clock;
using ceph::mono_time;
using ceph::timespan_str;
static ostream& _prefix(std::ostream *_dout, Monitor &mon, version_t v) {
static ostream& _prefix(ostream *_dout, Monitor &mon, version_t v) {
return *_dout << "mon." << mon.name << "@" << mon.rank
<< "(" << mon.get_state_name()
<< ").auth v" << v << " ";
@ -93,7 +82,7 @@ bool AuthMonitor::check_rotate()
}
void AuthMonitor::process_used_pending_keys(
const std::map<EntityName,CryptoKey>& used_pending_keys)
const map<EntityName,CryptoKey>& used_pending_keys)
{
for (auto& [name, used_key] : used_pending_keys) {
dout(10) << __func__ << " used pending_key for " << name << dendl;
@ -1714,7 +1703,7 @@ bool AuthMonitor::prepare_command(MonOpRequestRef op)
err = -EINVAL;
goto done;
} else {
mon_cap_string += " fsname=" + std::string(fs->get_mds_map().get_fs_name());
mon_cap_string += " fsname=" + string(fs->get_mds_map().get_fs_name());
}
}
@ -1756,7 +1745,7 @@ bool AuthMonitor::prepare_command(MonOpRequestRef op)
mds_cap_string += "allow " + cap;
if (filesystem != "*" && filesystem != "all" && fs != nullptr) {
mds_cap_string += " fsname=" + std::string(fs->get_mds_map().get_fs_name());
mds_cap_string += " fsname=" + string(fs->get_mds_map().get_fs_name());
}
if (path != "/") {
@ -2088,7 +2077,7 @@ bool AuthMonitor::_upgrade_format_to_dumpling()
// set daemon profiles
if ((p->first.is_osd() || p->first.is_mds()) &&
mon_caps == "allow rwx") {
new_caps = string("allow profile ") + std::string(p->first.get_type_name());
new_caps = string("allow profile ") + string(p->first.get_type_name());
}
// update bootstrap keys