]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/gc: Check for RadosStore for `radosgw-admin gc` command 50859/head
authorSoumya Koduri <skoduri@redhat.com>
Tue, 4 Apr 2023 05:19:08 +0000 (10:49 +0530)
committerSoumya Koduri <skoduri@redhat.com>
Tue, 4 Apr 2023 17:15:27 +0000 (22:45 +0530)
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
src/rgw/rgw_admin.cc

index 8a1a68a376a5762ef67bbb9cedd381f3d579da67..f8a68fa0d30059a1a401b6f06ad1cfaab3dcdadc 100644 (file)
@@ -8362,7 +8362,16 @@ next:
   }
 
   if (opt_cmd == OPT::GC_PROCESS) {
-    int ret = static_cast<rgw::sal::RadosStore*>(driver)->getRados()->process_gc(!include_all);
+    rgw::sal::RadosStore* rados_store = dynamic_cast<rgw::sal::RadosStore*>(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;