]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw-admin: fix bucket sync markers for non-trivial case
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 21 Jan 2020 01:45:02 +0000 (17:45 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 28 Jan 2020 18:20:40 +0000 (10:20 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_admin.cc
src/rgw/rgw_bucket_sync.h
src/rgw/rgw_data_sync.cc

index 0fdb6e5976cf325b3ea3a101c9f31927d53e14b4..2ec0648e6b466e42e53156e7f049879918edb5be 100644 (file)
@@ -2256,7 +2256,7 @@ static int remote_bilog_markers(rgw::sal::RGWRadosStore *store, const RGWZone& s
 static int bucket_source_sync_status(rgw::sal::RGWRadosStore *store, const RGWZone& zone,
                                      const RGWZone& source, RGWRESTConn *conn,
                                      const RGWBucketInfo& bucket_info,
-                                     const rgw_sync_bucket_pipe& pipe,
+                                     rgw_sync_bucket_pipe pipe,
                                      int width, std::ostream& out)
 {
   out << indented{width, "source zone"} << source.id << " (" << source.name << ")" << std::endl;
@@ -2280,6 +2280,9 @@ static int bucket_source_sync_status(rgw::sal::RGWRadosStore *store, const RGWZo
     return r;
   }
 
+  pipe.source.bucket = source_bucket;
+  pipe.dest.bucket = bucket_info.bucket;
+
   std::vector<rgw_bucket_shard_sync_info> status;
   r = rgw_bucket_sync_status(dpp(), store, pipe, bucket_info, &source_bucket_info, &status);
   if (r < 0) {
@@ -7829,7 +7832,18 @@ next:
     if (ret < 0) {
       return -ret;
     }
-    RGWBucketPipeSyncStatusManager sync(store, source_zone, opt_source_bucket, bucket);
+    auto opt_sb = opt_source_bucket;
+    if (opt_sb && opt_sb->bucket_id.empty()) {
+      string sbid;
+      rgw_bucket sbuck;
+      int ret = init_bucket_for_sync(opt_sb->tenant, opt_sb->name, sbid, sbuck);
+      if (ret < 0) {
+        return -ret;
+      }
+      opt_sb = sbuck;
+    }
+
+    RGWBucketPipeSyncStatusManager sync(store, source_zone, opt_sb, bucket);
 
     ret = sync.init();
     if (ret < 0) {
index f6a19261eba5cfc3a03f3278bd44646b2abf0435..8ded9d6237953a58c858bce98849f79a51e700eb 100644 (file)
@@ -309,7 +309,7 @@ class RGWBucketSyncPolicyHandler {
   }
 
   bool bucket_is_sync_target() const {
-    return !sources.empty();
+    return !sources.empty() || !resolved_sources.empty();
   }
 
   RGWBucketSyncPolicyHandler(const RGWBucketSyncPolicyHandler *_parent,
index adfc6babc2e4bd9dd0d35589de764233676a9048..2ed80cd87918d9e2b1edb2491eaa18a2d6c76b32 100644 (file)
@@ -4707,7 +4707,7 @@ int RGWBucketPipeSyncStatusManager::init()
   ret = cr_mgr.run(new RGWGetBucketPeersCR(&sync_env,
                                            dest_bucket,
                                            source_zone,
-                                           std::nullopt,
+                                           source_bucket,
                                            &pipes,
                                            sync_env.sync_tracer->root_node));
   if (ret < 0) {