mirror of
https://github.com/ceph/ceph
synced 2025-02-24 11:37:37 +00:00
RGW - Allow starting RGW/dbstore without connecting to Mons
DBStore, and some other Stores like Motr, don't need to connect to the Mons to work. However, startup automatically connects to the mons. There's provision to not connect, but the split isn't quite right. We need to call global_pre_init() to get config from the file, to determine which store to start, but we then need to decide before calling global_init() whether the configured store needs to connect to the mons. This requires a slight change to global_init() to set no_mon_config from the new flags. Signed-off-by: Daniel Gryniewicz <dang@redhat.com>
This commit is contained in:
parent
7d7fb643da
commit
0c50cecb29
@ -198,6 +198,10 @@ global_init(const std::map<std::string,std::string> *defaults,
|
||||
// manually. If they have, update them.
|
||||
if (g_ceph_context->get_init_flags() != flags) {
|
||||
g_ceph_context->set_init_flags(flags);
|
||||
if (flags & (CINIT_FLAG_NO_DEFAULT_CONFIG_FILE|
|
||||
CINIT_FLAG_NO_MON_CONFIG)) {
|
||||
g_conf()->no_mon_config = true;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
#include "include/str_list.h"
|
||||
#include "include/stringify.h"
|
||||
#include "global/global_init.h"
|
||||
#include "global/signal_handler.h"
|
||||
#include "common/config.h"
|
||||
#include "common/errno.h"
|
||||
@ -502,10 +501,10 @@ namespace rgw {
|
||||
{ "log_file", "/var/log/radosgw/$cluster-$name.log" }
|
||||
};
|
||||
|
||||
cct = global_init(&defaults, args,
|
||||
CEPH_ENTITY_TYPE_CLIENT,
|
||||
CODE_ENVIRONMENT_DAEMON,
|
||||
CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS);
|
||||
cct = rgw_global_init(&defaults, args,
|
||||
CEPH_ENTITY_TYPE_CLIENT,
|
||||
CODE_ENVIRONMENT_DAEMON,
|
||||
CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS);
|
||||
|
||||
ceph::mutex mutex = ceph::make_mutex("main");
|
||||
SafeTimer init_timer(g_ceph_context, mutex);
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "rgw_arn.h"
|
||||
#include "rgw_data_sync.h"
|
||||
|
||||
#include "global/global_init.h"
|
||||
#include "common/ceph_crypto.h"
|
||||
#include "common/armor.h"
|
||||
#include "common/errno.h"
|
||||
@ -2969,3 +2970,26 @@ int rgw_bucket_parse_bucket_instance(const string& bucket_instance, string *buck
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
boost::intrusive_ptr<CephContext>
|
||||
rgw_global_init(const std::map<std::string,std::string> *defaults,
|
||||
std::vector < const char* >& args,
|
||||
uint32_t module_type, code_environment_t code_env,
|
||||
int flags)
|
||||
{
|
||||
// Load the config from the files, but not the mon
|
||||
global_pre_init(defaults, args, module_type, code_env, flags);
|
||||
|
||||
// Get the store backend
|
||||
const auto& config_store = g_conf().get_val<std::string>("rgw_backend_store");
|
||||
|
||||
cerr << "config_store: " << config_store << std::endl;
|
||||
if ((config_store == "dbstore") ||
|
||||
(config_store == "motr")) {
|
||||
// These stores don't use the mon
|
||||
flags |= CINIT_FLAG_NO_MON_CONFIG;
|
||||
}
|
||||
|
||||
// Finish global init, indicating we already ran pre-init
|
||||
return global_init(defaults, args, module_type, code_env, flags, false);
|
||||
}
|
||||
|
@ -2412,3 +2412,9 @@ int decode_bl(bufferlist& bl, T& t)
|
||||
}
|
||||
|
||||
extern int rgw_bucket_parse_bucket_instance(const std::string& bucket_instance, std::string *bucket_name, std::string *bucket_id, int *shard_id);
|
||||
|
||||
boost::intrusive_ptr<CephContext>
|
||||
rgw_global_init(const std::map<std::string,std::string> *defaults,
|
||||
std::vector < const char* >& args,
|
||||
uint32_t module_type, code_environment_t code_env,
|
||||
int flags);
|
||||
|
@ -227,8 +227,8 @@ int radosgw_Main(int argc, const char **argv)
|
||||
// privileged ports
|
||||
flags |= CINIT_FLAG_DEFER_DROP_PRIVILEGES;
|
||||
|
||||
auto cct = global_init(&defaults, args, CEPH_ENTITY_TYPE_CLIENT,
|
||||
CODE_ENVIRONMENT_DAEMON, flags);
|
||||
auto cct = rgw_global_init(&defaults, args, CEPH_ENTITY_TYPE_CLIENT,
|
||||
CODE_ENVIRONMENT_DAEMON, flags);
|
||||
|
||||
// First, let's determine which frontends are configured.
|
||||
list<string> frontends;
|
||||
@ -361,6 +361,7 @@ int radosgw_Main(int argc, const char **argv)
|
||||
|
||||
std::string rgw_store = (!rgw_d3n_datacache_enabled) ? "rados" : "d3n";
|
||||
|
||||
// Get the store backend
|
||||
const auto& config_store = g_conf().get_val<std::string>("rgw_backend_store");
|
||||
#ifdef WITH_RADOSGW_DBSTORE
|
||||
if (config_store == "dbstore") {
|
||||
|
@ -1908,7 +1908,7 @@ namespace rgw::sal {
|
||||
|
||||
int DBStore::get_config_key_val(string name, bufferlist *bl)
|
||||
{
|
||||
return 0;
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
int DBStore::meta_list_keys_init(const DoutPrefixProvider *dpp, const string& section, const string& marker, void** phandle)
|
||||
|
Loading…
Reference in New Issue
Block a user