| 488 | } |
| 489 | |
| 490 | int MgrClient::start_command(vector<string>&& cmd, bufferlist&& inbl, |
| 491 | bufferlist *outbl, string *outs, |
| 492 | Context *onfinish) |
| 493 | { |
| 494 | std::lock_guard l(lock); |
| 495 | |
| 496 | ldout(cct, 20) << "cmd: " << cmd << dendl; |
| 497 | |
| 498 | if (map.epoch == 0 && mgr_optional) { |
| 499 | ldout(cct,20) << " no MgrMap, assuming EACCES" << dendl; |
| 500 | return -EACCES; |
| 501 | } |
| 502 | |
| 503 | auto &op = command_table.start_command(); |
| 504 | op.cmd = std::move(cmd); |
| 505 | op.inbl = std::move(inbl); |
| 506 | op.outbl = outbl; |
| 507 | op.outs = outs; |
| 508 | op.on_finish = onfinish; |
| 509 | |
| 510 | if (session && session->con) { |
| 511 | // Leaving fsid argument null because it isn't used historically, and |
| 512 | // we can use it as a signal that we are sending a non-tell command. |
| 513 | auto m = op.get_message( |
| 514 | {}, |
| 515 | HAVE_FEATURE(map.active_mgr_features, SERVER_OCTOPUS)); |
| 516 | session->con->send_message2(std::move(m)); |
| 517 | } else { |
| 518 | ldout(cct, 5) << "no mgr session (no running mgr daemon?), waiting" << dendl; |
| 519 | } |
| 520 | return 0; |
| 521 | } |
| 522 | |
| 523 | int MgrClient::start_tell_command( |
| 524 | string&& name, |
no test coverage detected