rgw: guard RADOS-only code paths for the no-RADOS standalone build
Since the rgw-standalone-admin target landed (pr#68291, commit #77f6a3b4),
the default build (WITH_RADOSGW_POSIX=ON implies WITH_RADOSGW_STANDALONE=ON)
fails to link:
* undefined reference to `vtable for rgw::sal::RadosZone'
* undefined reference to `vtable for rgw::sal::RadosZoneGroup'
Build command used is the one with all the defaults turned ON, e.g.
`cmake ../../ceph -GNinja -DCMAKE_BUILD_TYPE={Debug|Release} && ninja`
```
$ cat CMakeCache.txt | grep RADOSGW
WITH_RADOSGW:BOOL=ON
WITH_RADOSGW_AMQP_ENDPOINT:BOOL=ON
WITH_RADOSGW_ARROW_FLIGHT:BOOL=OFF
WITH_RADOSGW_BACKTRACE_LOGGING:BOOL=OFF
WITH_RADOSGW_BEAST_OPENSSL:BOOL=ON
WITH_RADOSGW_D4N:BOOL=ON
WITH_RADOSGW_DAOS:BOOL=OFF
WITH_RADOSGW_DBSTORE:BOOL=ON
WITH_RADOSGW_FDB:BOOL=OFF
WITH_RADOSGW_KAFKA_ENDPOINT:BOOL=ON
WITH_RADOSGW_LUA_PACKAGES:BOOL=ON
WITH_RADOSGW_MOTR:BOOL=OFF
WITH_RADOSGW_POSIX:BOOL=ON
WITH_RADOSGW_RADOS:BOOL=ON
WITH_RADOSGW_SELECT_PARQUET:BOOL=ON
WITH_RADOSGW_STANDALONE:BOOL=ON
```
Re-running the build at git checkout 77f6a3b4~1 yields a successful build.
radosgw-admin.cc (and several sources in rgw_a_standalone) use the
concrete rgw::sal::RadosStore outside WITH_RADOSGW_RADOS guards. These
uses only compile in the -UWITH_RADOSGW_RADOS configuration because
rgw_sal_rados.h leaks in transitively (rgw_sync.h, rgw_data_sync.h,
rgw_frontend.h). The link then fails because the RADOS driver objects
that emit the vtables and out-of-line key functions for RadosZone /
RadosZoneGroup are deliberately not part of the standalone libraries.
Fix both sides of the problem:
* guard the concrete-RADOS uses in radosgw-admin.cc: get_remote_conn(),
the remote period commit lookup (which now returns -ENOTSUP with a
hint to use --url), the reshard max-shards check (its callers were
already guarded) and the sync-module tier-type validation (--tier-type
now returns EINVAL without the RADOS backend)
* guard the transitive routes to rgw_sal_rados.h: the rgw_sync.h /
rgw_data_sync.h includes in radosgw-admin.cc, the rgw_sal_rados.h
include in rgw_frontend.h (an over-include: the header uses no RADOS
type), and the rgw_rest_log.h include in rgw_appmain.cc (unused)
* provide a no-RADOS fallback for rest_filter() in rgw_main.h: sync
modules (and the complete RGWSyncModuleInstance type) are RADOS-only,
and the non-RADOS stores return a null sync module anyway
* guard the RADOS-only bodies of the metadata and zone-config admin REST
ops (-ENOTSUP). These handlers are only registered by
RadosStore::register_admin_apis(), so they are unreachable in the
standalone daemon; the guards are defensive
* guard the RadosLuaManager reload block in rgw_realm_reloader.cc; it
was already unreachable at runtime behind get_name() == "rados"
* include common/errno.h directly in driver/rados/rgw_bucket.cc, which
previously received cpp_strerror() transitively via rgw_sal_rados.h
All guards evaluate true when WITH_RADOSGW_RADOS is defined, so the
regular RADOS build preprocesses to identical code.
Note that before this change, the unguarded static_cast<RadosStore*>
paths would have been undefined behavior at runtime if reached with a
non-RADOS driver; they now fail cleanly with an error message.
Fixes: https://tracker.ceph.com/issues/XXXXX
Signed-off-by: Jusufadis Bakamovic <jusufadis.bakamovic@clyso.com> J
Jusufadis Bakamovic committed
b182a74c7e3f2222f8910d487d10d09f839808f4
Parent: 54561d4