]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: remove 'osd thrash' command
authorSage Weil <sage@redhat.com>
Fri, 9 Dec 2016 02:06:37 +0000 (20:06 -0600)
committerSage Weil <sage@redhat.com>
Mon, 19 Dec 2016 04:11:56 +0000 (23:11 -0500)
This is a dev hack to generate a bunch of bogus osdmaps.  The maps are
all screwed up anyway (e.g., invalid addrs) and this is minimally useful.

Signed-off-by: Sage Weil <sage@redhat.com>
doc/man/8/ceph.rst
qa/workunits/cephtool/test.sh
src/mon/MonCommands.h
src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h
src/test/pybind/test_ceph_argparse.py

index 53915c81ff9622af3f151617aa751cf06932a59c..1e3be526a9304f34acba0c91452f2ad3c2cf9a2f 100644 (file)
@@ -963,12 +963,6 @@ Usage::
 
        ceph osd stat
 
-Subcommand ``thrash`` thrashes OSDs for <num_epochs>.
-
-Usage::
-
-       ceph osd thrash <int[0-]>
-
 Subcommand ``tier`` is used for managing tiers. It uses some additional
 subcommands.
 
index 60fd51e30ee046c673faffe1fc1ad849c2e8d955..cdea16609711f262e3d74f4f48bde4f00411e00c 100755 (executable)
@@ -1127,8 +1127,6 @@ function test_mon_osd()
   done
   ceph osd dump | grep 'osd.0 up'
 
-  ceph osd thrash 0
-
   ceph osd dump | grep 'osd.0 up'
   # ceph osd find expects the OsdName, so both ints and osd.n should work.
   ceph osd find 1
index 5fa2079eed8c6ca7c1de8b1d7267dada07a8ae23..de9c8def8edc3627108f9eb68c640f1515795902 100644 (file)
@@ -790,9 +790,6 @@ COMMAND("osd test-reweight-by-pg " \
        "name=pools,type=CephPoolname,n=N,req=false",                   \
        "dry run of reweight OSDs by PG distribution [overload-percentage-for-consideration, default 120]", \
        "osd", "rw", "cli,rest")
-COMMAND("osd thrash " \
-       "name=num_epochs,type=CephInt,range=0", \
-       "thrash OSDs for <num_epochs>", "osd", "rw", "cli,rest")
 COMMAND("osd df " \
        "name=output_method,type=CephChoices,strings=plain|tree,req=false", \
        "show OSD utilization", "osd", "r", "cli,rest")
index 861cb6b6060e7474db2c5d4787f094335aa6803f..ee87f14e78b9c41e9833207fd6fea976f343ed56 100644 (file)
@@ -80,7 +80,6 @@ OSDMonitor::OSDMonitor(CephContext *cct, Monitor *mn, Paxos *p, const string& se
    cct(cct),
    inc_osd_cache(g_conf->mon_osd_cache_size),
    full_osd_cache(g_conf->mon_osd_cache_size),
-   thrash_map(0), thrash_last_up_osd(-1),
    op_tracker(cct, true, 1)
 {}
 
@@ -346,116 +345,10 @@ void OSDMonitor::update_msgr_features()
   }
 }
 
