diff options
author | Casey Bodley <cbodley@redhat.com> | 2023-05-30 19:56:25 +0200 |
---|---|---|
committer | Casey Bodley <cbodley@redhat.com> | 2023-08-03 22:56:49 +0200 |
commit | e90bfba99ce4318cbb72277bee698c3138452657 (patch) | |
tree | 3c24a8f08766902d77c9334c8cae774d92cb2994 /src/rgw/rgw_admin.cc | |
parent | rgw: RGWRados::set_attrs() takes optional mtime (diff) | |
download | ceph-e90bfba99ce4318cbb72277bee698c3138452657.tar.xz ceph-e90bfba99ce4318cbb72277bee698c3138452657.zip |
radosgw-admin: add command to resync encrypted multipart objects
Signed-off-by: Casey Bodley <cbodley@redhat.com>
Diffstat (limited to 'src/rgw/rgw_admin.cc')
-rw-r--r-- | src/rgw/rgw_admin.cc | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index dfbd4a8ef8d..15bdaba87a5 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -674,6 +674,7 @@ enum class OPT { BUCKET_RADOS_LIST, BUCKET_SHARD_OBJECTS, BUCKET_OBJECT_SHARD, + BUCKET_RESYNC_ENCRYPTED_MULTIPART, POLICY, POOL_ADD, POOL_RM, @@ -894,6 +895,7 @@ static SimpleCmd::Commands all_cmds = { { "bucket shard objects", OPT::BUCKET_SHARD_OBJECTS }, { "bucket shard object", OPT::BUCKET_SHARD_OBJECTS }, { "bucket object shard", OPT::BUCKET_OBJECT_SHARD }, + { "bucket resync encrypted multipart", OPT::BUCKET_RESYNC_ENCRYPTED_MULTIPART }, { "policy", OPT::POLICY }, { "pool add", OPT::POOL_ADD }, { "pool rm", OPT::POOL_RM }, @@ -7182,6 +7184,47 @@ int main(int argc, const char **argv) formatter->flush(cout); } + if (opt_cmd == OPT::BUCKET_RESYNC_ENCRYPTED_MULTIPART) { + // repair logic for replication of encrypted multipart uploads: + // https://tracker.ceph.com/issues/46062 + if (bucket_name.empty()) { + cerr << "ERROR: bucket not specified" << std::endl; + return EINVAL; + } + int ret = init_bucket(user.get(), tenant, bucket_name, bucket_id, &bucket); + if (ret < 0) { + return -ret; + } + + auto rados_driver = dynamic_cast<rgw::sal::RadosStore*>(driver); + if (!rados_driver) { + cerr << "ERROR: this command can only work when the cluster " + "has a RADOS backing store." << std::endl; + return EPERM; + } + + // fail if recovery wouldn't generate replication log entries + if (!rados_driver->svc()->zone->need_to_log_data() && !yes_i_really_mean_it) { + cerr << "This command is only necessary for replicated buckets." << std::endl; + cerr << "do you really mean it? (requires --yes-i-really-mean-it)" << std::endl; + return EPERM; + } + + formatter->open_object_section("modified"); + encode_json("bucket", bucket->get_name(), formatter.get()); + encode_json("bucket_id", bucket->get_bucket_id(), formatter.get()); + + ret = rados_driver->getRados()->bucket_resync_encrypted_multipart( + dpp(), null_yield, rados_driver, bucket->get_info(), + marker, stream_flusher); + if (ret < 0) { + return -ret; + } + formatter->close_section(); + formatter->flush(cout); + return 0; + } + if (opt_cmd == OPT::BUCKET_CHOWN) { if (bucket_name.empty()) { cerr << "ERROR: bucket name not specified" << std::endl; |