]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: set correct storage class for post object upload 30956/head
authoryuliyang <yuliyang@cmss.chinamobile.com>
Wed, 16 Oct 2019 07:18:59 +0000 (15:18 +0800)
committeryuliyang <yuliyang@cmss.chinamobile.com>
Wed, 16 Oct 2019 07:48:39 +0000 (15:48 +0800)
fix https://tracker.ceph.com/issues/42336

Signed-off-by: yuliyang <yuliyang@cmss.chinamobile.com>
src/rgw/rgw_rest_s3.cc

index b1c75fe8715c07079fdb175fc83c9cf7234cc8fb..25a01590a50d48271a62f23963feada03c16ccc4 100644 (file)
@@ -2133,6 +2133,18 @@ int RGWPostObj_ObjStore_S3::get_params()
     env.add_var("Content-Type", content_type);
   }
 
+  std::string storage_class;
+  part_str(parts, "x-amz-storage-class", &storage_class);
+
+  if (! storage_class.empty()) {
+    s->dest_placement.storage_class = storage_class;
+    if (!store->svc()->zone->get_zone_params().valid_placement(s->dest_placement)) {
+      ldpp_dout(this, 0) << "NOTICE: invalid dest placement: " << s->dest_placement.to_str() << dendl;
+      err_msg = "The storage class you specified is not valid";
+      return -EINVAL;
+    }
+  }
+
   map<string, struct post_form_part, ltstr_nocase>::iterator piter =
     parts.upper_bound(RGW_AMZ_META_PREFIX);
   for (; piter != parts.end(); ++piter) {