-bool OSDMonitor::thrash()
-{
-  if (!thrash_map)
-    return false;
-
-  thrash_map--;
-  int o;
-
-  int osd_num = osdmap.get_num_osds();
-  if (osd_num == 0)
-    return false;
-
-  // mark a random osd up_thru..
-  if (rand() % 4 == 0 || thrash_last_up_osd < 0)
-    o = rand() % osd_num;
-  else
-    o = thrash_last_up_osd;
-  if (osdmap.is_up(o)) {
-    dout(5) << "thrash_map osd." << o << " up_thru" << dendl;
-    pending_inc.new_up_thru[o] = osdmap.get_epoch();
-  }
-
-  // mark a random osd up/down
-  o = rand() % osd_num;
-  if (osdmap.is_up(o)) {
-    dout(5) << "thrash_map osd." << o << " down" << dendl;
-    pending_inc.new_state[o] = CEPH_OSD_UP;
-  } else if (osdmap.exists(o)) {
-    dout(5) << "thrash_map osd." << o << " up" << dendl;
-    pending_inc.new_state[o] = CEPH_OSD_UP;
-    pending_inc.new_up_client[o] = entity_addr_t();
-    pending_inc.new_up_cluster[o] = entity_addr_t();
-    pending_inc.new_hb_back_up[o] = entity_addr_t();
-    pending_inc.new_weight[o] = CEPH_OSD_IN;
-    thrash_last_up_osd = o;
-  }
-
-  // mark a random osd in
-  o = rand() % osd_num;
-  if (osdmap.exists(o)) {
-    dout(5) << "thrash_map osd." << o << " in" << dendl;
-    pending_inc.new_weight[o] = CEPH_OSD_IN;
-  }
-
-  // mark a random osd out
-  o = rand() % osd_num;
-  if (osdmap.exists(o)) {
-    dout(5) << "thrash_map osd." << o << " out" << dendl;
-    pending_inc.new_weight[o] = CEPH_OSD_OUT;
-  }
-
-  // generate some pg_temp entries.
-  // let's assume the ceph::unordered_map iterates in a random-ish order.
-  int pg_num = mon->pgmon()->pg_map.pg_stat.size();
-  if (pg_num == 0)
-    return true;
-  int n = rand() % pg_num;
-  ceph::unordered_map<pg_t,pg_stat_t>::iterator p = mon->pgmon()->pg_map.pg_stat.begin();
-  ceph::unordered_map<pg_t,pg_stat_t>::iterator e = mon->pgmon()->pg_map.pg_stat.end();
-  while (n--)
-    ++p;
-
-  for (int i = std::min(pg_num, 50); i > 0; i--) {
-    unsigned size = osdmap.get_pg_size(p->first);
-    vector<int> v;
-    bool have_real_osd = false;
-    for (int j=0; j < (int)size; j++) {
-      o = rand() % osd_num;
-      if (osdmap.exists(o) && std::find(v.begin(), v.end(), o) == v.end()) {
-       have_real_osd = true;
-       v.push_back(o);
-      }
-    }
-    for (vector<int>::iterator q = p->second.acting.begin();
-        q != p->second.acting.end() && v.size() < size;
-        ++q) {
-      if (std::find(v.begin(), v.end(), *q) == v.end()) {
-       if (*q != CRUSH_ITEM_NONE)
-         have_real_osd = true;
-       v.push_back(*q);
-      }
-    }
-    if (osdmap.pg_is_ec(p->first)) {
-      while (v.size() < size)
-       v.push_back(CRUSH_ITEM_NONE);
-    }
-    if (!v.empty() && have_real_osd)
-      pending_inc.new_pg_temp[p->first] = v;
-    dout(5) << "thrash_map pg " << p->first << " pg_temp remapped to " << v << dendl;
-
-    ++p;
-    if (p == e)
-      p = mon->pgmon()->pg_map.pg_stat.begin();
-  }
-  return true;
-}
-
 void OSDMonitor::on_active()
 {
   update_logger();
 
-  if (thrash_map) {
-    if (mon->is_leader()) {
-      if (thrash())
-       propose_pending();
-    } else {
-      thrash_map = 0;
-    }
-  }
-
   if (mon->is_leader())
     mon->clog->info() << "osdmap " << osdmap << "\n";
 
@@ -7946,16 +7839,6 @@ done:
        new Monitor::C_Command(mon, op, 0, rs, rdata, get_last_committed() + 1));
       return true;
     }
-  } else if (prefix == "osd thrash") {
-    int64_t num_epochs;
-    cmd_getval(g_ceph_context, cmdmap, "num_epochs", num_epochs, int64_t(0));
-    // thrash_map is a member var
-    thrash_map = num_epochs;
-    ss << "will thrash map for " << thrash_map << " epochs";
-    ret = thrash();
-    err = 0;
-    if (ret)
-      goto update;
   } else {
     err = -EINVAL;
   }
index 103806175242a81c0948a2e4920fc552c6755820..17e504f4ee2717d644cac822c6ce2d2b40b6b974 100644 (file)
@@ -131,11 +131,6 @@ private:
   bool check_failure(utime_t now, int target_osd, failure_info_t& fi);
   void force_failure(utime_t now, int target_osd);
 
-  // map thrashing
-  int thrash_map;
-  int thrash_last_up_osd;
-  bool thrash();
-
   bool _have_pending_crush();
   CrushWrapper &_get_stable_crush();
   void _get_pending_crush(CrushWrapper& newcrush);
index c34e0ea3acd384d897396e67d6213cb084841536..f3bd7ee56334ea2043bad8847b361edcee790551 100755 (executable)
@@ -1121,9 +1121,6 @@ class TestOSD(TestArgparse):
                                                     '100',
                                                     'toomany']))
 
-    def test_thrash(self):
-        self.check_1_natural_arg('osd', 'thrash')
-
     def test_tier_op(self):
         for op in ('add', 'remove', 'set-overlay'):
             self.assert_valid_command(['osd', 'tier', op,