~ubuntu-branches/ubuntu/raring/ceph/raring

« back to all changes in this revision

Viewing changes to src/mon/OSDMonitor.cc

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-06-08 15:54:37 UTC
  • mfrom: (1.1.8) (0.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20120608155437-gy3j9k6wzv7w4gn9
Tags: 0.44.1-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - d/control: Switch from libcryptopp to libnss as libcryptopp
    is not seeded.
  - d/control,d/rules: Move from python-support to dh_python2.
  - d/patches/manpage_updates*.patch: cherry picked upstream manpage
    updates warning about lack of encryption, per MIR review.
  - d/rules,d/control: Drop radosgw since libfcgi is not in main and
    the code may not be suitable for LTS.
  - d/rules,d/control: Drop tcmalloc since google perftools is not
    in main yet.
  - d/rules,d/control: Drop ceph-fuse entirely per MIR review
    recommendation.
* d/patches/fix-radosgw-tests.patch: Cherry picked patch from upstream
  VCS to fixup tests to conditionally use radosgw if enabled.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include "MonitorStore.h"
21
21
 
22
22
#include "crush/CrushWrapper.h"
 
23
#include "crush/CrushTester.h"
23
24
 
24
25
#include "messages/MOSDFailure.h"
25
26
#include "messages/MOSDMap.h"
86
87
  newmap.encode(pending_inc.fullmap);
87
88
}
88
89
 
89
 
bool OSDMonitor::update_from_paxos()
 
90
void OSDMonitor::update_from_paxos()
90
91
{
91
92
  version_t paxosv = paxos->get_version();
92
93
  if (paxosv == osdmap.epoch)
93
 
    return true;
 
94
    return;
94
95
  assert(paxosv >= osdmap.epoch);
95
96
 
96
97
  dout(15) << "update_from_paxos paxos e " << paxosv 
146
147
 
147
148
  share_map_with_random_osd();
148
149
  update_logger();
149
 
 
150
 
  return true;
151
150
}
152
151
 
153
152
void OSDMonitor::on_active()
309
308
 
310
309
  // encode
311
310
  assert(paxos->get_version() + 1 == pending_inc.epoch);
312
 
  pending_inc.encode(bl);
 
311
  ::encode(pending_inc, bl, -1);
313
312
}
314
313
 
315
314
 
1235
1234
  propose_pending();
1236
1235
}
1237
1236
 
1238
 
enum health_status_t OSDMonitor::get_health(std::ostream &ss) const
 
1237
void OSDMonitor::get_health(list<pair<health_status_t,string> >& summary,
 
1238
                            list<pair<health_status_t,string> > *detail) const
1239
1239
{
1240
 
  enum health_status_t ret(HEALTH_OK);
1241
 
 
1242
1240
  int num_osds = osdmap.get_num_osds();
1243
1241
  int num_up_osds = osdmap.get_num_up_osds();
1244
1242
  int num_in_osds = osdmap.get_num_in_osds();
1245
1243
 
1246
1244
  if (num_osds == 0) {
1247
 
    ss << "no osds";
1248
 
    ret = HEALTH_ERR;
 
1245
    summary.push_back(make_pair(HEALTH_ERR, "no osds"));
1249
1246
  } else {
1250
1247
    if (num_up_osds < num_in_osds) {
 
1248
      ostringstream ss;
1251
1249
      ss << (num_in_osds - num_up_osds) << "/" << num_in_osds << " in osds are down";
1252
 
      ret = HEALTH_WARN;
 
1250
      summary.push_back(make_pair(HEALTH_WARN, ss.str()));
 
1251
 
 
1252
      if (detail) {
 
1253
        for (int i = 0; i < osdmap.get_max_osd(); i++) {
 
1254
          if (osdmap.exists(i) && !osdmap.is_up(i)) {
 
1255
            const osd_info_t& info = osdmap.get_info(i);
 
1256
            ostringstream ss;
 
1257
            ss << "osd." << i << " is down since epoch " << info.down_at
 
1258
               << ", last address " << osdmap.get_addr(i);
 
1259
            detail->push_back(make_pair(HEALTH_WARN, ss.str()));
 
1260
          }
 
1261
        }
 
1262
      }
1253
1263
    }
1254
1264
  }
1255
 
  return ret;
1256
1265
}
1257
1266
 
1258
1267
bool OSDMonitor::preprocess_command(MMonCommand *m)
1526
1535
        goto out;
1527
1536
      }
1528
1537
 
 
1538
      // sanity check: test some inputs to make sure this map isn't totally broken
 
1539
      dout(10) << " testing map" << dendl;
 
1540
      stringstream ess;
 
1541
      CrushTester tester(crush, ess, 1);
 
1542
      tester.test();
 
1543
      dout(10) << " result " << ess.str() << dendl;
 
1544
 
1529
1545
      pending_inc.crush = data;
1530
1546
      string rs = "set crush map";
1531
1547
      paxos->wait_for_commit(new Monitor::C_Command(mon, m, 0, rs, paxos->get_version()));
1687
1703
          ss << "osd." << osd << " does not exist";
1688
1704
        } else if (osdmap.is_down(osd)) {
1689
1705
          ss << "osd." << osd << " is already down";
 
1706
          err = 0;
1690
1707
        } else {
1691
1708
          pending_inc.new_state[osd] = CEPH_OSD_UP;
1692
1709
          if (any)
1710
1727
          ss << "osd." << osd << " does not exist";
1711
1728
        } else if (osdmap.is_out(osd)) {
1712
1729
          ss << "osd." << osd << " is already out";
 
1730
          err = 0;
1713
1731
        } else {
1714
1732
          pending_inc.new_weight[osd] = CEPH_OSD_OUT;
1715
1733
          if (any)
1731
1749
        long osd = strtol(m->cmd[j].c_str(), 0, 10);
1732
1750
        if (osdmap.is_in(osd)) {
1733
1751
          ss << "osd." << osd << " is already in";
 
1752
          err = 0;
1734
1753
        } else if (!osdmap.exists(osd)) {
1735
1754
          ss << "osd." << osd << " does not exist";
1736
1755
        } else {
2031
2050
              paxos->wait_for_commit(new Monitor::C_Command(mon, m, 0, rs, paxos->get_version()));
2032
2051
              return true;
2033
2052
            } else if (m->cmd[4] == "pg_num") {
 
2053
              if (true) {
 
2054
                // ** DISABLE THIS FOR NOW **
 
2055
                ss << "pg_num adjustment currently disabled (broken implementation)";
 
2056
                // ** DISABLE THIS FOR NOW **
 
2057
              } else
2034
2058
              if (n <= p->get_pg_num()) {
2035
2059
                ss << "specified pg_num " << n << " <= current " << p->get_pg_num();
2036
2060
              } else if (!mon->pgmon()->pg_map.creating_pgs.empty()) {