]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
MDSMonitor: make enabling multiple FSes a lot scarier
authorGreg Farnum <gfarnum@redhat.com>
Fri, 18 Mar 2016 07:04:35 +0000 (00:04 -0700)
committerGreg Farnum <gfarnum@redhat.com>
Thu, 7 Apr 2016 23:40:22 +0000 (16:40 -0700)
Output a more explicit warning when the user tries to enable multiple FSes, and
mark the FSMap when the user does so anyway.

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/mds/FSMap.cc
src/mds/FSMap.h
src/mon/MDSMonitor.cc
src/mon/MonCommands.h

index bb0accae9bd8ebde6ce027d5a9349575846286c1..46b734cd3758c9f612607e0445562e7c0dceeb6b 100644 (file)
@@ -231,7 +231,7 @@ void FSMap::get_health(list<pair<health_status_t,string> >& summary,
 void FSMap::encode(bufferlist& bl, uint64_t features) const
 {
   if (features & CEPH_FEATURE_SERVER_JEWEL) {
-    ENCODE_START(6, 6, bl);
+    ENCODE_START(7, 6, bl);
     ::encode(epoch, bl);
     ::encode(next_filesystem_id, bl);
     ::encode(legacy_client_fscid, bl);
@@ -245,6 +245,7 @@ void FSMap::encode(bufferlist& bl, uint64_t features) const
     ::encode(mds_roles, bl);
     ::encode(standby_daemons, bl, features);
     ::encode(standby_epochs, bl);
+    ::encode(ever_enabled_multiple, bl);
     ENCODE_FINISH(bl);
   } else {
     if (filesystems.empty()) {
@@ -280,7 +281,7 @@ void FSMap::decode(bufferlist::iterator& p)
   // MDSMonitor to store an FSMap instead of an MDSMap was
   // 5, so anything older than 6 is decoded as an MDSMap,
   // and anything newer is decoded as an FSMap.
-  DECODE_START_LEGACY_COMPAT_LEN_16(6, 4, 4, p);
+  DECODE_START_LEGACY_COMPAT_LEN_16(7, 4, 4, p);
   if (struct_v < 6) {
     // Decoding an MDSMap (upgrade)
     ::decode(epoch, p);
@@ -416,6 +417,7 @@ void FSMap::decode(bufferlist::iterator& p)
     ::decode(mds_roles, p);
     ::decode(standby_daemons, p);
     ::decode(standby_epochs, p);
+    ::decode(ever_enabled_multiple, p);
   }
 
   DECODE_FINISH(p);
index 1f6b069df25f2f983a2450cd779f1ca93d96c5cb..1e00b63d019271f793aabbcfdcba55776544743c 100644 (file)
@@ -95,6 +95,7 @@ protected:
   fs_cluster_id_t legacy_client_fscid;
   CompatSet compat;
   bool enable_multiple;
+  bool ever_enabled_multiple; // < the cluster had multiple MDSes enabled once
 
   std::map<fs_cluster_id_t, std::shared_ptr<Filesystem> > filesystems;
 
@@ -115,7 +116,7 @@ public:
       next_filesystem_id(FS_CLUSTER_ID_ANONYMOUS + 1),
       legacy_client_fscid(FS_CLUSTER_ID_NONE),
       compat(get_mdsmap_compat_set_default()),
-      enable_multiple(false)
+      enable_multiple(false), ever_enabled_multiple(false)
   { }
 
   FSMap(const FSMap &rhs)
@@ -125,6 +126,7 @@ public:
       legacy_client_fscid(rhs.legacy_client_fscid),
       compat(rhs.compat),
       enable_multiple(rhs.enable_multiple),
+      ever_enabled_multiple(rhs.ever_enabled_multiple),
       mds_roles(rhs.mds_roles),
       standby_daemons(rhs.standby_daemons),
       standby_epochs(rhs.standby_epochs)
@@ -159,6 +161,9 @@ public:
   void set_enable_multiple(const bool v)
   {
     enable_multiple = v;
+    if (true == v) {
+      ever_enabled_multiple = true;
+    }
   }
 
   bool get_enable_multiple() const
index c5ed1a2b183aeecc76324d9e120a2763693b304e..7065ca0de7acc65dbf1c35cdf9de8c375d60f56c 100644 (file)
@@ -1508,6 +1508,9 @@ class FlagSetHandler : public FileSystemCommandHandler
     string flag_val;
     cmd_getval(g_ceph_context, cmdmap, "val", flag_val);
 
+    string confirm;
+    cmd_getval(g_ceph_context, cmdmap, "confirm", confirm);
+
     if (flag_name == "enable_multiple") {
       bool flag_bool = false;
       int r = parse_bool(flag_val, &flag_bool, ss);
@@ -1521,7 +1524,12 @@ class FlagSetHandler : public FileSystemCommandHandler
         ss << "Multiple-filesystems are forbidden until all mons are updated";
         return -EINVAL;
       }
-
+      if (confirm != "--yes-i-really-mean-it") {
+       ss << "Multiple filesystems is an EXPERIMENTAL and BARELY-TESTED configuration"
+         " that may break your entire cluster, probably prevent serious"
+         " support, and irrevocably marks your cluster."
+         " Add --yes-i-really-mean-it if you are sure you wish to continue.";
+      }
       fsmap.set_enable_multiple(flag_bool);
       return 0;
     } else {
index c7e923f3285f1b41b683801e64f03f9e9077d4b1..45227f2d4ea3f6d4a777c78197753906792449b1 100644 (file)
@@ -402,7 +402,8 @@ COMMAND("fs set " \
        "name=confirm,type=CephString,req=false",                       \
        "set mds parameter <var> to <val>", "mds", "rw", "cli,rest")
 COMMAND("fs flag set name=flag_name,type=CephChoices,strings=enable_multiple "
-        "name=val,type=CephString", \
+        "name=val,type=CephString " \
+       "name=confirm,type=CephChoices,strings=--yes-i-really-mean-it,req=false", \
        "Set a global CephFS flag", \
        "fs", "rw", "cli,rest")
 COMMAND("fs add_data_pool name=fs_name,type=CephString " \