From: Rishabh Dave Date: Thu, 28 Sep 2023 13:26:22 +0000 (+0530) Subject: mon/FSCommands: use alias for higher brevity X-Git-Tag: testing/wip-pdonnell-testing-20240430.123648-reef-debug~26^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=665c04e075955690e8f2b966e24b8cdeb0169dac;p=ceph-ci.git mon/FSCommands: use alias for higher brevity Create an alias so "APP_NAME_CEPHFS" can be written instead of "pg_pool_t::APPLICATION_NAME_CEPHFS". Signed-off-by: Rishabh Dave (cherry picked from commit 4a12f6eb6c16722f1d68e0949390cd7d30f44bc6) Conflicts: src/mon/FSCommands.cc * Conflict occured because variable in Reef is "fs" and in Main branch is "fsp". --- diff --git a/src/mon/FSCommands.cc b/src/mon/FSCommands.cc index 4e19d4a4658..efac6752467 100644 --- a/src/mon/FSCommands.cc +++ b/src/mon/FSCommands.cc @@ -44,6 +44,8 @@ using ceph::make_message; using ceph::mono_clock; using ceph::mono_time; +static const auto& APP_NAME_CEPHFS = pg_pool_t::APPLICATION_NAME_CEPHFS; + class FlagSetHandler : public FileSystemCommandHandler { public: @@ -268,11 +270,9 @@ class FsNewHandler : public FileSystemCommandHandler mon->osdmon()->wait_for_writeable(op, new PaxosService::C_RetryMessage(mon->mdsmon(), op)); return -EAGAIN; } - mon->osdmon()->do_application_enable(data, - pg_pool_t::APPLICATION_NAME_CEPHFS, - "data", fs_name, true); - mon->osdmon()->do_application_enable(metadata, - pg_pool_t::APPLICATION_NAME_CEPHFS, + mon->osdmon()->do_application_enable(data, APP_NAME_CEPHFS, "data", + fs_name, true); + mon->osdmon()->do_application_enable(metadata, APP_NAME_CEPHFS, "metadata", fs_name, true); mon->osdmon()->do_set_pool_opt(metadata, pool_opts_t::RECOVERY_PRIORITY, @@ -1031,9 +1031,8 @@ class AddDataPoolHandler : public FileSystemCommandHandler mon->osdmon()->wait_for_writeable(op, new PaxosService::C_RetryMessage(mon->mdsmon(), op)); return -EAGAIN; } - mon->osdmon()->do_application_enable(poolid, - pg_pool_t::APPLICATION_NAME_CEPHFS, - "data", fs_name, true); + mon->osdmon()->do_application_enable(poolid, APP_NAME_CEPHFS, "data", + fs_name, true); mon->osdmon()->propose_pending(); fsmap.modify_filesystem( @@ -1266,14 +1265,13 @@ class RenameFilesystemHandler : public FileSystemCommandHandler return -EAGAIN; } for (const auto p : fs->mds_map.get_data_pools()) { - mon->osdmon()->do_application_enable(p, - pg_pool_t::APPLICATION_NAME_CEPHFS, - "data", new_fs_name, true); + mon->osdmon()->do_application_enable(p, APP_NAME_CEPHFS, "data", + new_fs_name, true); } - mon->osdmon()->do_application_enable(fs->mds_map.get_metadata_pool(), - pg_pool_t::APPLICATION_NAME_CEPHFS, - "metadata", new_fs_name, true); + mon->osdmon()->do_application_enable( + fs->mds_map.get_metadata_pool(), APP_NAME_CEPHFS, "metadata", + new_fs_name, true); mon->osdmon()->propose_pending(); auto f = [new_fs_name](auto fs) { @@ -1448,22 +1446,20 @@ class SwapFilesystemHandler : public FileSystemCommandHandler // Finally, the swap begins. // Swap CephFS names on OSD pool application tag for (const auto p : fs1p->get_mds_map().get_data_pools()) { - mon->osdmon()->do_application_enable(p, - pg_pool_t::APPLICATION_NAME_CEPHFS, - "data", fs2_name, true); + mon->osdmon()->do_application_enable(p, APP_NAME_CEPHFS, "data", + fs2_name, true); } - mon->osdmon()->do_application_enable(fs1p->get_mds_map().get_metadata_pool(), - pg_pool_t::APPLICATION_NAME_CEPHFS, - "metadata", fs2_name, true); + mon->osdmon()->do_application_enable( + fs1p->get_mds_map().get_metadata_pool(), APP_NAME_CEPHFS, "metadata", + fs2_name, true); for (const auto p : fs2p->get_mds_map().get_data_pools()) { - mon->osdmon()->do_application_enable(p, - pg_pool_t::APPLICATION_NAME_CEPHFS, - "data", fs1_name, true); + mon->osdmon()->do_application_enable(p, APP_NAME_CEPHFS, "data", + fs1_name, true); } - mon->osdmon()->do_application_enable(fs2p->get_mds_map().get_metadata_pool(), - pg_pool_t::APPLICATION_NAME_CEPHFS, - "metadata", fs1_name, true); + mon->osdmon()->do_application_enable( + fs2p->get_mds_map().get_metadata_pool(), APP_NAME_CEPHFS, "metadata", + fs1_name, true); mon->osdmon()->propose_pending(); // Now swap CephFS names and, optionally, FSCIDs. @@ -1847,7 +1843,7 @@ int FileSystemCommandHandler::_check_pool( auto app_map = pool->application_metadata; if (!allow_overlay && !force && !app_map.empty()) { - auto app = app_map.find(pg_pool_t::APPLICATION_NAME_CEPHFS); + auto app = app_map.find(APP_NAME_CEPHFS); if (app != app_map.end()) { auto& [app_name, app_metadata] = *app; auto itr = app_metadata.find("data"); @@ -1913,8 +1909,7 @@ int FileSystemCommandHandler::_check_pool( } if (!force && !pool->application_metadata.empty() && - pool->application_metadata.count( - pg_pool_t::APPLICATION_NAME_CEPHFS) == 0) { + pool->application_metadata.count(APP_NAME_CEPHFS) == 0) { *ss << " pool '" << pool_name << "' (id '" << pool_id << "') has a non-CephFS application enabled."; return -EINVAL;