]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: add "--check" to CrushTester::test_with_crushtool() 4936/head
authorKefu Chai <kchai@redhat.com>
Tue, 26 May 2015 10:11:59 +0000 (18:11 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 10 Jul 2015 07:40:02 +0000 (15:40 +0800)
so we don't need to call CrushTester::check_name_maps() in OSDMonitor.cc
anymore.

Fixes: #11680
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit c6e634875316cf17368d497e6dc4f6f4b5dd65d2)

src/crush/CrushTester.cc
src/crush/CrushTester.h
src/mon/OSDMonitor.cc

index 2b60c22d40914e39a7bf5c6fc841c62fac1f9e5d..04c5be1de1617523bc691fdb3e8f90b1d86be116 100644 (file)
@@ -358,9 +358,11 @@ void CrushTester::write_integer_indexed_scalar_data_string(vector<string> &dst,
 }
 
 int CrushTester::test_with_crushtool(const string& crushtool,
+                                     int max_id,
                                      int timeout)
 {
   string timeout_string = stringify(timeout);
+  string opt_max_id = stringify(max_id);
   vector<const char *> cmd_args;
   cmd_args.push_back("timeout");
   cmd_args.push_back(timeout_string.c_str());
@@ -368,6 +370,8 @@ int CrushTester::test_with_crushtool(const string& crushtool,
   cmd_args.push_back("-i");
   cmd_args.push_back("-");
   cmd_args.push_back("--test");
+  cmd_args.push_back("--check");
+  cmd_args.push_back(opt_max_id.c_str());
   cmd_args.push_back(NULL);
 
   int pipefds[2];
index 22424757f6ed645d70ece0b1c7a4b998146db2b7..4f90aae940bc3ba798cdce244bbe294e44668b52 100644 (file)
@@ -343,7 +343,8 @@ public:
   bool check_name_maps(unsigned max_id = 0) const;
   int test();
   int test_with_crushtool(const string& crushtool,
-                         int timeout);
+                         int max_id = -1,
+                         int timeout = 0);
 };
 
 #endif
index 5ca2a9b182258538692da85e80320ba1dde8c6bb..b249f10214b80c589f94f2dc4fbf09840cabf864 100644 (file)
@@ -4530,12 +4530,8 @@ bool OSDMonitor::prepare_command_impl(MMonCommand *m,
     // then we would consistently trigger an election before the command
     // finishes, having a flapping monitor unable to hold quorum.
     CrushTester tester(crush, ess);
-    if (!tester.check_name_maps(osdmap.get_max_osd())) {
-      err = -EINVAL;
-      ss << ess.str();
-      goto reply;
-    }
     int r = tester.test_with_crushtool(g_conf->crushtool,
+                                      osdmap.get_max_osd(),
                                       g_conf->mon_lease);
     if (r < 0) {
       if (r == -EINTR) {