]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
Merge pull request #50212 from rishabh-d-dave/fs-swap-subcmd
authorRishabh Dave <ridave@redhat.com>
Wed, 8 Nov 2023 15:48:27 +0000 (21:18 +0530)
committerGitHub <noreply@github.com>
Wed, 8 Nov 2023 15:48:27 +0000 (21:18 +0530)
cephfs: add command "ceph fs swap"

Reviewed-by: Venky Shankar <vshankar@redhat.com>
Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
1  2 
src/mon/FSCommands.cc

index 822080426fced255629dd7f4472bbb694b0192c5,300c025486a45c44adc8be9f79c53247838c53d2..2faba87f73de40859d29d9de87f0c3949bfaadb1
@@@ -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) {