]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fixes following rebase
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 20 Nov 2018 12:45:17 +0000 (04:45 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 11 Dec 2018 09:00:21 +0000 (01:00 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_admin.cc
src/rgw/rgw_cr_tools.cc
src/rgw/rgw_pubsub.cc
src/rgw/rgw_pubsub.h
src/rgw/rgw_sync_module_pubsub.cc
src/rgw/rgw_sync_module_pubsub_rest.cc
src/rgw/rgw_tools.cc
src/rgw/rgw_tools.h
src/rgw/rgw_zone.h
src/rgw/services/svc_zone.cc
src/rgw/services/svc_zone.h

index b028acffab545c8deeefe7c4715f9b5db856fd68..ff8bd0ebeb8978b9c2497c524a4f922a560e0873 100644 (file)
@@ -2691,11 +2691,11 @@ static int trim_sync_error_log(int shard_id, const ceph::real_time& start_time,
 }
 
 JSONFormattable& get_tier_config(RGWRados *store) {
-  return store->get_zone_params().tier_config;
+  return store->svc.zone->get_zone_params().tier_config;
 }
 
 const string& get_tier_type(RGWRados *store) {
-  return store->get_zone().tier_type;
+  return store->svc.zone->get_zone().tier_type;
 }
 
 int main(int argc, const char **argv)
index d25c3166caf5ce855a387c2d8f5e932f1a687dd2..c13521835dcb27bfd9e04f2dd420b3bb04fdec91 100644 (file)
@@ -5,6 +5,7 @@
 #include "rgw_user.h"
 #include "rgw_op.h"
 #include "rgw_acl_s3.h"
+#include "rgw_zone.h"
 
 #define dout_context g_ceph_context
 #define dout_subsys ceph_subsys_rgw
@@ -92,7 +93,7 @@ int RGWGetUserInfoCR::Request::_send_request()
 template<>
 int RGWGetBucketInfoCR::Request::_send_request()
 {
-  RGWObjectCtx obj_ctx(store);
+  RGWSysObjectCtx obj_ctx(store->svc.sysobj->init_obj_ctx());
   return store->get_bucket_info(obj_ctx, params.tenant, params.bucket_name,
                                 result->bucket_info, &result->mtime, &result->attrs);
 }
@@ -101,29 +102,31 @@ template<>
 int RGWBucketCreateLocalCR::Request::_send_request()
 {
   CephContext *cct = store->ctx();
+  auto& zone_svc = store->svc.zone;
+  auto& sysobj_svc = store->svc.sysobj;
 
   const auto& user_info = params.user_info.get();
   const auto& user = user_info->user_id;
   const auto& bucket_name = params.bucket_name;
   auto& placement_rule = params.placement_rule;
 
-  const auto& zonegroup = store->get_zonegroup();
+  const auto& zonegroup = zone_svc->get_zonegroup();
 
   if (!placement_rule.empty() &&
       !zonegroup.placement_targets.count(placement_rule)) {
     ldout(cct, 0) << "placement target (" << placement_rule << ")"
       << " doesn't exist in the placement targets of zonegroup"
-      << " (" << store->get_zonegroup().api_name << ")" << dendl;
+      << " (" << zone_svc->get_zonegroup().api_name << ")" << dendl;
     return -ERR_INVALID_LOCATION_CONSTRAINT;
   }
 
   /* we need to make sure we read bucket info, it's not read before for this
    * specific request */
-  RGWObjectCtx obj_ctx(store);
+  RGWSysObjectCtx sysobj_ctx(sysobj_svc->init_obj_ctx());
   RGWBucketInfo bucket_info;
   map<string, bufferlist> bucket_attrs;
 
-  int ret = store->get_bucket_info(obj_ctx, user.tenant, bucket_name,
+  int ret = store->get_bucket_info(sysobj_ctx, user.tenant, bucket_name,
                                  bucket_info, nullptr, &bucket_attrs);
   if (ret < 0 && ret != -ENOENT)
     return ret;
@@ -148,14 +151,14 @@ int RGWBucketCreateLocalCR::Request::_send_request()
   uint32_t *pmaster_num_shards = nullptr;
   real_time creation_time;
 
-  string zonegroup_id = store->get_zonegroup().get_id();
+  string zonegroup_id = zone_svc->get_zonegroup().get_id();
 
   if (bucket_exists) {
     string selected_placement_rule;
     rgw_bucket bucket;
     bucket.tenant = user.tenant;
     bucket.name = bucket_name;
-    ret = store->select_bucket_placement(*user_info, zonegroup_id,
+    ret = zone_svc->select_bucket_placement(*user_info, zonegroup_id,
                                          placement_rule,
                                          &selected_placement_rule, nullptr);
     if (selected_placement_rule != bucket_info.placement_rule) {
index e7e4fa09338a2b966d23655e5121daaf8f48d721..32d4261ba5ccbc1eedf3668a4afb9206b7221afd 100644 (file)
@@ -407,7 +407,7 @@ int RGWUserPubSub::Sub::list_events(const string& marker, int max_events,
 
   RGWBucketInfo bucket_info;
   string tenant;
-  RGWObjectCtx obj_ctx(store);
+  RGWSysObjectCtx obj_ctx(store->svc.sysobj->init_obj_ctx());
   ret = store->get_bucket_info(obj_ctx, tenant, sub_conf.dest.bucket_name, bucket_info, nullptr, nullptr);
   if (ret == -ENOENT) {
     result->is_truncated = false;
@@ -472,8 +472,8 @@ int RGWUserPubSub::Sub::remove_event(const string& event_id)
 
   RGWBucketInfo bucket_info;
   string tenant;
-  RGWObjectCtx obj_ctx(store);
-  ret = store->get_bucket_info(obj_ctx, tenant, sub_conf.dest.bucket_name, bucket_info, nullptr, nullptr);
+  RGWSysObjectCtx sysobj_ctx(store->svc.sysobj->init_obj_ctx());
+  ret = store->get_bucket_info(sysobj_ctx, tenant, sub_conf.dest.bucket_name, bucket_info, nullptr, nullptr);
   if (ret < 0) {
     ldout(store->ctx(), 0) << "ERROR: failed to read bucket info for events bucket: bucket=" << sub_conf.dest.bucket_name << " ret=" << ret << dendl;
     return ret;
@@ -481,9 +481,10 @@ int RGWUserPubSub::Sub::remove_event(const string& event_id)
 
   rgw_bucket& bucket = bucket_info.bucket;
 
+  RGWObjectCtx obj_ctx(store);
   rgw_obj obj(bucket, event_id);
 
-  obj_ctx.obj.set_atomic(obj);
+  obj_ctx.set_atomic(obj);
 
   RGWRados::Object del_target(store, bucket_info, obj_ctx, obj);
   RGWRados::Object::Delete del_op(&del_target);
index 9f12cf1f7e06cd4f41f33e9e0b4e043c08dafa5a..2c62af19f96c2f069cc1bfe44bd6fbb50b658707 100644 (file)
@@ -3,6 +3,9 @@
 
 #include "rgw_common.h"
 #include "rgw_tools.h"
+#include "rgw_zone.h"
+
+#include "services/svc_sys_obj.h"
 
 
 struct rgw_pubsub_event {
@@ -209,7 +212,7 @@ class RGWUserPubSub
 
   RGWRados *store;
   rgw_user user;
-  RGWObjectCtx obj_ctx;
+  RGWSysObjectCtx obj_ctx;
 
   rgw_raw_obj user_meta_obj;
 
@@ -238,7 +241,7 @@ class RGWUserPubSub
 public:
   RGWUserPubSub(RGWRados *_store, const rgw_user& _user) : store(_store),
                                                            user(_user),
-                                                           obj_ctx(store) {
+                                                           obj_ctx(store->svc.sysobj->init_obj_ctx()) {
     get_user_meta_obj(&user_meta_obj);
   }
 
@@ -302,15 +305,15 @@ public:
   }
 
   void get_user_meta_obj(rgw_raw_obj *obj) const {
-    *obj = rgw_raw_obj(store->get_zone_params().log_pool, user_meta_oid());
+    *obj = rgw_raw_obj(store->svc.zone->get_zone_params().log_pool, user_meta_oid());
   }
 
   void get_bucket_meta_obj(const rgw_bucket& bucket, rgw_raw_obj *obj) const {
-    *obj = rgw_raw_obj(store->get_zone_params().log_pool, bucket_meta_oid(bucket));
+    *obj = rgw_raw_obj(store->svc.zone->get_zone_params().log_pool, bucket_meta_oid(bucket));
   }
 
   void get_sub_meta_obj(const string& name, rgw_raw_obj *obj) const {
-    *obj = rgw_raw_obj(store->get_zone_params().log_pool, sub_meta_oid(name));
+    *obj = rgw_raw_obj(store->svc.zone->get_zone_params().log_pool, sub_meta_oid(name));
   }
 
   int get_user_topics(rgw_pubsub_user_topics *result);
index c0dba42455a8a886ee18f215544b6561cf888e8f..7b8be230bb742e615b7e1ef594f1308cee9a174c 100644 (file)
@@ -720,7 +720,7 @@ class PSSubscription {
               string addr;
               if (split_endpoint(sub_conf->push_endpoint, &addr, &sub->push.path)) {
                 list<string> endpoints{addr};
-                sub->push.conn = std::make_shared<RGWRESTConn>(sync_env->cct, sync_env->store, remote_id, endpoints);
+                sub->push.conn = std::make_shared<RGWRESTConn>(sync_env->cct, sync_env->store->svc.zone, remote_id, endpoints);
               } else {
                 ldout(sync_env->cct, 20) << "failed to split push endpoint: " << sub_conf->push_endpoint << dendl;
               }
@@ -917,7 +917,7 @@ class PSManager
             rgw_raw_obj obj;
             ups.get_sub_meta_obj(sub_name, &obj);
             bool empty_on_enoent = false;
-            call(new ReadInfoCR(sync_env->async_rados, sync_env->store,
+            call(new ReadInfoCR(sync_env->async_rados, sync_env->store->svc.sysobj,
                                 obj,
                                 &user_sub_conf, empty_on_enoent));
           }
@@ -1098,7 +1098,7 @@ public:
       using ReadInfoCR = RGWSimpleRadosReadCR<rgw_pubsub_bucket_topics>;
       yield {
         bool empty_on_enoent = true;
-        call(new ReadInfoCR(sync_env->async_rados, sync_env->store,
+        call(new ReadInfoCR(sync_env->async_rados, sync_env->store->svc.sysobj,
                             bucket_obj,
                             &bucket_topics, empty_on_enoent));
       }
@@ -1112,7 +1112,7 @@ public:
        using ReadUserTopicsInfoCR = RGWSimpleRadosReadCR<rgw_pubsub_user_topics>;
        yield {
          bool empty_on_enoent = true;
-         call(new ReadUserTopicsInfoCR(sync_env->async_rados, sync_env->store,
+         call(new ReadUserTopicsInfoCR(sync_env->async_rados, sync_env->store->svc.sysobj,
                                        user_obj,
                                        &user_topics, empty_on_enoent));
        }
@@ -1388,7 +1388,7 @@ public:
 
   void init(RGWDataSyncEnv *sync_env, uint64_t instance_id) override {
     PSManagerRef mgr = PSManager::get_shared(sync_env, env);
-    env->init_instance(sync_env->store->get_realm(), instance_id, mgr);
+    env->init_instance(sync_env->store->svc.zone->get_realm(), instance_id, mgr);
   }
 
   RGWCoroutine *start_sync(RGWDataSyncEnv *sync_env) override {
index d8106df69b5d392217fa51605c80ecb372ff458d..960bf5b4c04dbd8282ec09a1e1031bdd53462795 100644 (file)
@@ -650,9 +650,7 @@ public:
       return ret;
     }
 
-    RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
-
-    ret = store->get_bucket_info(obj_ctx, s->owner.get_id().tenant, bucket_name,
+    ret = store->get_bucket_info(*s->sysobj_ctx, s->owner.get_id().tenant, bucket_name,
                                  bucket_info, nullptr, nullptr);
     if (ret < 0) {
       return ret;
@@ -727,9 +725,7 @@ public:
       return ret;
     }
 
-    RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
-
-    ret = store->get_bucket_info(obj_ctx, s->owner.get_id().tenant, bucket_name,
+    ret = store->get_bucket_info(*s->sysobj_ctx, s->owner.get_id().tenant, bucket_name,
                                  bucket_info, nullptr, nullptr);
     if (ret < 0) {
       return ret;
@@ -800,9 +796,7 @@ public:
       return ret;
     }
 
-    RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
-
-    ret = store->get_bucket_info(obj_ctx, s->owner.get_id().tenant, bucket_name,
+    ret = store->get_bucket_info(*s->sysobj_ctx, s->owner.get_id().tenant, bucket_name,
                                  bucket_info, nullptr, nullptr);
     if (ret < 0) {
       return ret;
index ac6b744e4ced818f59500025361960a0bcfde6aa..a9b934a02bd0c30a665d641a6a69d5e423cb51a5 100644 (file)
 #include "rgw_putobj_processor.h"
 #include "rgw_aio_throttle.h"
 #include "rgw_compression.h"
+#include "rgw_zone.h"
 
 #include "services/svc_sys_obj.h"
+#include "services/svc_zone_utils.h"
 
 #define dout_subsys ceph_subsys_rgw
 #define dout_context g_ceph_context
@@ -277,7 +279,7 @@ void rgw_filter_attrset(map<string, bufferlist>& unfiltered_attrset, const strin
 
 RGWDataAccess::RGWDataAccess(RGWRados *_store) : store(_store)
 {
-  obj_ctx = std::make_unique<RGWObjectCtx>(store);
+  sysobj_ctx = std::make_unique<RGWSysObjectCtx>(store->svc.sysobj->init_obj_ctx());
 }
 
 
@@ -300,7 +302,7 @@ int RGWDataAccess::Bucket::finish_init()
 
 int RGWDataAccess::Bucket::init()
 {
-  int ret = sd->store->get_bucket_info(*sd->obj_ctx,
+  int ret = sd->store->get_bucket_info(*sd->sysobj_ctx,
                                       tenant, name,
                                       bucket_info,
                                       &mtime,
@@ -346,7 +348,7 @@ int RGWDataAccess::Object::put(bufferlist& data,
 
   auto& owner = bucket->policy.get_owner();
 
-  string req_id = store->unique_id(store->get_new_req_id());
+  string req_id = store->svc.zone_utils->unique_id(store->get_new_req_id());
 
   AtomicObjectProcessor processor(&aio, store, bucket_info,
                                   owner.get_id(),
@@ -363,7 +365,7 @@ int RGWDataAccess::Object::put(bufferlist& data,
   CompressorRef plugin;
   boost::optional<RGWPutObj_Compress> compressor;
 
-  const auto& compression_type = store->get_zone_params().get_compression_type(bucket_info.placement_rule);
+  const auto& compression_type = store->svc.zone->get_zone_params().get_compression_type(bucket_info.placement_rule);
   if (compression_type != "none") {
     plugin = Compressor::create(store->ctx(), compression_type);
     if (!plugin) {
@@ -442,6 +444,8 @@ int RGWDataAccess::Object::put(bufferlist& data,
 void RGWDataAccess::Object::set_policy(const RGWAccessControlPolicy& policy)
 {
   policy.encode(aclbl.emplace());
+}
+
 int rgw_tools_init(CephContext *cct)
 {
   ext_mime_map = new std::map<std::string, std::string>;
index 1ca2452a6f17cc53ece6c7f6118d9b1584e05a42..b77e99c4f679a147cfc5915b8d2ab6004dc3da72 100644 (file)
@@ -85,7 +85,7 @@ using RGWMD5Etag = RGWEtag<MD5, CEPH_CRYPTO_MD5_DIGESTSIZE>;
 class RGWDataAccess
 {
   RGWRados *store;
-  std::unique_ptr<RGWObjectCtx> obj_ctx;
+  std::unique_ptr<RGWSysObjectCtx> sysobj_ctx;
 
 public:
   RGWDataAccess(RGWRados *_store);
index f982915382ceb099cfc61dc1d294608ecf90141b..caedfb3146d79627de858569c2c66c61180c5270 100644 (file)
@@ -488,7 +488,7 @@ struct RGWZoneGroupPlacementTarget {
   std::string name;
   set<std::string> tags;
 
-  bool user_permitted(list<std::string>& user_tags) const {
+  bool user_permitted(const list<std::string>& user_tags) const {
     if (tags.empty()) {
       return true;
     }
index 614f11d0b9ad54fe86b543a80bfdefcfdc79de87..13dbdd2a0e1e699fe13c70117bcbd52dbfd7fe7f 100644 (file)
@@ -937,7 +937,7 @@ bool RGWSI_Zone::is_syncing_bucket_meta(const rgw_bucket& bucket)
 }
 
 
-int RGWSI_Zone::select_new_bucket_location(RGWUserInfo& user_info, const string& zonegroup_id, const string& request_rule,
+int RGWSI_Zone::select_new_bucket_location(const RGWUserInfo& user_info, const string& zonegroup_id, const string& request_rule,
                                          string *pselected_rule_name, RGWZonePlacementInfo *rule_info)
 
 {
@@ -1035,7 +1035,7 @@ int RGWSI_Zone::select_bucket_location_by_rule(const string& location_rule, RGWZ
   return 0;
 }
 
-int RGWSI_Zone::select_bucket_placement(RGWUserInfo& user_info, const string& zonegroup_id, const string& placement_rule,
+int RGWSI_Zone::select_bucket_placement(const RGWUserInfo& user_info, const string& zonegroup_id, const string& placement_rule,
                                       string *pselected_rule_name, RGWZonePlacementInfo *rule_info)
 {
   if (!get_zone_params().placement_pools.empty()) {
index fd9ec109b91aa696ee67525aedd5b5c21172db35..469f7f631e2ff3907361cfdc0ff6c19564d07178 100644 (file)
@@ -103,10 +103,10 @@ public:
   RGWRESTConn *get_zone_conn_by_name(const string& name);
   bool find_zone_id_by_name(const string& name, string *id);
 
-  int select_bucket_placement(RGWUserInfo& user_info, const string& zonegroup_id, const string& rule,
+  int select_bucket_placement(const RGWUserInfo& user_info, const string& zonegroup_id, const string& rule,
                               string *pselected_rule_name, RGWZonePlacementInfo *rule_info);
   int select_legacy_bucket_placement(RGWZonePlacementInfo *rule_info);
-  int select_new_bucket_location(RGWUserInfo& user_info, const string& zonegroup_id, const string& rule,
+  int select_new_bucket_location(const RGWUserInfo& user_info, const string& zonegroup_id, const string& rule,
                                  string *pselected_rule_name, RGWZonePlacementInfo *rule_info);
   int select_bucket_location_by_rule(const string& location_rule, RGWZonePlacementInfo *rule_info);