From: Kefu Chai Date: Mon, 5 Jul 2021 04:00:24 +0000 (+0800) Subject: common/common_init: set conf->host in common_preinit() X-Git-Tag: v17.1.0~1463^2~3 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=3bee326025234a288d0de1ca2b1280f9da9d99c9;p=ceph.git common/common_init: set conf->host in common_preinit() conf.host is used by graylog for setting the "host" property. and it is used when serving the "get config" command when the command queries the "host", so better off setting it early before flushing the log entries with graylog. Fixes: https://tracker.ceph.com/issues/45457 Signed-off-by: Kefu Chai --- diff --git a/src/common/common_init.cc b/src/common/common_init.cc index 6e6a7ecf8100e..f3ca032613781 100644 --- a/src/common/common_init.cc +++ b/src/common/common_init.cc @@ -19,6 +19,7 @@ #include "common/ceph_context.h" #include "common/config.h" #include "common/dout.h" +#include "common/hostname.h" #include "common/strtol.h" #include "common/valgrind.h" #include "common/zipkin_trace.h" @@ -66,6 +67,9 @@ CephContext *common_preinit(const CephInitParameters &iparams, conf.set_val("no_config_file", iparams.no_config_file ? "true" : "false"); + if (conf->host.empty()) { + conf.set_val("host", ceph_get_short_hostname()); + } return cct; } #endif // #ifndef WITH_SEASTAR