Allow to create OSD with mocked blockstore and network

This commit is contained in:
Vitaliy Filippov
2026-06-13 19:56:06 +03:00
parent ef0e61be1b
commit 27bd38d95e
15 changed files with 346 additions and 81 deletions
+4 -2
View File
@@ -15,7 +15,8 @@
#include "str_util.h"
#include "json_util.h"
osd_t::osd_t(const json11::Json & config, ring_loop_i *ringloop, timerfd_manager_t *tfd, std::unique_ptr<etcd_state_client_t> st_cli_ptr)
osd_t::osd_t(const json11::Json & config, ring_loop_i *ringloop, timerfd_manager_t *tfd,
std::unique_ptr<etcd_state_client_t> st_cli_ptr, std::function<blockstore_i*(blockstore_config_t & config)> bs_factory)
{
zero_buffer_size = 1<<20;
zero_buffer = malloc_or_die(zero_buffer_size);
@@ -24,6 +25,7 @@ osd_t::osd_t(const json11::Json & config, ring_loop_i *ringloop, timerfd_manager
this->ringloop = ringloop;
this->tfd = tfd;
this->st_cli = std::move(st_cli_ptr);
this->bs_factory = bs_factory;
this->cli_config = config.object_items();
this->file_config = msgr.read_config(this->cli_config);
@@ -115,7 +117,7 @@ void osd_t::init_blockstore(std::function<void()> on_init)
if (!json_is_true(this->config["disable_blockstore"]))
{
auto bs_cfg = json_to_string_map(this->config);
this->bs = blockstore_i::create(bs_cfg, ringloop, tfd);
this->bs = bs_factory(bs_cfg);
// Pre-configure pool PG shards
for (auto & pool_item: st_cli->pool_config)
{