diff options
author | Sage Weil <sage@inktank.com> | 2013-06-20 12:30:54 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-06-20 12:30:54 -0700 |
commit | 4bf5b732cd8869276e87d4bbc4f261ee9e0c6a4c (patch) | |
tree | 30667dd59e3aacef3c0c1f66d479e4e2b2bdcc18 | |
parent | 714f2128bd449055ad03d850d3db03a2748e3b4a (diff) | |
parent | ebb46c452eeca4102148becc543b1da83ea3e7a9 (diff) | |
download | ceph-4bf5b732cd8869276e87d4bbc4f261ee9e0c6a4c.tar.gz |
Merge remote-tracking branch 'gh/next'
-rwxr-xr-x | qa/workunits/cephtool/test.sh | 42 | ||||
-rw-r--r-- | src/mon/LogMonitor.cc | 39 | ||||
-rw-r--r-- | src/mon/MDSMonitor.cc | 4 | ||||
-rw-r--r-- | src/mon/MonCommands.h | 1 | ||||
-rw-r--r-- | src/mon/Monitor.cc | 26 |
5 files changed, 63 insertions, 49 deletions
diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index 955a74bac58..bb096a99046 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -50,7 +50,6 @@ ceph auth del client.xx # with and without verbosity ceph osd dump | grep '^epoch' ceph --concise osd dump | grep '^epoch' -ceph --verbose osd dump | grep '^epoch' # df ceph df | grep GLOBAL @@ -66,10 +65,6 @@ ceph health detail ceph health --format json-pretty ceph health detail --format xml-pretty -ceph injectargs -- --debug_ms=1 -ceph injectargs -- --debug-ms=1 -expect_false ceph injectargs -- debug_ms=1 - ceph -w > /tmp/$$ & wpid="$!" mymsg="this is a test log message $$.$(date)" @@ -82,21 +77,20 @@ if ! grep "$mymsg" /tmp/$$; then fi kill $wpid -ceph mds cluster_down 2>&1 | grep "marked mdsmap DOWN" +ceph mds cluster_down --no-log-to-stderr 2>&1 | grep "marked mdsmap DOWN" expect_false ceph mds cluster_down -ceph mds cluster_up 2>&1 | grep "unmarked mdsmap DOWN" +ceph mds cluster_up --no-log-to-stderr 2>&1 | grep "unmarked mdsmap DOWN" expect_false ceph mds cluster_up -# XXX is this a reasonable test? -ceph mds compat rm_incompat 5 -expect_false ceph mds rm_compat 5 +ceph mds compat rm_incompat 4 +ceph mds compat rm_incompat 4 ceph mds compat show expect_false ceph mds deactivate 2 ceph mds dump # XXX mds fail, but how do you undo it? mdsmapfile=/tmp/mdsmap.$$ -current_epoch=$(ceph mds getmap -o $mdsmapfile 2>&1 | sed 's/.*epoch //') +current_epoch=$(ceph mds getmap -o $mdsmapfile --no-log-to-stderr 2>&1 | grep epoch | sed 's/.*epoch //') [ -s $mdsmapfile ] ((epoch = current_epoch + 1)) ceph mds setmap -i $mdsmapfile $epoch @@ -116,7 +110,6 @@ ceph mds stat # ceph mds rmfailed # ceph mds set_state # ceph mds stop -# ceph mds tell # no mon add/remove ceph mon dump @@ -135,8 +128,10 @@ ceph osd crush tunables legacy ceph osd crush tunables bobtail # how do I tell when these are done? -#ceph osd scrub 0 -#ceph osd deep-scrub 0 +ceph osd scrub 0 +ceph osd deep-scrub 0 +ceph osd repair 0 + ceph osd set noup ceph osd down 0 ceph osd dump | grep 'osd.0 down' @@ -170,7 +165,9 @@ ceph osd getmaxosd | grep 'max_osd = 10' ceph osd setmaxosd $save ceph osd getmaxosd | grep "max_osd = $save" -#XXX ceph osd lost - this is bad, right? +id=`ceph osd create` +ceph osd lost $id --yes-i-really-mean-it +ceph osd rm $id ceph osd ls ceph osd lspools | grep data ceph osd map data foo | grep 'pool.*data.*object.*foo.*pg.*up.*acting' @@ -190,12 +187,11 @@ ceph osd pool rename data2 data3 ceph osd lspools | grep data3 ceph osd pool delete data3 data3 --yes-i-really-really-mean-it -# XXX ceph osd repair ceph osd stat | grep up, -# XXX ceph osd tell -# XXX does this leave osds out/down? -# ceph osd thrash 10 +for id in `ceph osd ls` ; do + ceph tell osd.$id version +done ceph pg debug unfound_objects_exist @@ -207,13 +203,14 @@ ceph pg dump_pools_json ceph pg dump_stuck inactive ceph pg dump_stuck unclean ceph pg dump_stuck stale -# XXX can I test this? +# can't test this... # ceph pg force_create_pg ceph pg getmap -o /tmp/map [ -s /tmp/map ] ceph pg map 0.0 | grep acting ceph pg repair 0.0 ceph pg scrub 0.0 + ceph pg send_pg_creates ceph pg set_full_ratio 0.90 ceph pg dump --format=plain | grep '^full_ratio 0.9' @@ -227,7 +224,6 @@ ceph quorum_status ceph report | grep osd_stats ceph status ceph -s -# ceph stop_cluster # ceph sync force ceph sync status | grep paxos_version @@ -252,8 +248,6 @@ ceph osd pool set data size 2 ceph osd pool get rbd crush_ruleset | grep 'crush_ruleset: 2' -for id in `ceph osd ls` ; do - ceph tell osd.$id version -done +ceph osd thrash 10 echo OK diff --git a/src/mon/LogMonitor.cc b/src/mon/LogMonitor.cc index 91ca497a744..19ad622bb40 100644 --- a/src/mon/LogMonitor.cc +++ b/src/mon/LogMonitor.cc @@ -301,7 +301,6 @@ bool LogMonitor::prepare_log(MLog *m) if (!pending_summary.contains(p->key())) { pending_summary.add(*p); pending_log.insert(pair<utime_t,LogEntry>(p->stamp, *p)); - } } wait_for_finished_proposal(new C_Log(this, m)); @@ -350,8 +349,42 @@ bool LogMonitor::prepare_command(MMonCommand *m) string rs; int err = -EINVAL; - // nothing here yet - ss << "unrecognized command"; + map<string, cmd_vartype> cmdmap; + if (!cmdmap_from_json(m->cmd, &cmdmap, ss)) { + // ss has reason for failure + string rs = ss.str(); + mon->reply_command(m, -EINVAL, rs, get_version()); + return true; + } + + string prefix; + cmd_getval(g_ceph_context, cmdmap, "prefix", prefix); + + MonSession *session = m->get_session(); + if (!session || + (!session->is_capable("log", MON_CAP_W) && + !mon->_allowed_command(session, cmdmap))) { + mon->reply_command(m, -EACCES, "access denied", get_version()); + return true; + } + + if (prefix == "log") { + vector<string> logtext; + cmd_getval(g_ceph_context, cmdmap, "logtext", logtext); + ostringstream ds; + std::copy(logtext.begin(), logtext.end(), + ostream_iterator<string>(ds, " ")); + LogEntry le; + le.who = m->get_orig_source_inst(); + le.stamp = m->get_recv_stamp(); + le.seq = 0; + le.type = CLOG_INFO; + le.msg = ds.str(); + pending_summary.add(le); + pending_log.insert(pair<utime_t,LogEntry>(le.stamp, le)); + wait_for_finished_proposal(new Monitor::C_Command(mon, m, 0, string(), get_version())); + return true; + } getline(ss, rs); mon->reply_command(m, err, rs, get_version()); diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 5f4582fdce3..757014257d6 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -942,7 +942,7 @@ bool MDSMonitor::prepare_command(MMonCommand *m) r = 0; } else { ss << "compat feature " << f << " not present in " << pending_mdsmap.compat; - r = -ENOENT; + r = 0; } } else if (prefix == "mds compat rm_incompat") { int64_t f; @@ -953,7 +953,7 @@ bool MDSMonitor::prepare_command(MMonCommand *m) r = 0; } else { ss << "incompat feature " << f << " not present in " << pending_mdsmap.compat; - r = -ENOENT; + r = 0; } } else if (prefix == "mds add_data_pool") { diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 5e6f9d49198..e1ebf31df6c 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -165,7 +165,6 @@ COMMAND("compact", "cause compaction of monitor's leveldb storage") COMMAND("fsid", "show cluster FSID/UUID") COMMAND("log name=logtext,type=CephString,n=N", \ "log supplied text to the monitor log") -COMMAND("stop_cluster", "DEPRECATED") COMMAND("injectargs " \ "name=injected_args,type=CephString,n=N", \ "inject config arguments into monitor") diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index b74e821b780..cf36a09a5cb 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -1309,18 +1309,18 @@ void Monitor::sync_send_chunks(SyncEntity sync) void Monitor::sync_requester_abort() { - dout(10) << __func__; + dout(10) << __func__ << dendl; assert(state == STATE_SYNCHRONIZING); assert(sync_role == SYNC_ROLE_REQUESTER); if (sync_leader.get() != NULL) { - *_dout << " " << sync_leader->entity; + dout(10) << __func__ << " leader " << sync_leader->entity << dendl; sync_leader->cancel_timeout(); sync_leader.reset(); } if (sync_provider.get() != NULL) { - *_dout << " " << sync_provider->entity; + dout(10) << __func__ << " provider " << sync_provider->entity << dendl; sync_provider->cancel_timeout(); MMonSync *msg = new MMonSync(MMonSync::OP_ABORT); @@ -1328,7 +1328,6 @@ void Monitor::sync_requester_abort() sync_provider.reset(); } - *_dout << " clearing potentially inconsistent store" << dendl; // Given that we are explicitely aborting the whole sync process, we should // play it safe and clear the store. @@ -2636,6 +2635,10 @@ void Monitor::handle_command(MMonCommand *m) authmon()->dispatch(m); return; } + if (module == "log") { + logmon()->dispatch(m); + return; + } if (module == "config-key") { if (!access_all) { @@ -2653,21 +2656,6 @@ void Monitor::handle_command(MMonCommand *m) reply_command(m, 0, "", rdata, 0); return; } - if (prefix == "log") { - if (!access_r) { - r = -EACCES; - rs = "access denied"; - goto out; - } - vector<string> logtext; - cmd_getval(g_ceph_context, cmdmap, "logtext", logtext); - std::copy(logtext.begin(), logtext.end(), - ostream_iterator<string>(ds, " ")); - clog.info(ds); - rs = "ok"; - reply_command(m, 0, rs, 0); - return; - } if (prefix == "compact") { if (!access_all) { |