encode_json("user_swift_pool", user_swift_pool.data_pool, f);
encode_json("user_uid_pool ", user_uid_pool.data_pool, f);
encode_json_plain("system_key", system_key, f);
+ encode_json("placement_pools ", placement_pools, f);
}
static void decode_json(const char *field, rgw_bucket& bucket, JSONObj *obj)
bucket = rgw_bucket(pool.c_str());
}
+void RGWZonePlacementInfo::dump(Formatter *f) const
+{
+ encode_json("index_pool", index_pool, f);
+ encode_json("data_pool", data_pool, f);
+}
+
+void RGWZonePlacementInfo::decode_json(JSONObj *obj)
+{
+ JSONDecoder::decode_json("index_pool", index_pool, obj);
+ JSONDecoder::decode_json("data_pool", data_pool, obj);
+}
+
void RGWZoneParams::decode_json(JSONObj *obj)
{
::decode_json("domain_root", domain_root, obj);
::decode_json("user_swift_pool", user_swift_pool, obj);
::decode_json("user_uid_pool ", user_uid_pool, obj);
JSONDecoder::decode_json("system_key", system_key, obj);
+ JSONDecoder::decode_json("placement_pools", placement_pools, obj);
}
void RGWZone::dump(Formatter *f) const
JSONDecoder::decode_json("endpoints", endpoints, obj);
}
+void RGWRegionPlacementTarget::dump(Formatter *f) const
+{
+ encode_json("name", name, f);
+ encode_json("tags", tags, f);
+}
+
+void RGWRegionPlacementTarget::decode_json(JSONObj *obj)
+{
+ JSONDecoder::decode_json("name", name, obj);
+ JSONDecoder::decode_json("tags", tags, obj);
+}
+
void RGWRegion::dump(Formatter *f) const
{
encode_json("name", name, f);
encode_json("endpoints", endpoints, f);
encode_json("master_zone", master_zone, f);
encode_json_map("zones", zones, f); /* more friendly representation */
+ encode_json_map("placement_targets", placement_targets, f); /* more friendly representation */
}
static void decode_zones(map<string, RGWZone>& zones, JSONObj *o)
zones[z.name] = z;
}
+static void decode_placement_targets(map<string, RGWRegionPlacementTarget>& targets, JSONObj *o)
+{
+ RGWRegionPlacementTarget t;
+ t.decode_json(o);
+ targets[t.name] = t;
+}
+
void RGWRegion::decode_json(JSONObj *obj)
{
JSONDecoder::decode_json("endpoints", endpoints, obj);
JSONDecoder::decode_json("master_zone", master_zone, obj);
JSONDecoder::decode_json("zones", zones, decode_zones, obj);
+ JSONDecoder::decode_json("placement_targets", placement_targets, decode_placement_targets, obj);
}
struct RGWRegion;
+
+struct RGWZonePlacementInfo {
+ string index_pool;
+ string data_pool;
+
+ void encode(bufferlist& bl) const {
+ ENCODE_START(3, 1, bl);
+ ::encode(index_pool, bl);
+ ::encode(data_pool, bl);
+ ENCODE_FINISH(bl);
+ }
+
+ void decode(bufferlist::iterator& bl) {
+ DECODE_START(1, bl);
+ ::decode(index_pool, bl);
+ ::decode(data_pool, bl);
+ DECODE_FINISH(bl);
+ }
+ void dump(Formatter *f) const;
+ void decode_json(JSONObj *obj);
+};
+WRITE_CLASS_ENCODER(RGWZonePlacementInfo);
+
struct RGWZoneParams {
rgw_bucket domain_root;
rgw_bucket control_pool;
RGWAccessKey system_key;
+ map<string, RGWZonePlacementInfo> placement_pools;
+
static string get_pool_name(CephContext *cct);
void init_name(CephContext *cct, RGWRegion& region);
int init(CephContext *cct, RGWRados *store, RGWRegion& region);
int store_info(CephContext *cct, RGWRados *store, RGWRegion& region);
void encode(bufferlist& bl) const {
- ENCODE_START(3, 1, bl);
+ ENCODE_START(4, 1, bl);
::encode(domain_root, bl);
::encode(control_pool, bl);
::encode(gc_pool, bl);
::encode(user_uid_pool, bl);
::encode(name, bl);
::encode(system_key, bl);
+ ::encode(placement_pools, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator& bl) {
- DECODE_START(3, bl);
+ DECODE_START(4, bl);
::decode(domain_root, bl);
::decode(control_pool, bl);
::decode(gc_pool, bl);
::decode(name, bl);
if (struct_v >= 3)
::decode(system_key, bl);
+ if (struct_v >= 4)
+ ::decode(placement_pools, bl);
DECODE_FINISH(bl);
}
void dump(Formatter *f) const;
};
WRITE_CLASS_ENCODER(RGWDefaultRegionInfo);
+struct RGWRegionPlacementTarget {
+ string name;
+ list<string> tags;
+
+ void encode(bufferlist& bl) const {
+ ENCODE_START(1, 1, bl);
+ ::encode(name, bl);
+ ::encode(tags, bl);
+ ENCODE_FINISH(bl);
+ }
+
+ void decode(bufferlist::iterator& bl) {
+ DECODE_START(1, bl);
+ ::decode(name, bl);
+ ::decode(tags, bl);
+ DECODE_FINISH(bl);
+ }
+ void dump(Formatter *f) const;
+ void decode_json(JSONObj *obj);
+};
+WRITE_CLASS_ENCODER(RGWRegionPlacementTarget);
+
+
struct RGWRegion {
string name;
string api_name;
string master_zone;
map<string, RGWZone> zones;
+ map<string, RGWRegionPlacementTarget> placement_targets;
+
CephContext *cct;
RGWRados *store;