summaryrefslogtreecommitdiffstats
path: root/src/mgr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-23 16:45:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-23 16:45:13 +0000
commit389020e14594e4894e28d1eb9103c210b142509e (patch)
tree2ba734cdd7a243f46dda7c3d0cc88c2293d9699f /src/mgr
parentAdding upstream version 18.2.2. (diff)
downloadceph-upstream.tar.xz
ceph-upstream.zip
Adding upstream version 18.2.3.upstream/18.2.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/mgr')
-rw-r--r--src/mgr/DaemonServer.cc31
-rw-r--r--src/mgr/MgrClient.h1
2 files changed, 32 insertions, 0 deletions
diff --git a/src/mgr/DaemonServer.cc b/src/mgr/DaemonServer.cc
index 0e9e6be2a..5b2457278 100644
--- a/src/mgr/DaemonServer.cc
+++ b/src/mgr/DaemonServer.cc
@@ -1981,6 +1981,37 @@ bool DaemonServer::_handle_command(
cmdctx->reply(-EINVAL, ss);
return true;
}
+ /*
+ * RGW has the daemon name stored in the daemon metadata
+ * and uses the GID as key in the service_map.
+ * We need to match the user's query with the daemon name to
+ * find the correct key for retrieving daemon state.
+ */
+ string daemon_name = key.name;
+ auto p = daemon_name.find("rgw");
+ if (p != daemon_name.npos) {
+ auto rgw_daemons = daemon_state.get_by_service("rgw");
+ for (auto& rgw_daemon : rgw_daemons) {
+ DaemonStatePtr daemon = rgw_daemon.second;
+ string name = daemon->metadata.find("id")->second;
+ /*
+ * The id stored in the metadata is the port number
+ * for the RGW daemon.
+ * In the case of multiple RGW daemons, the user might
+ * use the port number (rgw.8000) to specify the daemon.
+ */
+ auto p = daemon_name.find('.');
+ if (p == key.name.npos) {
+ key = daemon->key;
+ } else {
+ // if user has specified port number in the query
+ if (daemon_name.substr(p + 1) == name) {
+ key = daemon->key;
+ break;
+ }
+ }
+ }
+ }
DaemonStatePtr daemon = daemon_state.get(key);
if (!daemon) {
ss << "no config state for daemon " << who;
diff --git a/src/mgr/MgrClient.h b/src/mgr/MgrClient.h
index a48ae163e..1f9bb397f 100644
--- a/src/mgr/MgrClient.h
+++ b/src/mgr/MgrClient.h
@@ -54,6 +54,7 @@ class MgrCommand : public CommandOp
bool tell = false;
explicit MgrCommand(ceph_tid_t t) : CommandOp(t) {}
+ explicit MgrCommand(ceph_tid_t t, ceph_tid_t multi_id) : CommandOp(t, multi_id) {}
MgrCommand() : CommandOp() {}
};