]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
MDSMonitor: promote standby after fs creation 21810/head
authorPatrick Donnelly <pdonnell@redhat.com>
Fri, 4 May 2018 17:11:10 +0000 (10:11 -0700)
committerPatrick Donnelly <pdonnell@redhat.com>
Fri, 4 May 2018 18:01:09 +0000 (11:01 -0700)
This avoids unnecessary health warnings. However, the original issue in i23885
still exists because the standbys are not available at fs creation time. If you
create a new file system after these standbys are available, then you will
observe that the promotion works to silence the warnings.

Fixes: http://tracker.ceph.com/issues/23885
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mds/FSMap.cc
src/mds/FSMap.h
src/mon/FSCommands.cc
src/vstart.sh

index f4f539962d04365804888101d25ee40f89833798..10ef3fae65f47e3a6b53fb40508d1689ad68c23a 100644 (file)
@@ -226,9 +226,8 @@ void FSMap::print_summary(Formatter *f, ostream *out) const
 }
 
 
-void FSMap::create_filesystem(std::string_view name,
-                              int64_t metadata_pool, int64_t data_pool,
-                              uint64_t features)
+std::shared_ptr<Filesystem> FSMap::create_filesystem(std::string_view name,
+    int64_t metadata_pool, int64_t data_pool, uint64_t features)
 {
   auto fs = std::make_shared<Filesystem>();
   fs->mds_map.epoch = epoch;
@@ -258,6 +257,8 @@ void FSMap::create_filesystem(std::string_view name,
   if (filesystems.size() == 1) {
     legacy_client_fscid = fs->fscid;
   }
+
+  return fs;
 }
 
 void FSMap::reset_filesystem(fs_cluster_id_t fscid)
index bf28546160115c57ee9af8c89c11014fc9ab9016..6450edecf1f108e9562a7c6b330804fd6b97b66e 100644 (file)
@@ -306,9 +306,9 @@ public:
    * Caller must already have validated all arguments vs. the existing
    * FSMap and OSDMap contents.
    */
-  void create_filesystem(std::string_view name,
-                         int64_t metadata_pool, int64_t data_pool,
-                         uint64_t features);
+  std::shared_ptr<Filesystem> create_filesystem(
+      std::string_view name, int64_t metadata_pool,
+      int64_t data_pool, uint64_t features);
 
   /**
    * Remove the filesystem (it must exist).  Caller should already
index 609388a309c933b57b29dde294886e82e6144059..6a8d9ab15954cd343a5586d922050edb2c622ea3 100644 (file)
@@ -202,9 +202,23 @@ class FsNewHandler : public FileSystemCommandHandler
     mon->osdmon()->propose_pending();
 
     // All checks passed, go ahead and create.
-    fsmap.create_filesystem(fs_name, metadata, data,
-                            mon->get_quorum_con_features());
+    auto fs = fsmap.create_filesystem(fs_name, metadata, data,
+        mon->get_quorum_con_features());
+
     ss << "new fs with metadata pool " << metadata << " and data pool " << data;
+
+    // assign a standby to rank 0 to avoid health warnings
+    std::string _name;
+    mds_gid_t gid = fsmap.find_replacement_for({fs->fscid, 0}, _name,
+        g_conf->mon_force_standby_active);
+
+    if (gid != MDS_GID_NONE) {
+      const auto &info = fsmap.get_info_gid(gid);
+      mon->clog->info() << info.human_name() << " assigned to filesystem "
+          << fs_name << " as rank 0";
+      fsmap.promote(gid, fs, 0);
+    }
+
     return 0;
   }
 
index ab316efeff04f3c5c0b71b7e9ed5f51dc3d3e4d1..d06cf708f17b1e6c760dfae096ca3fe2d49816f2 100755 (executable)
@@ -771,6 +771,7 @@ EOF
 
     if [ $new -eq 1 ]; then
         if [ "$CEPH_NUM_FS" -gt "0" ] ; then
+            sleep 5 # time for MDS to come up as standby to avoid health warnings on fs creation
             if [ "$CEPH_NUM_FS" -gt "1" ] ; then
                 ceph_adm fs flag set enable_multiple true --yes-i-really-mean-it
             fi