#include "messages/MCommand.h"
#include "messages/MCommandReply.h"
+#include "messages/MMonCommand.h"
+#include "messages/MMonCommandAck.h"
// re-include our assert to clobber the system one; fix dout:
#include "include/ceph_assert.h"
{
ldout(m_cct,10) << __func__ << dendl;
std::list<ref_t<MCommand>> q;
+ std::list<ref_t<MMonCommand>> lq;
{
std::lock_guard l(tell_lock);
q.swap(tell_queue);
+ lq.swap(tell_legacy_queue);
}
for (auto& m : q) {
bufferlist outbl;
reply->set_data(outbl);
#ifdef WITH_SEASTAR
#warning "fix message send with crimson"
+#else
+ m->get_connection()->send_message(reply);
+#endif
+ });
+ }
+ for (auto& m : lq) {
+ bufferlist outbl;
+ execute_command(
+ m->cmd,
+ m->get_data(),
+ [m](int r, const std::string& err, bufferlist& outbl) {
+ auto reply = new MMonCommandAck(m->cmd, r, err, 0);
+ reply->set_tid(m->get_tid());
+ reply->set_data(outbl);
+#ifdef WITH_SEASTAR
+#warning "fix message send with crimson"
#else
m->get_connection()->send_message(reply);
#endif
tell_queue.push_back(std::move(m));
wakeup();
}
+void AdminSocket::queue_tell_command(ref_t<MMonCommand> m)
+{
+ ldout(m_cct,10) << __func__ << " " << *m << dendl;
+ std::lock_guard l(tell_lock);
+ tell_legacy_queue.push_back(std::move(m));
+ wakeup();
+}
int AdminSocket::register_command(std::string_view cmddesc,
AdminSocketHook *hook,
class AdminSocket;
class CephContext;
class MCommand;
+class MMonCommand;
using namespace std::literals;
bufferlist *outbl);
void queue_tell_command(ref_t<MCommand> m);
+ void queue_tell_command(ref_t<MMonCommand> m); // for compat
private:
std::mutex tell_lock;
std::list<ref_t<MCommand>> tell_queue;
+ std::list<ref_t<MMonCommand>> tell_legacy_queue;
struct hook_info {
AdminSocketHook* hook;
return;
}
+ // compat kludge for legacy clients trying to tell commands that are new
+ if (!HAVE_FEATURE(m->get_connection()->get_features(), SERVER_OCTOPUS) &&
+ (prefix == "injectargs" ||
+ prefix == "smart" ||
+ prefix == "mon_status" ||
+ prefix == "sync_force" ||
+ prefix == "heap")) {
+ dout(5) << __func__ << " passing command to tell/asok" << dendl;
+ cct->get_admin_socket()->queue_tell_command(m);
+ return;
+ }
+
string module;
string err;