From: Rishabh Dave Date: Wed, 8 Nov 2023 15:48:27 +0000 (+0530) Subject: Merge pull request #50212 from rishabh-d-dave/fs-swap-subcmd X-Git-Tag: v19.0.0~123 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=50aab7dadbcbb2e9752f15e99789fcfea17b9279;p=ceph.git Merge pull request #50212 from rishabh-d-dave/fs-swap-subcmd cephfs: add command "ceph fs swap" Reviewed-by: Venky Shankar Reviewed-by: Patrick Donnelly --- 50aab7dadbcbb2e9752f15e99789fcfea17b9279 diff --cc src/mon/FSCommands.cc index 822080426fc,300c025486a..2faba87f73d --- a/src/mon/FSCommands.cc +++ b/src/mon/FSCommands.cc @@@ -1234,31 -1233,14 +1233,30 @@@ class RenameFilesystemHandler : public mon->osdmon()->wait_for_writeable(op, new PaxosService::C_RetryMessage(mon->mdsmon(), op)); return -EAGAIN; } + + // Check that no MDS daemons is up for this CephFS. + if (fsp->get_mds_map().get_num_up_mds() > 0) { + ss << "CephFS '" << fs_name << "' is not offline. Before renaming " + << "a CephFS, it must be marked as down. See `ceph fs fail`."; + return -EPERM; + } + + // Check that refuse_client_session is set. + if (!fsp->get_mds_map().test_flag(CEPH_MDSMAP_REFUSE_CLIENT_SESSION)) { + ss << "CephFS '" << fs_name << "' doesn't refuse clients. Before " + << "renaming a CephFS, flag 'refuse_client_session' must be set. " + << "See `ceph fs set`."; + return -EPERM; + } + for (const auto p : fsp->get_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(fsp->get_mds_map().get_metadata_pool(), - pg_pool_t::APPLICATION_NAME_CEPHFS, - "metadata", new_fs_name, true); + mon->osdmon()->do_application_enable( + fsp->get_mds_map().get_metadata_pool(), APP_NAME_CEPHFS, "metadata", + new_fs_name, true); mon->osdmon()->propose_pending(); auto f = [new_fs_name](auto&& fs) {