From 31252a7818c25c4b1c9b7cc6f8d623437628fc6c Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Wed, 15 Jun 2022 19:39:59 -0400 Subject: [PATCH] rgw: radosgw-admin includes current time in most status commands Support folk have asked if we can have a timestamp on the output of multisite status commands so they can see at a glance how they relate to other events and changes. As such, we now have a status command added to any outputs where it doesn't disrupt things. In practice this means anything whose output isn't a single JSON array. Signed-off-by: Adam C. Emerson --- src/rgw/rgw_admin.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 5e1851b4ace5f..6497b00aefd95 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -2447,6 +2447,8 @@ static void sync_status(Formatter *formatter) cout << std::setw(width) << "realm" << std::setw(1) << " " << zone->get_realm_id() << " (" << zone->get_realm_name() << ")" << std::endl; cout << std::setw(width) << "zonegroup" << std::setw(1) << " " << zonegroup.get_id() << " (" << zonegroup.get_name() << ")" << std::endl; cout << std::setw(width) << "zone" << std::setw(1) << " " << zone->get_id() << " (" << zone->get_name() << ")" << std::endl; + cout << std::setw(width) << "current time" << std::setw(1) << " " + << to_iso_8601(ceph::real_clock::now(), iso_8601_format::YMDhms) << std::endl; const auto& rzg = static_cast(zonegroup).get_group(); @@ -2836,7 +2838,10 @@ static int bucket_sync_status(rgw::sal::RadosStore* store, const RGWBucketInfo& out << indented{width, "realm"} << zone->get_realm_id() << " (" << zone->get_realm_name() << ")\n"; out << indented{width, "zonegroup"} << zonegroup.get_id() << " (" << zonegroup.get_name() << ")\n"; out << indented{width, "zone"} << zone->get_id() << " (" << zone->get_name() << ")\n"; - out << indented{width, "bucket"} << info.bucket << "\n\n"; + out << indented{width, "bucket"} << info.bucket << "\n"; + out << indented{width, "current time"} + << to_iso_8601(ceph::real_clock::now(), iso_8601_format::YMDhms) << "\n\n"; + if (!static_cast(store)->ctl()->bucket->bucket_imports_data(info.bucket, null_yield, dpp())) { out << "Sync is disabled for bucket " << info.bucket.name << " or bucket has no sync sources" << std::endl; @@ -8736,6 +8741,9 @@ next: encode_json("total", full_total, formatter.get()); encode_json("complete", full_complete, formatter.get()); formatter->close_section(); + formatter->dump_string("current_time", + to_iso_8601(ceph::real_clock::now(), + iso_8601_format::YMDhms)); formatter->close_section(); formatter->flush(cout); @@ -8803,6 +8811,9 @@ next: encode_json("marker", sync_marker, formatter.get()); encode_json("pending_buckets", pending_buckets, formatter.get()); encode_json("recovering_buckets", recovering_buckets, formatter.get()); + formatter->dump_string("current_time", + to_iso_8601(ceph::real_clock::now(), + iso_8601_format::YMDhms)); formatter->close_section(); formatter->flush(cout); } else { @@ -8831,6 +8842,9 @@ next: encode_json("total", full_total, formatter.get()); encode_json("complete", full_complete, formatter.get()); formatter->close_section(); + formatter->dump_string("current_time", + to_iso_8601(ceph::real_clock::now(), + iso_8601_format::YMDhms)); formatter->close_section(); formatter->flush(cout); @@ -9626,6 +9640,9 @@ next: } formatter->open_object_section("entries"); encode_json("markers", markers, formatter.get()); + formatter->dump_string("current_time", + to_iso_8601(ceph::real_clock::now(), + iso_8601_format::YMDhms)); formatter->close_section(); formatter->flush(cout); } -- 2.39.5