]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge branch 'master' into update-ceph-mgw
authorAndriy Tkachuk <andriy.tkachuk@seagate.com>
Sat, 28 Jan 2023 22:10:48 +0000 (22:10 +0000)
committerAndriy Tkachuk <andriy.tkachuk@seagate.com>
Sat, 28 Jan 2023 22:10:48 +0000 (22:10 +0000)
1  2 
src/common/options/rgw.yaml.in
src/rgw/rgw_sal.cc
src/rgw/rgw_sal_motr.cc
src/rgw/rgw_sal_motr.h

Simple merge
index 1102d8d461f3e00f922f43e4f000381e10fb8051,8a793f753146763090cc54dd3942040462721fa7..58a21f707f58eb9e682b432b0b986b0a5cc7379e
@@@ -152,15 -182,42 +182,15 @@@ rgw::sal::Driver* DriverManager::init_s
  #endif
  
  #ifdef WITH_RADOSGW_MOTR
-   if (svc.compare("motr") == 0) {
-     rgw::sal::Store* store = newMotrStore(cct);
-     if (store == nullptr) {
+   else if (cfg.store_name.compare("motr") == 0) {
+     driver = newMotrStore(cct);
+     if (driver == nullptr) {
        ldpp_dout(dpp, 0) << "newMotrStore() failed!" << dendl;
-       return store;
+       return driver;
      }
-     ((rgw::sal::MotrStore *)store)->init_metadata_cache(dpp, cct);
+     ((rgw::sal::MotrStore *)driver)->init_metadata_cache(dpp, cct);
  
 -    /* XXX: temporary - create testid user */
 -    rgw_user testid_user("tenant", "tester", "ns");
 -    std::unique_ptr<rgw::sal::User> user = driver->get_user(testid_user);
 -    user->get_info().user_id = testid_user;
 -    user->get_info().display_name = "Motr Explorer";
 -    user->get_info().user_email = "tester@seagate.com";
 -    RGWAccessKey k1("0555b35654ad1656d804", "h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q==");
 -    user->get_info().access_keys["0555b35654ad1656d804"] = k1;
 -
 -    ldpp_dout(dpp, 20) << "Store testid and user for Motr. User = " << user->get_info().user_id.id << dendl;
 -    int rc = user->store_user(dpp, null_yield, true);
 -    if (rc < 0) {
 -      ldpp_dout(dpp, 0) << "ERROR: failed to store testid user ar Motr: rc=" << rc << dendl;
 -    }
 -
 -    // Read user info and compare.
 -    rgw_user ruser("", "tester", "");
 -    std::unique_ptr<rgw::sal::User> suser = driver->get_user(ruser);
 -    suser->get_info().user_id = ruser;
 -    rc = suser->load_user(dpp, null_yield);
 -    if (rc != 0) {
 -      ldpp_dout(dpp, 0) << "ERROR: failed to load testid user from Motr: rc=" << rc << dendl;
 -    } else {
 -      ldpp_dout(dpp, 20) << "Read and compare user info: " << dendl;
 -      ldpp_dout(dpp, 20) << "User id = " << suser->get_info().user_id.id << dendl;
 -      ldpp_dout(dpp, 20) << "User display name = " << suser->get_info().display_name << dendl;
 -      ldpp_dout(dpp, 20) << "User email = " << suser->get_info().user_email << dendl;
 -    }
 +    return store;
    }
  #endif
  
index ebeda17aa7c69e69703a5d46614dfaed18f37fdf,81d801782aae800f71437997a0fc5761f9f48110..728c6d2b07fb4406382024ec04f26c8e12c889c5
@@@ -1514,24 -1231,16 +1502,24 @@@ MotrObject::MotrDeleteOp::MotrDeleteOp(
  // 2. Delete an object when its versioning is turned on.
  int MotrObject::MotrDeleteOp::delete_obj(const DoutPrefixProvider* dpp, optional_yield y)
  {
-   ldpp_dout(dpp, 20) << "delete " << source->get_key().to_str() << " from " << source->get_bucket()->get_name() << dendl;
+   ldpp_dout(dpp, 20) << "delete " << source->get_key().get_oid() << " from " << source->get_bucket()->get_name() << dendl;
  
 +  rgw_bucket_dir_entry ent;
 +  int rc = source->get_bucket_dir_ent(dpp, ent);
 +  if (rc < 0) {
 +    return rc;
 +  }
 +
 +  //TODO: When integrating with background GC for object deletion,
 +  // we should consider adding object entry to GC before deleting the metadata.
    // Delete from the cache first.
-   source->store->get_obj_meta_cache()->remove(dpp, source->get_key().to_str());
+   source->store->get_obj_meta_cache()->remove(dpp, source->get_key().get_oid());
  
    // Delete the object's entry from the bucket index.
    bufferlist bl;
    string bucket_index_iname = "motr.rgw.bucket.index." + source->get_bucket()->get_name();
 -  int rc = source->store->do_idx_op_by_name(bucket_index_iname,
 -                                            M0_IC_DEL, source->get_key().get_oid(), bl);
 +  rc = source->store->do_idx_op_by_name(bucket_index_iname,
-                                             M0_IC_DEL, source->get_key().to_str(), bl);
++                                        M0_IC_DEL, source->get_key().get_oid(), bl);
    if (rc < 0) {
      ldpp_dout(dpp, 0) << "Failed to del object's entry from bucket index. " << dendl;
      return rc;
@@@ -2005,12 -1687,12 +1993,12 @@@ int MotrObject::get_bucket_dir_ent(cons
        }
      }
    } else {
-     if (this->store->get_obj_meta_cache()->get(dpp, this->get_key().to_str(), bl)) {
+     if (this->store->get_obj_meta_cache()->get(dpp, this->get_key().get_oid(), bl)) {
        ldpp_dout(dpp, 20) <<__func__<< ": non-versioned bucket!" << dendl;
        rc = this->store->do_idx_op_by_name(bucket_index_iname,
-                                           M0_IC_GET, this->get_key().to_str(), bl);
+                                           M0_IC_GET, this->get_key().get_oid(), bl);
        if (rc < 0) {
 -        ldpp_dout(dpp, 0) << "ERROR: failed to get object's entry from bucket index: rc="
 +        ldpp_dout(dpp, 0) << __func__ << "ERROR: failed to get object's entry from bucket index: rc="
                            << rc << dendl;
          return rc;
        }
@@@ -2464,17 -2142,10 +2452,17 @@@ int MotrAtomicWriter::complete(size_t a
    // Insert an entry into bucket index.
    string bucket_index_iname = "motr.rgw.bucket.index." + obj.get_bucket()->get_name();
    rc = store->do_idx_op_by_name(bucket_index_iname,
-                                 M0_IC_PUT, obj.get_key().to_str(), bl);
+                                 M0_IC_PUT, obj.get_key().get_oid(), bl);
    if (rc == 0)
-     store->get_obj_meta_cache()->put(dpp, obj.get_key().to_str(), bl);
+     store->get_obj_meta_cache()->put(dpp, obj.get_key().get_oid(), bl);
  
 +  if (old_obj.get_bucket()->get_info().versioning_status() != BUCKET_VERSIONED) {
 +    // Delete old object data if exists.
 +    old_obj.delete_mobj(dpp);
 +  }
 +
 +  // TODO: We need to handle the object leak caused by parallel object upload by
 +  // making use of background gc, which is currently not enabled for motr.
    return rc;
  }
  
@@@ -2548,11 -2205,15 +2536,11 @@@ int MotrMultipartUpload::abort(const Do
    if (rc < 0)
      return rc;
  
 +  bl.clear();
    // Remove the upload from bucket multipart index.
 -  bufferlist bl;
 -  std::unique_ptr<rgw::sal::Object> meta_obj;
 -  meta_obj = get_meta_obj();
 -  string bucket_multipart_iname =
 -      "motr.rgw.bucket." + meta_obj->get_bucket()->get_name() + ".multiparts";
 -  return store->do_idx_op_by_name(bucket_multipart_iname,
 -                                  M0_IC_DEL, meta_obj->get_key().get_oid(), bl);
 -  return 0;
 +  rc = store->do_idx_op_by_name(bucket_multipart_iname,
-                                   M0_IC_DEL, meta_obj->get_key().to_str(), bl);
++                                M0_IC_DEL, meta_obj->get_key().get_oid(), bl);
 +  return rc;
  }
  
  std::unique_ptr<rgw::sal::Object> MotrMultipartUpload::get_meta_obj()
@@@ -2958,10 -2614,10 +2946,10 @@@ int MotrMultipartUpload::get_info(cons
    string bucket_multipart_iname =
        "motr.rgw.bucket." + meta_obj->get_bucket()->get_name() + ".multiparts";
    int rc = this->store->do_idx_op_by_name(bucket_multipart_iname,
-                                           M0_IC_GET, meta_obj->get_key().to_str(), bl);
+                                           M0_IC_GET, meta_obj->get_key().get_oid(), bl);
    if (rc < 0) {
 -    ldpp_dout(dpp, 0) << "Failed to get object's entry from bucket index. " << dendl;
 -    return rc;
 +    ldpp_dout(dpp, 0) << __func__ << ": Failed to get multipart info. rc=" << rc << dendl;
 +    return rc == -ENOENT ? -ERR_NO_SUCH_UPLOAD : rc;
    }
  
    rgw_bucket_dir_entry ent;
index 17f726117e132babb393de4b2b9838de17c65cc0,aab3873ce2e1ec995101e920df325b711c639485..bc276b892c3237f727727dfc04b025fb270305b0
@@@ -251,10 -196,9 +251,11 @@@ class MotrUser : public StoreUser 
      virtual int load_user(const DoutPrefixProvider* dpp, optional_yield y) override;
      virtual int store_user(const DoutPrefixProvider* dpp, optional_yield y, bool exclusive, RGWUserInfo* old_info = nullptr) override;
      virtual int remove_user(const DoutPrefixProvider* dpp, optional_yield y) override;
+     virtual int verify_mfa(const std::string& mfa_str, bool* verified, const DoutPrefixProvider* dpp, optional_yield y) override;
  
      int create_user_info_idx();
 +    int load_user_from_idx(const DoutPrefixProvider *dpp, MotrStore *store, RGWUserInfo& info, std::map<std::string, 
 +                              bufferlist> *attrs, RGWObjVersionTracker *objv_tr);
  
      friend class MotrBucket;
  };