23 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_SPIEL 165 in_fd = open(
source, O_RDONLY);
169 out_fd = open(
dest, O_WRONLY | O_CREAT, 0666);
176 rc = (result = read(in_fd, &
buf[0],
sizeof(
buf))) >= 0 ?
178 if (result == 0 ||
rc != 0)
180 rc = write(out_fd, &
buf[0], result) == result ? 0 : -EINVAL;
208 (uint64_t)1 << (64 - 10);
217 rc = system(
"rm -rf confd");
219 rc = unlink(
"tmp-conf.xc");
244 const char *
params[] = {
"11111",
"22222",
NULL };
247 uint32_t tolerance[] = {0, 0, 0, 0, 1};
248 uint32_t allowance[] = {0, 0, 0, 0, 1};
421 &bitmap, 4000, 1, 2, 3,
ep[0]);
427 &bitmap, 4000, 1, 2, 3,
ep[0]);
444 service_info.
svi_type = M0_CST_CONFD;
451 service_info.
svi_type = M0_CST_ADDB2;
472 service_info.
svi_type = M0_CST_SNS_REP;
479 service_info.
svi_type = M0_CST_SNS_REB;
518 service_info.
svi_type = M0_CST_FDMI;
531 1024, 512, 123, 0x55,
"/dev/sdev2");
540 1024, 512, 123, 0x55,
"/dev/sdev2");
548 1024, 512, 123, 0x55,
"/dev/sdev3");
556 1024, 512, 123, 0x55,
"/dev/sdev4");
564 1024, 512, 123, 0x55,
"/dev/sdev5");
572 1024, 512, 123, 0x55,
"/dev/sdev0");
580 1024, 512, 123, 0x55,
"/dev/sdev1");
588 1024, 512, 123, 0x55,
"/dev/sdev2");
596 1024, 512, 123, 0x55,
"/dev/sdev3");
604 1024, 512, 123, 0x55,
"/dev/sdev4");
618 #define FID_MOVE(fid, step) \ 619 &M0_FID_INIT((fid).f_container, (fid).f_key + (step)) 629 const char *
params[] = {
"11111",
"22222",
NULL };
632 uint32_t tolerance[] = {0, 0, 0, 0, 1};
711 &bitmap, 4000, 1, 2, 3,
ep[0]);
727 1024, 512, 123, 0x55,
"fake_filename");
825 uint32_t tolerance[] = {0, 0, 0, 0, 1};
826 uint32_t allowance[] = {0, 0, 0, 0, 1};
854 &pdclust_attr_invalid,
1037 const char *
params[] = {
"11111",
"22222",
NULL };
1040 struct m0_fid fake_profile_fid =
1045 uint64_t zero_mask[] = {0, 0};
1048 .b_words = zero_mask
1077 "strdup_failed", 1, 1);
1161 256, 2, 10, 0xff00ff00);
1166 256, 2, 10, 0xff00ff00);
1248 &bitmap, 4000, 1, 2, 3,
ep[0]);
1254 &bitmap, 4000, 1, 2, 3,
ep[0]);
1260 NULL, 4000, 1, 2, 3,
ep[0]);
1266 &bitmap, 4000, 1, 2, 3,
NULL);
1272 &zero_bitmap, 4000, 1, 2, 3,
ep[0]);
1278 &bitmap, 4000, 1, 2, 3,
ep[0]);
1283 service_info.
svi_type = M0_CST_CONFD;
1312 service_info.
svi_type = M0_CST_MDS;
1319 service_info.
svi_type = M0_CST_IOS;
1328 service_info.
svi_type = M0_CST_CONFD;
1337 service_info.
svi_type = M0_CST_RMS;
1346 service_info.
svi_type = M0_CST_SSS;
1374 service_info.
svi_type = M0_CST_CONFD;
1390 1024, 512, 123, 0x55,
"fake_filename");
1399 1024, 512, 123, 0x55,
"fake_filename");
1408 1024, 512, 123, 0x55,
"fake_filename");
1417 1024, 512, 123, 0x55,
"fake_filename");
1426 1024, 512, 123, 0x55,
NULL);
1435 1024, 512, 123, 0x55,
"fake_filename");
1485 const char *ep_service1[] = {
"addr-0",
1489 const char *ep_service2[] = {
"addr-3",
NULL };
1490 const char *ep_service3[] = {
"addr-3",
NULL };
1492 const char *
params[] = {
"param-0",
1530 uint32_t tolerance[] = {0, 0, 0, 0, 1};
1538 &fid_pver, 41212,
params);
1606 &bitmap, 4000, 1, 2, 3,
ep[0]);
1610 &bitmap, 4000, 1, 2, 3,
ep[0]);
1614 &bitmap, 4000, 1, 2, 3,
ep[0]);
1617 service_info1.
svi_type = M0_CST_CONFD;
1622 service_info2.
svi_type = M0_CST_MDS;
1627 service_info3.
svi_type = M0_CST_FDMI;
1633 4, 1, 4096, 596000000000, 3, 4,
"/dev/sdev0");
1637 4, 1, 4096, 596000000000, 3, 4,
"/dev/sdev1");
1641 7, 2, 8192, 320000000000, 2, 4,
"/dev/sdev2");
1651 char *confstr =
NULL;
1652 const char filename[] =
"spiel-conf.xc";
1653 const int ver_forced = 10;
1713 m0_fi_enable(
"storage_devs_conf_expired_cb",
"skip_storage_devs_expired_cb");
1715 "skip_storage_devs_ready_cb");
1716 for (
i = 0;
i < 2;
i++) {
1722 m0_fi_disable(
"storage_devs_conf_expired_cb",
"skip_storage_devs_expired_cb");
1724 "skip_storage_devs_ready_cb");
1765 #define SVC_EP "0@lo:12345:41:201" 1774 .svi_endpoints = svc_ep
1778 uint32_t svc_str_size =
1779 sizeof(
"{0x73|((^s|1:0), @M0_CST_MDS, [1: "SVC_EP"], [0]," 1791 svc_nr =
seg_size/svc_str_size + 1;
1792 for (
i = 0;
i < svc_nr;
i++) {
1846 obj_parent =
obj->co_parent;
1856 obj->co_parent->co_ops->coo_delete(
obj->co_parent);
1857 obj->co_parent = obj_parent;
1887 const char *
filename =
"config.xc";
1888 const char *filename_bad =
"config_b.xc";
1889 const int ver_forced = 10;
1925 const int ver_forced = 10;
1945 char *rm_ep =
"0@lo:12345:34:1";
2000 #undef M0_TRACE_SUBSYSTEM static m0_bcount_t seg_size
const struct m0_conf_obj_type * m0_conf_obj_type(const struct m0_conf_obj *obj)
int m0_spiel_pver_formulaic_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, uint32_t index, const struct m0_fid *base_pver, uint32_t *allowance, uint32_t allowance_len)
static struct m0_mutex lock
struct m0_conf_pver ** cr_pvers
static void spiel_conf_add_svc(void)
M0_INTERNAL int m0_bitmap_init(struct m0_bitmap *map, size_t nr)
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
static void spiel_conf_load_send(void)
int m0_spiel_tx_dump_debug(struct m0_spiel_tx *tx, uint64_t ver_forced, const char *filename)
int m0_spiel_tx_commit(struct m0_spiel_tx *tx)
static void spiel_conf_wlock_get_fail(void)
static void spiel_conf_file_create_tree(struct m0_spiel_tx *tx)
M0_INTERNAL void m0_bitmap_fini(struct m0_bitmap *map)
int m0_spiel_tx_validate(struct m0_spiel_tx *tx)
int m0_spiel_service_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, const struct m0_spiel_service_info *service_info)
int m0_spiel_profile_add(struct m0_spiel_tx *tx, const struct m0_fid *fid)
int m0_spiel_pool_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, uint32_t pver_policy)
static void spiel_conf_tx_no_spiel(void)
static void spiel_conf_create_invalid_configuration(struct m0_spiel *spiel, struct m0_spiel_tx *tx)
static void spiel_conf_ut_fini(void)
M0_INTERNAL struct m0_conf_obj * m0_conf_cache_lookup(const struct m0_conf_cache *cache, const struct m0_fid *id)
M0_INTERNAL int m0_file_read(const char *path, char **out)
static void spiel_conf_tx_invalid(void)
M0_INTERNAL void m0_confx_string_free(char *str)
static void spiel_conf_check_fail(void)
struct m0_conf_pver ** cc_pvers
struct m0_conf_pver ** ce_pvers
struct m0_rpc_server_ctx sur_confd_srv
static void spiel_conf_create_configuration(struct m0_spiel *spiel, struct m0_spiel_tx *tx)
void m0_spiel_tx_str_free(char *str)
static void spiel_conf_pver_check(struct m0_spiel_tx *tx)
int m0_spiel_pool_version_done(struct m0_spiel_tx *tx, const struct m0_fid *fid)
int m0_spiel_root_add(struct m0_spiel_tx *tx, const struct m0_fid *rootfid, const struct m0_fid *mdpool, const struct m0_fid *imeta_pver, uint32_t mdredundancy, const char **params)
const char ** svi_endpoints
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
M0_INTERNAL m0_bcount_t m0_conf_segment_size(struct m0_fop *fop)
void m0_spiel_tx_close(struct m0_spiel_tx *tx)
int m0_spiel_site_add(struct m0_spiel_tx *tx, const struct m0_fid *fid)
M0_INTERNAL void m0_spiel__ut_fini(struct m0_spiel *spiel, bool cmd_iface)
static void spiel_conf_ut_init(void)
M0_INTERNAL void m0_rm_ha_tracker_fini(struct m0_rm_ha_tracker *tracker)
static void spiel_conf_load_fail(void)
int m0_spiel_enclosure_v_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, const struct m0_fid *real)
#define M0_FID_TINIT(type, container, key)
int m0_spiel_drive_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent)
int m0_spiel_tx_dump(struct m0_spiel_tx *tx, uint64_t ver_forced, const char *filename)
M0_INTERNAL void m0_fi_disable(const char *fp_func, const char *fp_tag)
M0_INTERNAL int m0_conf_ut_ast_thread_fini(void)
static void spiel_conf_drop_svc(void)
static void m0_fi_enable(const char *func, const char *tag)
M0_INTERNAL int m0_conf_cache_to_string(struct m0_conf_cache *cache, char **str, bool debug)
static struct m0_confc * confc
int m0_spiel_profile_pool_add(struct m0_spiel_tx *tx, const struct m0_fid *profile, const struct m0_fid *pool)
struct m0_spiel_ut_reqh ut_reqh
static void spiel_conf_create_ok(void)
static void spiel_conf_create_pver_tree(struct m0_spiel_tx *tx)
struct m0_ut_suite spiel_conf_ut
M0_INTERNAL void m0_conf_cache_init(struct m0_conf_cache *cache, struct m0_mutex *lock)
int m0_spiel_element_del(struct m0_spiel_tx *tx, const struct m0_fid *fid)
int m0_spiel_rack_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent)
static void spiel_conf_expired(void)
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
static void spiel_conf_delete(void)
M0_INTERNAL struct m0_confc * m0_motr2confc(struct m0_motr *motr)
M0_INTERNAL void m0_rconfc_lock(struct m0_rconfc *rconfc)
int m0_spiel_enclosure_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, const struct m0_fid *node)
M0_INTERNAL void m0_bitmap_set(struct m0_bitmap *map, size_t idx, bool val)
int m0_spiel_pver_actual_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, const struct m0_pdclust_attr *attrs, uint32_t *tolerance, uint32_t tolerance_len)
M0_INTERNAL int m0_rm_ha_subscribe_sync(struct m0_confc *confc, const char *rem_ep, struct m0_rm_ha_tracker *tracker)
int m0_spiel_controller_v_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, const struct m0_fid *real)
#define M0_CONF_CAST(ptr, type)
int m0_spiel_controller_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent)
int m0_spiel_device_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, const struct m0_fid *drive, uint32_t dev_idx, enum m0_cfg_storage_device_interface_type iface, enum m0_cfg_storage_device_media_type media, uint32_t bsize, uint64_t size, uint64_t last_state, uint64_t flags, const char *filename)
M0_INTERNAL void m0_spiel__ut_init(struct m0_spiel *spiel, const char *confd_path, bool cmd_iface)
M0_INTERNAL int m0_conf_ut_ast_thread_init(void)
static void m0_fi_enable_off_n_on_m(const char *func, const char *tag, uint32_t n, uint32_t m)
void m0_spiel_tx_open(struct m0_spiel *spiel, struct m0_spiel_tx *tx)
static void spiel_conf_create_conf_with_opt(struct m0_spiel *spiel, struct m0_spiel_tx *tx, uint64_t opts)
static void spiel_conf_file(void)
static int spiel_copy_file(const char *source, const char *dest)
M0_INTERNAL void m0_rconfc_unlock(struct m0_rconfc *rconfc)
m0_rconfc_cb_t rc_expired_cb
static struct m0_fid spiel_obj_fid[]
M0_INTERNAL struct m0_conf_obj * m0_conf_obj_create(const struct m0_fid *id, struct m0_conf_cache *cache)
int m0_spiel_tx_to_str(struct m0_spiel_tx *tx, uint64_t ver_forced, char **str)
int m0_spiel_rack_v_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, const struct m0_fid *real)
int m0_spiel_drive_v_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, const struct m0_fid *real)
int m0_spiel_process_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, struct m0_bitmap *cores, uint64_t memlimit_as, uint64_t memlimit_rss, uint64_t memlimit_stack, uint64_t memlimit_memlock, const char *endpoint)
struct m0_conf_cache spt_cache
struct m0_reqh_context cc_reqh_ctx
static void spiel_conf_flip_fail(void)
M0_INTERNAL int m0_conf_cache_from_string(struct m0_conf_cache *cache, const char *str)
static void spiel_conf_pver_delete_check(struct m0_spiel_tx *tx)
int m0_spiel_node_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, uint32_t memsize, uint32_t nr_cpu, uint64_t last_state, uint64_t flags)
static void spiel_conf_cancel(void)
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
static void m0_fi_enable_once(const char *func, const char *tag)
static struct m0_rconfc * rconfc(struct m0_client *m0c)
struct m0_rconfc rh_rconfc
M0_INTERNAL void m0_rm_ha_tracker_init(struct m0_rm_ha_tracker *tracker, m0_chan_cb_t cb)
M0_INTERNAL void m0_confc_ready_cb(struct m0_rconfc *rconfc)
#define SERVER_ENDPOINT_ADDR
enum m0_conf_service_type svi_type
const struct m0_conf_obj_type M0_CONF_PROCESS_TYPE
int m0_spiel_site_v_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, const struct m0_fid *real)
M0_INTERNAL void m0_confc_expired_cb(struct m0_rconfc *rconfc)
M0_INTERNAL void m0_conf_cache_fini(struct m0_conf_cache *cache)
static void spiel_conf_big_db(void)
#define m0_tl_for(name, head, obj)
static void spiel_conf_dump(void)
#define FID_MOVE(fid, step)
struct m0_motr rsx_motr_ctx
m0_rconfc_cb_t rc_ready_cb
static void spiel_conf_create_fail(void)