From: Soumya Koduri Date: Tue, 4 Apr 2023 05:19:08 +0000 (+0530) Subject: rgw/gc: Check for RadosStore for `radosgw-admin gc` command X-Git-Tag: v19.0.0~1435^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F50859%2Fhead;p=ceph.git rgw/gc: Check for RadosStore for `radosgw-admin gc` command Signed-off-by: Soumya Koduri --- 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;