return out;
}
+ const std::string& get_config() {
+ return config;
+ }
+
std::map<std::string, std::string>& get_config_map() {
return config_map;
}
#include "common/safe_io.h"
#include "include/compat.h"
#include "include/str_list.h"
+#include "include/stringify.h"
#include "rgw_common.h"
#include "rgw_rados.h"
#include "rgw_user.h"
register_async_signal_handler(SIGUSR1, handle_sigterm);
sighandler_alrm = signal(SIGALRM, godown_alarm);
+ map<string, string> service_map_meta;
+ service_map_meta["pid"] = stringify(getpid());
+
list<RGWFrontend *> fes;
+ int fe_count = 0;
+
for (multimap<string, RGWFrontendConfig *>::iterator fiter = fe_map.begin();
- fiter != fe_map.end(); ++fiter) {
+ fiter != fe_map.end(); ++fiter, ++fe_count) {
RGWFrontendConfig *config = fiter->second;
string framework = config->get_framework();
RGWFrontend *fe = NULL;
if (framework == "civetweb" || framework == "mongoose") {
+ framework = "civetweb";
std::string uri_prefix;
config->get_val("prefix", "", &uri_prefix);
#endif /* WITH_RADOSGW_BEAST_FRONTEND */
#if defined(WITH_RADOSGW_FCGI_FRONTEND)
else if (framework == "fastcgi" || framework == "fcgi") {
+ framework = "fastcgi";
std::string uri_prefix;
config->get_val("prefix", "", &uri_prefix);
RGWProcessEnv fcgi_pe = { store, &rest, olog, 0, uri_prefix, auth_registry };
}
#endif /* WITH_RADOSGW_FCGI_FRONTEND */
+ service_map_meta["frontend_type#" + stringify(fe_count)] = framework;
+ service_map_meta["frontend_config#" + stringify(fe_count)] = config->get_config();
+
if (fe == NULL) {
dout(0) << "WARNING: skipping unknown framework: " << framework << dendl;
continue;
fes.push_back(fe);
}
+ r = store->register_to_service_map("rgw", service_map_meta);
+ if (r < 0) {
+ derr << "ERROR: failed to register to service map: " << cpp_strerror(-r) << dendl;
+
+ /* ignore error */
+ }
+
+
// add a watcher to respond to realm configuration changes
RGWPeriodPusher pusher(store);
RGWFrontendPauser pauser(fes, &pusher);
- RGWRealmReloader reloader(store, &pauser);
+ RGWRealmReloader reloader(store, service_map_meta, &pauser);
preloader = &reloader;
if (ret < 0) {
return ret;
}
-
ret = r.connect();
if (ret < 0) {
return ret;
return ret;
}
+
+int RGWRados::register_to_service_map(const string& daemon_type, const map<string, string>& meta)
+{
+ map<string,string> metadata = meta;
+ metadata["num_handles"] = stringify(rados.size());
+ metadata["zonegroup_id"] = zonegroup.get_id();
+ metadata["zonegroup_name"] = zonegroup.get_name();
+ metadata["zone_name"] = zone_name();
+ metadata["zone_id"] = zone_id();;
+ string name = cct->_conf->name.get_id();
+ if (name.find("rgw.") == 0) {
+ name = name.substr(4);
+ }
+ int ret = rados[0].service_daemon_register(daemon_type, name, metadata);
+ if (ret < 0) {
+ ldout(cct, 0) << "ERROR: service_daemon_register() returned ret=" << ret << ": " << cpp_strerror(-ret) << dendl;
+ return ret;
+ }
+
+ return 0;
+}
+
/**
* Add new connection to connections map
* @param zonegroup_conn_map map which new connection will be added to
map<string, RGWZonePlacementInfo>::iterator piter = get_zone_params().placement_pools.find(location_rule);
if (piter == get_zone_params().placement_pools.end()) {
/* couldn't find, means we cannot really place data for this bucket in this zone */
- if (get_zonegroup().equals(zonegroup_id)) {
+ if (get_zonegroup().equals(zonegroup.get_id())) {
/* that's a configuration error, zone should have that rule, as we're within the requested
* zonegroup */
return -EINVAL;
bool pools_initialized;
- string zonegroup_id;
- string zone_name;
string trans_id_suffix;
RGWQuotaHandler *quota_handler;
int initialize();
void finalize();
+ int register_to_service_map(const string& daemon_type, const map<string, string>& meta);
+
void schedule_context(Context *c);
/** set up a bucket listing. handle is filled in. */
int add_bucket_to_reshard(const RGWBucketInfo& bucket_info, uint32_t new_num_shards);
uint64_t instance_id();
+ const string& zone_name() {
+ return get_zone_params().get_name();
+ }
const string& zone_id() {
return get_zone_params().get_id();
}
#include "rgw_rest.h"
#include "rgw_user.h"
+#include "common/errno.h"
+
#define dout_subsys ceph_subsys_rgw
#undef dout_prefix
static constexpr bool USE_SAFE_TIMER_CALLBACKS = false;
-RGWRealmReloader::RGWRealmReloader(RGWRados*& store, Pauser* frontends)
+RGWRealmReloader::RGWRealmReloader(RGWRados*& store, std::map<std::string, std::string>& service_map_meta,
+ Pauser* frontends)
: store(store),
+ service_map_meta(service_map_meta),
frontends(frontends),
timer(store->ctx(), mutex, USE_SAFE_TIMER_CALLBACKS),
mutex("RGWRealmReloader"),
}
}
+ int r = store->register_to_service_map("rgw", service_map_meta);
+ if (r < 0) {
+ lderr(cct) << "ERROR: failed to register to service map: " << cpp_strerror(-r) << dendl;
+
+ /* ignore error */
+ }
+
ldout(cct, 1) << "Finishing initialization of new store" << dendl;
// finish initializing the new store
ldout(cct, 1) << " - REST subsystem init" << dendl;
virtual void resume(RGWRados* store) = 0;
};
- RGWRealmReloader(RGWRados*& store, Pauser* frontends);
+ RGWRealmReloader(RGWRados*& store, std::map<std::string, std::string>& service_map_meta,
+ Pauser* frontends);
~RGWRealmReloader() override;
/// respond to realm notifications by scheduling a reload()
/// main()'s RGWRados pointer as a reference, modified by reload()
RGWRados*& store;
+ std::map<std::string, std::string>& service_map_meta;
Pauser *const frontends;
/// reload() takes a significant amount of time, so we don't want to run