OPTION(rgw_maintenance_tick_interval, OPT_DOUBLE, 10.0)
OPTION(rgw_pools_preallocate_max, OPT_INT, 100)
OPTION(rgw_pools_preallocate_threshold, OPT_INT, 70)
+OPTION(rgw_cluster_root_pool, OPT_STR, ".rgw.root")
OPTION(rgw_log_nonexistent_bucket, OPT_BOOL, false)
OPTION(rgw_log_object_name, OPT_STR, "%Y-%m-%d-%H-%i-%n") // man date to see codes (a subset are supported)
OPTION(rgw_log_object_name_utc, OPT_BOOL, false)
static string default_storage_pool = ".rgw.buckets";
static string avail_pools = ".pools.avail";
+static string cluster_info_oid = "cluster_info";
+
static RGWObjCategory shadow_category = RGW_OBJ_CATEGORY_SHADOW;
static RGWObjCategory main_category = RGW_OBJ_CATEGORY_MAIN;
#define RGW_USAGE_OBJ_PREFIX "usage."
+#define RGW_DEFAULT_CLUSTER_ROOT_POOL ".rgw.root"
+
#define dout_subsys ceph_subsys_rgw
user_uid_pool = ".users.uid";
}
+int RGWRadosParams::init(CephContext *cct, RGWRados *store)
+{
+ string pool_name = cct->_conf->rgw_cluster_root_pool;
+ if (pool_name.empty())
+ pool_name = RGW_DEFAULT_CLUSTER_ROOT_POOL;
+
+ rgw_bucket pool(pool_name.c_str());
+ bufferlist bl;
+
+ int ret = rgw_get_obj(store, NULL, pool, cluster_info_oid, bl);
+ if (ret == -ENOENT) {
+ init_default();
+ ::encode(*this, bl);
+ ret = rgw_put_system_obj(store, pool, cluster_info_oid, bl.c_str(), bl.length(), true, NULL);
+ return ret;
+ }
+ if (ret < 0)
+ return ret;
+
+ try {
+ bufferlist::iterator iter = bl.begin();
+ ::decode(*this, iter);
+ } catch (buffer::error& err) {
+ ldout(cct, 0) << "ERROR: failed to decode cluster info from " << pool << ":" << cluster_info_oid << dendl;
+ return -EIO;
+ }
+
+ return 0;
+}
class RGWWatcher : public librados::WatchCtx {
RGWRados *rados;
if (ret < 0)
return ret;
- params.init_default();
+ params.init(cct, this);
ret = open_root_pool_ctx();
if (ret < 0)
rgw_bucket user_swift_pool;
rgw_bucket user_uid_pool;
+ int init(CephContext *cct, RGWRados *store);
void init_default();
+
+ void encode(bufferlist& bl) const {
+ ENCODE_START(1, 1, bl);
+ ::encode(domain_root, bl);
+ ::encode(control_pool, bl);
+ ::encode(gc_pool, bl);
+ ::encode(log_pool, bl);
+ ::encode(intent_log_pool, bl);
+ ::encode(usage_log_pool, bl);
+ ::encode(user_keys_pool, bl);
+ ::encode(user_email_pool, bl);
+ ::encode(user_swift_pool, bl);
+ ::encode(user_uid_pool, bl);
+ ENCODE_FINISH(bl);
+ }
+
+ void decode(bufferlist::iterator& bl) {
+ DECODE_START(1, bl);
+ ::decode(domain_root, bl);
+ ::decode(control_pool, bl);
+ ::decode(gc_pool, bl);
+ ::decode(log_pool, bl);
+ ::decode(intent_log_pool, bl);
+ ::decode(usage_log_pool, bl);
+ ::decode(user_keys_pool, bl);
+ ::decode(user_email_pool, bl);
+ ::decode(user_swift_pool, bl);
+ ::decode(user_uid_pool, bl);
+ DECODE_FINISH(bl);
+ }
};
+WRITE_CLASS_ENCODER(RGWRadosParams);
class RGWRados
{