]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: non-rgw tier is not writeable
authorYehuda Sadeh <yehuda@redhat.com>
Wed, 3 Aug 2016 19:53:09 +0000 (12:53 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 7 Oct 2016 17:31:17 +0000 (10:31 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_op.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index 08e3f33d8839532c7ecaa4db1f7d9b6ddcefab81..a935981657ad29b4337e8005a0f6c1cd313d08f7 100644 (file)
@@ -552,7 +552,7 @@ int RGWOp::verify_op_mask()
     return -EPERM;
   }
 
-  if (!s->system_request && (required_mask & RGW_OP_TYPE_MODIFY) && store->get_zone().is_read_only()) {
+  if (!s->system_request && (required_mask & RGW_OP_TYPE_MODIFY) && !store->zone_is_writeable()) {
     ldout(s->cct, 5) << "NOTICE: modify request to a read-only zone by a non-system user, permission denied"  << dendl;
     return -EPERM;
   }
index 58d7edbc0801c98fa1dee15cbb562146c723e962..7c7998a8720cb300979fb4e1a94f3316551482c7 100644 (file)
@@ -3798,6 +3798,8 @@ int RGWRados::init_complete()
     return ret;
   }
 
+  writeable_zone = (zone_public_config.tier_type.empty() || zone_public_config.tier_type == "rgw");
+
   init_unique_trans_id_deps();
 
   finisher = new Finisher(cct);
index 5c42ca02ca376874e9f57912887e5391a37a4b5e..e3e8e25ade9d846fa4e3e92eaf0fb7623f144013 100644 (file)
@@ -1903,6 +1903,7 @@ protected:
 
   RGWSyncModulesManager *sync_modules_manager{nullptr};
   RGWSyncModuleInstanceRef sync_module;
+  bool writeable_zone{false};
 
   RGWZoneGroup zonegroup;
   RGWZone zone_public_config; /* external zone params, e.g., entrypoints, log flags, etc. */  
@@ -2013,6 +2014,10 @@ public:
     return zone_public_config;
   }
 
+  bool zone_is_writeable() {
+    return writeable_zone && !get_zone().is_read_only();
+  }
+
   uint32_t get_zone_short_id() const {
     return zone_short_id;
   }