]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add option for relaxed region enforcement 22533/head
authorMatt Benjamin <mbenjamin@redhat.com>
Tue, 12 Jun 2018 17:14:44 +0000 (13:14 -0400)
committerMatt Benjamin <mbenjamin@redhat.com>
Mon, 18 Jun 2018 13:35:15 +0000 (09:35 -0400)
Fixes: http://tracker.ceph.com/issues/24507
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/common/options.cc
src/rgw/rgw_op.cc
src/rgw/rgw_op.h

index 2a31285ff22831d1a7ece2ccf5aa440282113f47..0ce96081bb9c8ce9e1c967fad260f022f56c5185 100644 (file)
@@ -5049,6 +5049,12 @@ std::vector<Option> get_rgw_options() {
         "Try to handle requests with abiguous multiple content length headers "
         "(Content-Length, Http-Content-Length)."),
 
+    Option("rgw_relaxed_region_enforcement", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
+    .set_default(false)
+    .set_description("Disable region constraint enforcement")
+    .set_long_description(
+        "Enable requests such as bucket creation to succeed irrespective of region restrictions (Jewel compat)."),
+
     Option("rgw_lifecycle_work_time", Option::TYPE_STR, Option::LEVEL_ADVANCED)
     .set_default("00:00-06:00")
     .set_description("Lifecycle allowed work time")
index d539af4a4b96ca621c08dd1c01c475a43926fa6f..e81abcf0ef262fe1b46a819504343c2985a3676d 100644 (file)
@@ -2719,7 +2719,8 @@ void RGWCreateBucket::execute()
   if (op_ret < 0)
     return;
 
-  if (!location_constraint.empty() &&
+  if (!relaxed_region_enforcement &&
+      !location_constraint.empty() &&
       !store->has_zonegroup_api(location_constraint)) {
       ldpp_dout(this, 0) << "location constraint (" << location_constraint << ")"
                        << " can't be found." << dendl;
@@ -2728,7 +2729,7 @@ void RGWCreateBucket::execute()
       return;
   }
 
-  if (!store->get_zonegroup().is_master_zonegroup() && !location_constraint.empty() &&
+  if (!relaxed_region_enforcement && !store->get_zonegroup().is_master_zonegroup() && !location_constraint.empty() &&
       store->get_zonegroup().api_name != location_constraint) {
     ldpp_dout(this, 0) << "location constraint (" << location_constraint << ")"
                      << " doesn't match zonegroup" << " (" << store->get_zonegroup().api_name << ")"
index 0219c670910741f05661c6b506bd8c0100ef0f2f..1c5ccb30cce6e9854fc358721dc03328469e0863 100644 (file)
@@ -884,6 +884,7 @@ protected:
   RGWBucketInfo info;
   obj_version ep_objv;
   bool has_cors;
+  bool relaxed_region_enforcement;
   RGWCORSConfiguration cors_config;
   boost::optional<std::string> swift_ver_location;
   map<string, buffer::list> attrs;
@@ -894,7 +895,7 @@ protected:
   virtual bool need_metadata_upload() const { return false; }
 
 public:
-  RGWCreateBucket() : has_cors(false) {}
+  RGWCreateBucket() : has_cors(false), relaxed_region_enforcement(false) {}
 
   void emplace_attr(std::string&& key, buffer::list&& bl) {
     attrs.emplace(std::move(key), std::move(bl)); /* key and bl are r-value refs */
@@ -906,6 +907,8 @@ public:
   void init(RGWRados *store, struct req_state *s, RGWHandler *h) override {
     RGWOp::init(store, s, h);
     policy.set_ctx(s->cct);
+    relaxed_region_enforcement =
+       s->cct->_conf->get_val<bool>("rgw_relaxed_region_enforcement");
   }
   virtual int get_params() { return 0; }
   void send_response() override = 0;