s->bucket_owner = s->bucket_acl->get_owner();
RGWZoneGroup zonegroup;
- ret = store->current_period.get_zonegroup(zonegroup, s->bucket_info.zonegroup);
+ ret = store->get_zonegroup(s->bucket_info.zonegroup, zonegroup);
if (!ret && !zonegroup.endpoints.empty()) {
s->zonegroup_endpoint = zonegroup.endpoints.front();
}
if (s->bucket_exists && !store->get_zonegroup().equals(s->bucket_info.zonegroup)) {
- ldout(s->cct, 0) << "NOTICE: request for data in a different zonegroup (" << s->bucket_info.zonegroup << " != " << store->get_zonegroup().get_name() << ")" << dendl;
+ ldout(s->cct, 0) << "NOTICE: request for data in a different zonegroup (" << s->bucket_info.zonegroup << " != " << store->get_zonegroup().get_id() << ")" << dendl;
/* we now need to make sure that the operation actually requires copy source, that is
* it's a copy operation
*/
int RGWZoneGroup::create_default(bool old_format)
{
name = default_zonegroup_name;
+ is_master = true;
RGWZoneGroupPlacementTarget placement_target;
placement_target.name = "default-placement";
name = id;
}
+ r = set_as_default();
return r;
}
return ret;
}
}
+ ldout(cct, 20) << "zonegroup " << zonegroup.get_name() << dendl;
if (zonegroup.is_master) {
rest_master_conn = new RGWRESTConn(cct, this, zonegroup.endpoints);
}
}
if (!has_period_zone) {
- ldout(cct, 10) << " cannot find current period zonegroup using local zonegroup" << dendl;
+ ldout(cct, 10) << "Cannot find current period zone using local zone" << dendl;
if (creating_defaults && cct->_conf->rgw_zone.empty()) {
zone_params.set_name(default_zone_name);
}
map<string, RGWZone>::iterator zone_iter = zonegroup.zones.find(zone_params.get_id());
if (zone_iter != zonegroup.zones.end()) {
zone_public_config = zone_iter->second;
+ ldout(cct, 20) << "zone " << zone_params.get_name() << dendl;
} else {
lderr(cct) << "Cannot find zone " << zone_params.get_name() << dendl;
return -EINVAL;
return -ENOENT;
}
-int RGWRados::select_new_bucket_location(RGWUserInfo& user_info, const string& zonegroup_name, const string& request_rule,
+int RGWRados::select_new_bucket_location(RGWUserInfo& user_info, const string& zonegroup_id, const string& request_rule,
const string& tenant_name, const string& bucket_name, rgw_bucket& bucket, string *pselected_rule)
{
/* first check that rule exists within the specific zonegroup */
RGWZoneGroup zonegroup;
- if (!current_period.get_id().empty()) {
- int ret = current_period.get_zonegroup(zonegroup, zonegroup_name);
- if (ret < 0) {
- ldout(cct, 0) << "could not find zonegroup " << zonegroup_name << " in zonegroup map" << dendl;
- return ret;
- }
+ int ret = get_zonegroup(zonegroup_id, zonegroup);
+ if (ret < 0) {
+ ldout(cct, 0) << "could not find zonegroup " << zonegroup_id << " in current period" << dendl;
+ return ret;
}
/* now check that tag exists within zonegroup */
RGWZone period_zone; /* external zone params, e.g., entrypoints, log flags, etc. */
bool has_period_zonegroup;
bool has_period_zone;
+
+ RGWPeriod current_period;
public:
RGWRados() : max_req_id(0), lock("rados_timer_lock"), watchers_lock("watchers_lock"), timer(NULL),
gc(NULL), obj_expirer(NULL), use_gc_thread(false), quota_threads(false),
string host_id;
RGWRealm realm;
- RGWPeriod current_period;
+
RGWRESTConn *rest_master_conn;
map<string, RGWRESTConn *> zone_conn_map;
map<string, RGWRESTConn *> zonegroup_conn_map;
+ int get_zonegroup(const string& id, RGWZoneGroup& zonegroup) {
+ int ret = 0;
+ if (id == get_zonegroup().get_id()) {
+ zonegroup = get_zonegroup();
+ } else if (!current_period.get_id().empty()) {
+ ret = current_period.get_zonegroup(zonegroup, zonegroup_id);
+ }
+ return ret;
+ }
+
RGWZoneParams& get_zone_params() { return zone_params; }
RGWZoneGroup& get_zonegroup() {
if (has_period_zonegroup) {