private:
RGWRados* rados;
RGWUserCtl* user_ctl;
- std::string luarocks_path;
std::unique_ptr<RadosZone> zone;
public:
virtual CephContext* ctx(void) override { return rados->ctx(); }
- virtual const std::string& get_luarocks_path() const override {
- return luarocks_path;
- }
-
- virtual void set_luarocks_path(const std::string& path) override {
- luarocks_path = path;
- }
virtual void register_admin_apis(RGWRESTMgr* mgr) override;
/* Unique to RadosStore */
{
rgw::sal::Driver* driver = env.driver;
int r{0};
- const auto &luarocks_path =
- g_conf().get_val<std::string>("rgw_luarocks_location");
- if (luarocks_path.empty()) {
- driver->set_luarocks_path("");
- } else {
- driver->set_luarocks_path(luarocks_path + "/" + g_conf()->name.to_str());
+ std::string path = g_conf().get_val<std::string>("rgw_luarocks_location");
+ if (!path.empty()) {
+ path += "/" + g_conf()->name.to_str();
}
+ env.lua.luarocks_path = path;
+
#ifdef WITH_RADOSGW_LUA_PACKAGES
rgw::lua::packages_t failed_packages;
std::string output;
- r = rgw::lua::install_packages(dpp, driver, null_yield, failed_packages,
- output);
+ r = rgw::lua::install_packages(dpp, driver, null_yield, path,
+ failed_packages, output);
if (r < 0) {
dout(1) << "WARNING: failed to install lua packages from allowlist"
<< dendl;
if (driver->get_name() == "rados") { /* Supported for only RadosStore */
lua_background = std::make_unique<
- rgw::lua::Background>(driver, dpp->get_cct(), driver->get_luarocks_path());
+ rgw::lua::Background>(driver, dpp->get_cct(), path);
lua_background->start();
env.lua.background = lua_background.get();
}
return lua_mgr->list_packages(dpp, y, packages);
}
-int install_packages(const DoutPrefixProvider *dpp, rgw::sal::Driver* driver, optional_yield y, packages_t& failed_packages, std::string& output) {
+int install_packages(const DoutPrefixProvider *dpp, rgw::sal::Driver* driver,
+ optional_yield y, const std::string& luarocks_path,
+ packages_t& failed_packages, std::string& output) {
// luarocks directory cleanup
std::error_code ec;
- const auto& luarocks_path = driver->get_luarocks_path();
if (std::filesystem::remove_all(luarocks_path, ec)
== static_cast<std::uintmax_t>(-1) &&
ec != std::errc::no_such_file_or_directory) {
// install all packages from the allowlist
// return the list of packages that failed to install and the output of the install command
-int install_packages(const DoutPrefixProvider *dpp, rgw::sal::Driver* driver, optional_yield y, packages_t& failed_packages, std::string& output);
+int install_packages(const DoutPrefixProvider *dpp, rgw::sal::Driver* driver,
+ optional_yield y, const std::string& luarocks_path,
+ packages_t& failed_packages, std::string& output);
#endif
}
lua_state_guard lguard(L);
open_standard_libs(L);
- set_package_path(L, driver ?
- driver->get_luarocks_path() :
- "");
+ set_package_path(L, s->penv.lua.luarocks_path);
create_debug_action(L, s->cct);
}
struct RGWLuaProcessEnv {
+ std::string luarocks_path;
rgw::lua::Background* background = nullptr;
std::unique_ptr<rgw::sal::LuaManager> manager;
};
/** Get the Ceph context associated with this driver. May be removed. */
virtual CephContext* ctx(void) = 0;
- /** Get the location of where lua packages are installed */
- virtual const std::string& get_luarocks_path() const = 0;
- /** Set the location of where lua packages are installed */
- virtual void set_luarocks_path(const std::string& path) = 0;
/** Register admin APIs unique to this driver */
virtual void register_admin_apis(RGWRESTMgr* mgr) = 0;
};
class DaosStore : public StoreDriver {
private:
- std::string luarocks_path;
DaosZone zone;
RGWSyncModuleInstanceRef sync_module;
virtual CephContext* ctx(void) override { return cctx; }
- virtual const std::string& get_luarocks_path() const override {
- return luarocks_path;
- }
-
- virtual void set_luarocks_path(const std::string& path) override {
- luarocks_path = path;
- }
-
virtual int initialize(CephContext* cct,
const DoutPrefixProvider* dpp) override;
};
* multiple db handles (for eg., one for each tenant),
* use dbsm->getDB(tenant) */
DB *db;
- std::string luarocks_path;
DBZone zone;
RGWSyncModuleInstanceRef sync_module;
RGWLC* lc;
return db->ctx();
}
- virtual const std::string& get_luarocks_path() const override {
- return luarocks_path;
- }
-
- virtual void set_luarocks_path(const std::string& path) override {
- luarocks_path = path;
- }
virtual void register_admin_apis(RGWRESTMgr* mgr) override { };
/* Unique to DBStore */
return next->ctx();
}
-const std::string& FilterDriver::get_luarocks_path() const
-{
- return next->get_luarocks_path();
-}
-
-void FilterDriver::set_luarocks_path(const std::string& path)
-{
- next->set_luarocks_path(path);
-}
-
int FilterUser::list_buckets(const DoutPrefixProvider* dpp, const std::string& marker,
const std::string& end_marker, uint64_t max,
bool need_stats, BucketList &buckets, optional_yield y)
virtual CephContext* ctx(void) override;
- virtual const std::string& get_luarocks_path() const override;
- virtual void set_luarocks_path(const std::string& path) override;
- virtual void register_admin_apis(RGWRESTMgr* mgr)override {
+ virtual void register_admin_apis(RGWRESTMgr* mgr) override {
return next->register_admin_apis(mgr);
}
};
class MotrStore : public StoreDriver {
private:
- std::string luarocks_path;
MotrZone zone;
RGWSyncModuleInstanceRef sync_module;
return cctx;
}
- virtual const std::string& get_luarocks_path() const override {
- return luarocks_path;
- }
-
- virtual void set_luarocks_path(const std::string& path) override {
- luarocks_path = path;
- }
virtual void register_admin_apis(RGWRESTMgr* mgr) override { };
int open_idx(struct m0_uint128 *id, bool create, struct m0_idx *out);