return name.empty() && storage_class.empty();
}
+ void inherit_from(const rgw_placement_rule& r) {
+ if (name.empty()) {
+ name = r.name;
+ }
+ if (storage_class.empty()) {
+ storage_class = r.storage_class;
+ }
+ }
+
void clear() {
name.clear();
storage_class.clear();
string effective_uri;
string request_params;
string domain;
- string storage_class;
+ rgw_placement_rule storage_class;
req_info(CephContext *cct, const RGWEnv *env);
void rebuild_from(req_info& src);
if (multipart) {
processor.emplace<MultipartObjectProcessor>(
- &aio, store, s->bucket_info, s->owner.get_id(), obj_ctx, obj,
+ &aio, store, s->bucket_info, &s->info.storage_class,
+ s->owner.get_id(), obj_ctx, obj,
multipart_upload_id, multipart_part_num, multipart_part_str);
} else {
if (s->bucket_info.versioning_enabled()) {
}
}
processor.emplace<AtomicObjectProcessor>(
- &aio, store, s->bucket_info, s->bucket_owner.get_id(),
- obj_ctx, obj, olh_epoch, s->req_id);
+ &aio, store, s->bucket_info, &s->info.storage_class,
+ s->bucket_owner.get_id(), obj_ctx, obj, olh_epoch, s->req_id);
}
op_ret = processor->prepare();
ldpp_dout(this, 15) << "supplied_md5=" << supplied_md5 << dendl;
}
-
rgw_obj obj(s->bucket, get_current_filename());
if (s->bucket_info.versioning_enabled()) {
store->gen_rand_obj_instance_name(&obj);
}
rgw::AioThrottle aio(s->cct->_conf->rgw_put_obj_min_window_size);
+ rgw_placement_rule& tail_placement = s->info.storage_class;
+
using namespace rgw::putobj;
AtomicObjectProcessor processor(&aio, store, s->bucket_info,
- nullptr,
+ &tail_placement,
s->bucket_owner.get_id(),
*static_cast<RGWObjectCtx*>(s->obj_ctx),
obj, 0, s->req_id);
}
- rgw_placement_rule placement_rule;
- placement_rule.storage_class = s->info.storage_class;
if (bucket_exists) {
rgw_placement_rule selected_placement_rule;
rgw_bucket bucket;
bucket.name = s->bucket_name;
op_ret = store->svc.zone->select_bucket_placement(*(s->user),
store->svc.zone->get_zonegroup().get_id(),
- placement_rule,
+ s->info.storage_class,
&selected_placement_rule,
nullptr);
if (selected_placement_rule != binfo.placement_rule) {
op_ret = store->create_bucket(*(s->user),
bucket,
store->svc.zone->get_zonegroup().get_id(),
- placement_rule, binfo.swift_ver_location,
+ s->info.storage_class, binfo.swift_ver_location,
pquota_info, attrs,
out_info, pobjv, &ep_objv, creation_time,
pmaster_bucket, pmaster_num_shards, true);
}
rgw::AioThrottle aio(store->ctx()->_conf->rgw_put_obj_min_window_size);
+ rgw_placement_rule& tail_placement = s->info.storage_class;
+
using namespace rgw::putobj;
- AtomicObjectProcessor processor(&aio, store, binfo, nullptr, bowner.get_id(),
+ AtomicObjectProcessor processor(&aio, store, binfo, &tail_placement, bowner.get_id(),
obj_ctx, obj, 0, s->req_id);
op_ret = processor.prepare();
r = manifest_gen.create_begin(store->ctx(), &manifest,
bucket_info.placement_rule,
- ptail_placement_rule,
+ &tail_placement_rule,
head_obj.bucket, head_obj);
if (r < 0) {
return r;
{
int r = manifest_gen.create_begin(store->ctx(), &manifest,
bucket_info.placement_rule,
- ptail_placement_rule,
+ &tail_placement_rule,
target_obj.bucket, target_obj);
if (r < 0) {
return r;
protected:
RGWRados *const store;
const RGWBucketInfo& bucket_info;
- const rgw_placement_rule *ptail_placement_rule;
+ rgw_placement_rule tail_placement_rule;
const rgw_user& owner;
RGWObjectCtx& obj_ctx;
rgw_obj head_obj;
const rgw_obj& head_obj)
: HeadObjectProcessor(0),
store(store), bucket_info(bucket_info),
- ptail_placement_rule(ptail_placement_rule), owner(owner),
+ owner(owner),
obj_ctx(obj_ctx), head_obj(head_obj),
writer(aio, store, bucket_info, obj_ctx, head_obj),
- chunk(&writer, 0), stripe(&chunk, this, 0)
- {}
+ chunk(&writer, 0), stripe(&chunk, this, 0) {
+ if (ptail_placement_rule) {
+ tail_placement_rule = *ptail_placement_rule;
+ }
+ }
};
manifest = _m;
if (!tail_placement_rule) {
- tail_placement_rule = &head_placement_rule;
+ manifest->set_tail_placement(head_placement_rule, _b);
+ } else {
+ rgw_placement_rule new_tail_rule = *tail_placement_rule;
+ new_tail_rule.inherit_from(head_placement_rule);
+ manifest->set_tail_placement(new_tail_rule, _b);
}
- manifest->set_tail_placement(*tail_placement_rule, _b);
manifest->set_head(head_placement_rule, _obj, 0);
last_ofs = 0;
size_t pos = location_constraint.find(':');
if (pos != string::npos) {
- placement_rule.init(location_constraint.substr(pos + 1), s->info.storage_class);
+ placement_rule.init(location_constraint.substr(pos + 1), s->info.storage_class.storage_class);
location_constraint = location_constraint.substr(0, pos);
}
const char *sc = s->info.env->get("HTTP_X_AMZ_STORAGE_CLASS");
if (sc) {
- s->info.storage_class = sc;
+ s->info.storage_class.storage_class = sc;
}
return RGWHandler_REST::init(store, s, cio);
location_constraint = store->svc.zone->get_zonegroup().api_name;
get_rmattrs_from_headers(s, CONT_PUT_ATTR_PREFIX,
CONT_REMOVE_ATTR_PREFIX, rmattr_names);
- placement_rule.init(s->info.env->get("HTTP_X_STORAGE_POLICY", ""), s->info.storage_class);
+ placement_rule.init(s->info.env->get("HTTP_X_STORAGE_POLICY", ""), s->info.storage_class.storage_class);
return get_swift_versioning_settings(s, swift_ver_location);
}
get_rmattrs_from_headers(s, CONT_PUT_ATTR_PREFIX, CONT_REMOVE_ATTR_PREFIX,
rmattr_names);
- placement_rule.init(s->info.env->get("HTTP_X_STORAGE_POLICY", ""), s->info.storage_class);
+ placement_rule.init(s->info.env->get("HTTP_X_STORAGE_POLICY", ""), s->info.storage_class.storage_class);
return get_swift_versioning_settings(s, swift_ver_location);
}
s->op = OP_PUT;
}
- s->info.storage_class = s->info.env->get("HTTP_X_OBJECT_STORAGE_CLASS", "");
+ s->info.storage_class.storage_class = s->info.env->get("HTTP_X_OBJECT_STORAGE_CLASS", "");
return RGWHandler_REST::init(store, s, cio);
}