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: check placement target existence during bucket creation #16384

Merged
merged 1 commit into from Jul 27, 2017
Merged
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
11 changes: 11 additions & 0 deletions src/rgw/rgw_op.cc
Expand Up @@ -2524,6 +2524,17 @@ void RGWCreateBucket::execute()
return;
}

const auto& zonegroup = store->get_zonegroup();
if (!placement_rule.empty() &&
!zonegroup.placement_targets.count(placement_rule)) {
ldout(s->cct, 0) << "placement target (" << placement_rule << ")"
<< " doesn't exist in the placement targets of zonegroup"
<< " (" << store->get_zonegroup().api_name << ")" << dendl;
op_ret = -ERR_INVALID_LOCATION_CONSTRAINT;
s->err.message = "The specified placement target does not exist";
return;
}

/* we need to make sure we read bucket info, it's not read before for this
* specific request */
RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
Expand Down