`radosgw-admin` provides it when the `--extra-info` option is provided.
It gets stashed in the SyncEnv for later use.
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
auto sync = RGWBucketPipeSyncStatusManager::construct(
dpp(), static_cast<rgw::sal::RadosStore*>(store), source_zone, opt_sb,
- bucket->get_key());
+ bucket->get_key(), extra_info ? &std::cout : nullptr);
if (!sync) {
cerr << "ERROR: sync.init() returned error=" << sync.error() << std::endl;
}
auto sync = RGWBucketPipeSyncStatusManager::construct(
dpp(), static_cast<rgw::sal::RadosStore*>(store), source_zone,
- opt_source_bucket, bucket->get_key());
+ opt_source_bucket, bucket->get_key(), nullptr);
if (!sync) {
cerr << "ERROR: sync.init() returned error=" << sync.error() << std::endl;
}
auto sync = RGWBucketPipeSyncStatusManager::construct(
dpp(), static_cast<rgw::sal::RadosStore*>(store), source_zone,
- opt_source_bucket, bucket->get_key());
+ opt_source_bucket, bucket->get_key(), extra_info ? &std::cout : nullptr);
if (!sync) {
cerr << "ERROR: sync.init() returned error=" << sync.error() << std::endl;
return 0;
}
-int RGWBucketPipeSyncStatusManager::do_init(const DoutPrefixProvider *dpp)
+int RGWBucketPipeSyncStatusManager::do_init(const DoutPrefixProvider *dpp,
+ std::ostream* ostr)
{
int ret = http_manager.start();
if (ret < 0) {
error_logger.get(), store->getRados()->get_sync_tracer(),
sync_module, nullptr);
+ sync_env.ostr = ostr;
+
rgw_sync_pipe_info_set pipes;
ret = cr_mgr.run(dpp, new RGWGetBucketPeersCR(&sync_env,
rgw::sal::RadosStore* store,
std::optional<rgw_zone_id> source_zone,
std::optional<rgw_bucket> source_bucket,
- const rgw_bucket& dest_bucket)
+ const rgw_bucket& dest_bucket,
+ std::ostream* ostr)
{
std::unique_ptr<RGWBucketPipeSyncStatusManager> self{
new RGWBucketPipeSyncStatusManager(store, source_zone, source_bucket,
dest_bucket)};
- auto r = self->do_init(dpp);
+ auto r = self->do_init(dpp, ostr);
if (r < 0) {
return tl::unexpected(r);
}
#include "include/encoding.h"
#include "common/ceph_json.h"
+#include "common/likely.h"
#include "rgw_coroutine.h"
#include "rgw_http_client.h"
std::string shard_obj_name(int shard_id);
std::string status_oid();
+
+ std::ostream* ostr{nullptr}; // For pretty printing progress
};
+// pretty ostream output for `radosgw-admin bucket sync run`
+template<typename ...T>
+void pretty_print(const RGWDataSyncEnv* env, T&& ...t) {
+ if (unlikely(!!env->ostr)) {
+ fmt::print(*env->ostr, std::forward<T>(t)...);
+ env->ostr->flush();
+ }
+}
+
struct RGWDataSyncCtx {
RGWDataSyncEnv *env{nullptr};
CephContext *cct{nullptr};
};
std::vector<source> sources;
- int do_init(const DoutPrefixProvider *dpp);
+ int do_init(const DoutPrefixProvider *dpp, std::ostream* ostr);
RGWBucketPipeSyncStatusManager(rgw::sal::RadosStore* store,
std::optional<rgw_zone_id> source_zone,
std::optional<rgw_bucket> source_bucket,
construct(const DoutPrefixProvider* dpp, rgw::sal::RadosStore* store,
std::optional<rgw_zone_id> source_zone,
std::optional<rgw_bucket> source_bucket,
- const rgw_bucket& dest_bucket);
+ const rgw_bucket& dest_bucket, std::ostream *ostream);
~RGWBucketPipeSyncStatusManager() = default;