23 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_UT 81 #define NAME(ext) "rconfc-ut" ext 83 NAME(
""),
"-T",
"AD",
"-D",
NAME(
".db"),
84 "-S",
NAME(
".stob"),
"-A",
"linuxstob:"NAME(
"-addb.stob"),
94 .rsx_log_file_name =
NAME(
".log")
324 const size_t len = strlen(
src) + 1 + strlen(suffix) + 1;
330 strncpy(
s,
src, len);
331 p = strrchr(
s, delim);
333 strncpy(
p, suffix, strlen(suffix) + 1);
349 char *rm_fake =
NULL;
418 char *confd_fake =
NULL;
822 M0_CONF_ROOT_PROFILES_FID,
835 static bool do_override =
true;
1009 cc->ca_ver = new_ver;
1101 while (usleep(200) == -1);
1174 M0_CONF_ROOT_PROFILES_FID,
1178 m0_fi_disable(
"skip_confd_st_in",
"force_reconnect_success");
1460 #undef M0_TRACE_SUBSYSTEM
static struct m0_reqh * ut_reqh
static void _notify_cb(struct m0_sm_group *grp, struct m0_sm_ast *ast)
m0_rconfc_cb_t rc_fatal_cb
static struct m0_addb2_philter p
struct m0_conf_obj * cc_root
void(* rio_conflict)(struct m0_rm_incoming *in)
struct m0_ha_entrypoint_client h_entrypoint_client
M0_INTERNAL struct m0_reqh_service * m0_reqh_service_lookup(const struct m0_reqh *reqh, const struct m0_fid *fid)
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
static void test_quorum_retry(void)
static void conflict_ready_cb(struct m0_rconfc *rconfc)
struct m0_clink rc_ha_entrypoint_cl
static void test_no_rms(void)
M0_INTERNAL void m0_reqh_service_stop(struct m0_reqh_service *service)
M0_INTERNAL void m0_clink_init(struct m0_clink *link, m0_chan_cb_t cb)
M0_INTERNAL void m0_clink_del(struct m0_clink *link)
static int _skip(struct m0_confc *confc)
M0_INTERNAL void m0_clink_del_lock(struct m0_clink *link)
void(* sa_cb)(struct m0_sm_group *grp, struct m0_sm_ast *)
const m0_time_t M0_TIME_NEVER
M0_TL_DECLARE(rpc_conn, M0_INTERNAL, struct m0_rpc_conn)
static bool fs_ready(struct m0_clink *clink)
static struct m0_sm_group * grp
struct m0_conf_obj rt_obj
M0_INTERNAL struct m0_conf_obj * m0_conf_cache_lookup(const struct m0_conf_cache *cache, const struct m0_fid *id)
#define M0_LOG(level,...)
M0_INTERNAL void m0_reqh_service_prepare_to_stop(struct m0_reqh_service *service)
static void test_dead_down(void)
M0_INTERNAL int m0_file_read(const char *path, char **out)
const char ** hae_confd_eps
M0_INTERNAL void m0_sm_ast_post(struct m0_sm_group *grp, struct m0_sm_ast *ast)
bool(* go_check)(struct m0_confc *confc)
int m0_rpc_server_start(struct m0_rpc_server_ctx *sctx)
uint32_t rc_ha_entrypoint_retries
int(* go_skip)(struct m0_confc *confc)
static void rconfc_ut_fatal_cb(struct m0_rconfc *rconfc)
static void rconfc_ut_ha_state_set(const struct m0_fid *fid, uint32_t state)
M0_INTERNAL int m0_ut_rpc_machine_start(struct m0_rpc_machine *mach, struct m0_net_xprt *xprt, const char *ep_addr)
static void test_drain(void)
M0_INTERNAL void m0_rconfc_stop_sync(struct m0_rconfc *rconfc)
struct m0_chan rh_conf_cache_ready
static void test_quorum_impossible(void)
static struct m0_rpc_client_ctx cctx
M0_INTERNAL enum m0_ha_entrypoint_client_state m0_ha_entrypoint_client_state_get(struct m0_ha_entrypoint_client *ecl)
M0_INTERNAL void m0_rconfc_fatal_cb_set(struct m0_rconfc *rconfc, m0_rconfc_cb_t cb)
M0_INTERNAL void m0_confc_fini(struct m0_confc *confc)
M0_INTERNAL bool m0_clink_is_armed(const struct m0_clink *link)
static struct m0_addb2_mach * mach
struct m0_ut_suite rconfc_ut
static bool ha_clink_cb_suppress(struct m0_clink *clink)
struct m0_confc_gate_ops rc_gops
static void test_gops(void)
M0_INTERNAL struct m0 * m0_get(void)
uint32_t rc_sm_state_on_abort
#define container_of(ptr, type, member)
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
struct m0_semaphore gops_sem
#define CLIENT_ENDPOINT_ADDR
static void drain_expired_cb(struct m0_rconfc *rconfc)
M0_INTERNAL bool m0_fid_is_set(const struct m0_fid *fid)
M0_INTERNAL void m0_ha_state_set(const struct m0_ha_nvec *note)
M0_INTERNAL int m0_confc_reconnect(struct m0_confc *confc, struct m0_rpc_machine *rpc_mach, const char *confd_addr)
static int rconfc_ut_fini(void)
struct m0_conf_root * root
static void test_fail_abort(void)
M0_INTERNAL int m0_sm_timedwait(struct m0_sm *mach, uint64_t states, m0_time_t deadline)
static void test_init_fini(void)
struct m0_reqh_service_type m0_confd_stype
M0_INTERNAL int m0_confc_root_open(struct m0_confc *confc, struct m0_conf_root **root)
struct m0_reqh_context rctx
static struct m0_sm_ast ast[NR]
M0_INTERNAL void m0_sm_group_unlock(struct m0_sm_group *grp)
static int rconfc_ut_init(void)
static void _subscribe_to_service(struct m0_rconfc *rconfc, struct m0_fid *fid, struct m0_clink *clink)
static void test_null_exp_cb(struct m0_rconfc *rconfc)
struct m0_conf_root * root
#define M0_FID_TINIT(type, container, key)
static struct m0_semaphore g_fatal_sem
#define M0_AMB(obj, ptr, field)
static M0_UNUSED void test_ha_notify(void)
M0_INTERNAL void m0_confc_ctx_fini(struct m0_confc_ctx *ctx)
M0_INTERNAL void m0_fi_disable(const char *fp_func, const char *fp_tag)
struct m0_fid drain_fs_fid
M0_INTERNAL int m0_conf_ut_ast_thread_fini(void)
static void m0_fi_enable(const char *func, const char *tag)
static bool _clink_cb(struct m0_clink *link)
struct m0_rm_incoming rlc_req
static struct m0_confc * confc
M0_INTERNAL bool m0_mutex_is_locked(const struct m0_mutex *mutex)
static void conflict_exp_cb(struct m0_rconfc *rconfc)
struct m0_mutex rc_herd_lock
M0_TL_DESCR_DECLARE(rpc_conn, M0_EXTERN)
static struct m0_semaphore g_ready_sem
static bool ha_clink_cb_bad_confd(struct m0_clink *clink)
M0_INTERNAL bool m0_confc_is_online(const struct m0_confc *confc)
M0_INTERNAL int m0_confc_ctx_init(struct m0_confc_ctx *ctx, struct m0_confc *confc)
struct m0_conf_cache cc_cache
int m0_rpc_client_stop(struct m0_rpc_client_ctx *cctx)
M0_INTERNAL bool m0_rconfc_is_preloaded(struct m0_rconfc *rconfc)
const char * confd_addr[]
struct m0_net_xprt * m0_net_xprt_default_get(void)
int m0_rpc_client_start(struct m0_rpc_client_ctx *cctx)
struct m0_rconfc * rl_rconfc
M0_INTERNAL int m0_semaphore_init(struct m0_semaphore *semaphore, unsigned value)
void * m0_alloc(size_t size)
struct m0_sm_group * sm_grp
static struct m0_net_domain client_net_dom
static int m0_rconfc_start_sync(struct m0_rconfc *rconfc)
struct m0_confc_gate_ops m0_rconfc_gate_ops
static const struct m0_fid m0_ut_conf_fids[]
struct m0_chan co_ha_chan
M0_INTERNAL void m0_rconfc_lock(struct m0_rconfc *rconfc)
struct m0_rm_incoming_ops m0_rconfc_ri_ops
static void on_death_cb_install(struct m0_rconfc *rconfc, enum ut_confc_control ctrl)
struct m0_sm_group m0_conf_ut_grp
static bool(* ha_clink_cb_orig)(struct m0_clink *clink)
#define M0_CONF_CAST(ptr, type)
M0_INTERNAL bool m0_confc_is_inited(const struct m0_confc *confc)
static struct m0_clink clink[RDWR_REQUEST_MAX]
static void test_reading(void)
#define m0_confc_open_sync(result, origin,...)
static bool ha_clink_cb_bad_rm(struct m0_clink *clink)
struct m0_net_domain * rcx_net_dom
void(* rl_on_state_cb)(struct rconfc_link *lnk)
static bool fs_expired(struct m0_clink *clink)
enum m0_ha_entrypoint_control hae_control
M0_INTERNAL int m0_conf_ut_ast_thread_init(void)
M0_INTERNAL void m0_rconfc_fini(struct m0_rconfc *rconfc)
static void test_start_stop_local(void)
static void m0_fi_enable_off_n_on_m(const char *func, const char *tag, uint32_t n, uint32_t m)
struct m0_conf_cache * d_cache
static void rconfc_ut_motr_stop(struct m0_rpc_machine *mach, struct m0_rpc_server_ctx *rctx)
M0_INTERNAL bool m0_fid_eq(const struct m0_fid *fid0, const struct m0_fid *fid1)
void m0_clink_add_lock(struct m0_chan *chan, struct m0_clink *link)
#define M0_UT_RETURN(...)
static void test_cache_drop(void)
M0_INTERNAL void m0_rconfc_unlock(struct m0_rconfc *rconfc)
static struct m0_fid profile
static void _stop_rms(struct m0_rpc_machine *rmach)
int m0_net_domain_init(struct m0_net_domain *dom, const struct m0_net_xprt *xprt)
static void test_local_load_fail(void)
static char * suffix_subst(const char *src, char delim, const char *suffix)
const struct m0_reqh_service_type * rs_type
static bool expected_fom_queued_value
struct m0_chan rh_conf_cache_exp
M0_INTERNAL void m0_semaphore_fini(struct m0_semaphore *semaphore)
#define M0_UT_CONF_PROCESS
struct m0_net_xprt ** m0_net_all_xprt_get(void)
const struct m0_fid M0_CONF_ROOT_FID
static void test_reconnect_success(void)
static void test_fail_retry_confd(void)
static struct m0_net_test_service svc
M0_INTERNAL void m0_clink_fini(struct m0_clink *link)
static bool quorum_impossible_clink_cb(struct m0_clink *cl)
M0_INTERNAL uint64_t m0_rconfc_ver_max_read(struct m0_rconfc *rconfc)
M0_INTERNAL void m0_reqh_idle_wait_for(struct m0_reqh *reqh, struct m0_reqh_service *service)
M0_INTERNAL void m0_sm_group_lock(struct m0_sm_group *grp)
static void m0_fi_enable_once(const char *func, const char *tag)
static void test_dead_stop(void)
static void test_confc_ctx_block(void)
static struct m0_rconfc * rconfc(struct m0_client *m0c)
M0_INTERNAL void m0_confc_close(struct m0_conf_obj *obj)
M0_INTERNAL void m0_ut_rpc_machine_stop(struct m0_rpc_machine *mach)
struct m0_rconfc rh_rconfc
void m0_rpc_server_stop(struct m0_rpc_server_ctx *sctx)
M0_INTERNAL void m0_confc_ready_cb(struct m0_rconfc *rconfc)
#define SERVER_ENDPOINT_ADDR
static int rconfc_ut_motr_start(struct m0_rpc_machine *mach, struct m0_rpc_server_ctx *rctx)
M0_INTERNAL int m0_rconfc_init(struct m0_rconfc *rconfc, const struct m0_fid *profile, struct m0_sm_group *sm_group, struct m0_rpc_machine *rmach, m0_rconfc_cb_t expired_cb, m0_rconfc_cb_t ready_cb)
M0_INTERNAL void m0_semaphore_down(struct m0_semaphore *semaphore)
static void _on_death_cb(struct rconfc_link *lnk)
M0_INTERNAL void m0_confc_expired_cb(struct m0_rconfc *rconfc)
M0_INTERNAL void m0_semaphore_up(struct m0_semaphore *semaphore)
M0_INTERNAL void m0_ha_state_accept(const struct m0_ha_nvec *note, bool ignore_same_state)
static void drain_ready_cb(struct m0_rconfc *rconfc)
static struct m0_semaphore g_expired_sem
#define m0_tl_for(name, head, obj)
static struct m0_addb2_source * s
static struct m0_semaphore sem_death
static void test_version_change(void)
static struct m0_reqh_service * service[REQH_IN_UT_MAX]
struct m0_ha_entrypoint_rep ecl_rep
struct m0_pdclust_src_addr src
struct m0_fid g_process_fid
static void test_fail_retry_rm(void)
static void update_confd_version(struct m0_rpc_server_ctx *rctx, uint64_t new_ver)
static void test_start_failures(void)
static void test_start_stop(void)
M0_INTERNAL int m0_rconfc_start_wait(struct m0_rconfc *rconfc, uint64_t timeout_ns)