Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgw: dump Last-Modified in Swift's responses for GET/HEAD on container. #16757

Merged
merged 1 commit into from Feb 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/rgw/rgw_common.h
Expand Up @@ -1766,7 +1766,8 @@ struct req_state {
string redirect;

RGWBucketInfo bucket_info;
map<string, bufferlist> bucket_attrs;
real_time bucket_mtime;
std::map<std::string, ceph::bufferlist> bucket_attrs;
bool bucket_exists;

bool has_bad_meta;
Expand Down
12 changes: 8 additions & 4 deletions src/rgw/rgw_op.cc
Expand Up @@ -441,9 +441,13 @@ int rgw_build_bucket_policies(RGWRados* store, struct req_state* s)
if (!s->bucket_name.empty()) {
s->bucket_exists = true;
if (s->bucket_instance_id.empty()) {
ret = store->get_bucket_info(obj_ctx, s->bucket_tenant, s->bucket_name, s->bucket_info, NULL, &s->bucket_attrs);
ret = store->get_bucket_info(obj_ctx, s->bucket_tenant, s->bucket_name,
s->bucket_info, &s->bucket_mtime,
&s->bucket_attrs);
} else {
ret = store->get_bucket_instance_info(obj_ctx, s->bucket_instance_id, s->bucket_info, NULL, &s->bucket_attrs);
ret = store->get_bucket_instance_info(obj_ctx, s->bucket_instance_id,
s->bucket_info, &s->bucket_mtime,
&s->bucket_attrs);
}
if (ret < 0) {
if (ret != -ENOENT) {
Expand Down Expand Up @@ -2548,7 +2552,7 @@ void RGWCreateBucket::execute()
* specific request */
RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
op_ret = store->get_bucket_info(obj_ctx, s->bucket_tenant, s->bucket_name,
s->bucket_info, NULL, &s->bucket_attrs);
s->bucket_info, nullptr, &s->bucket_attrs);
if (op_ret < 0 && op_ret != -ENOENT)
return;
s->bucket_exists = (op_ret != -ENOENT);
Expand Down Expand Up @@ -5999,7 +6003,7 @@ int RGWBulkUploadOp::handle_dir(const boost::string_ref path)
RGWBucketInfo binfo;
std::map<std::string, ceph::bufferlist> battrs;
op_ret = store->get_bucket_info(*dir_ctx, s->bucket_tenant, bucket_name,
binfo, NULL, &battrs);
binfo, nullptr, &battrs);
if (op_ret < 0 && op_ret != -ENOENT) {
return op_ret;
}
Expand Down
4 changes: 4 additions & 0 deletions src/rgw/rgw_rest_swift.cc
Expand Up @@ -457,6 +457,10 @@ static void dump_container_metadata(struct req_state *s,
if (ws_conf.listing_enabled) {
dump_header(s, "X-Container-Meta-Web-Listings", "true");
}

/* Dump bucket's modification time. Compliance with the Swift API really
* needs that. */
dump_last_modified(s, s->bucket_mtime);
}

void RGWStatAccount_ObjStore_SWIFT::execute()
Expand Down