From 1103966d8184a84d6b0361f6c92ad1535f137ca9 Mon Sep 17 00:00:00 2001 From: Soumya Koduri Date: Tue, 4 Apr 2023 10:49:08 +0530 Subject: [PATCH] rgw/gc: Check for RadosStore for `radosgw-admin gc` command Signed-off-by: Soumya Koduri --- src/rgw/rgw_admin.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 8a1a68a376a5..f8a68fa0d300 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -8362,7 +8362,16 @@ next: } if (opt_cmd == OPT::GC_PROCESS) { - int ret = static_cast(driver)->getRados()->process_gc(!include_all); + rgw::sal::RadosStore* rados_store = dynamic_cast(driver); + if (!rados_store) { + cerr << + "WARNING: this command can only work when the cluster has a RADOS backing store." << + std::endl; + return 0; + } + RGWRados* store = rados_store->getRados(); + + int ret = store->process_gc(!include_all); if (ret < 0) { cerr << "ERROR: gc processing returned error: " << cpp_strerror(-ret) << std::endl; return 1; -- 2.47.3