36 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_HA 72 .hdc_enable_keepalive =
true,
73 .hdc_enable_fvec =
true,
76 .mhc_rpc_machine = rmach,
129 M0_CONF_ROOT_NODES_FID,
130 M0_CONF_NODE_PROCESSES_FID,
131 M0_CONF_PROCESS_SERVICES_FID);
141 if (
s->cs_type == M0_CST_CONFD) {
159 for (
i = 0;
i <
rep->hae_confd_fids.af_count;
i++)
162 rep->hae_confd_fids.af_count = 0;
177 if (
rep->hae_confd_eps ==
NULL)
180 rep->hae_confd_fids.af_count);
181 if (
rep->hae_confd_fids.af_elems ==
NULL) {
187 rep->hae_quorum =
rep->hae_confd_fids.af_count / 2 + 1;
200 struct m0_fid *active_rm_fid,
220 M0_CONF_ROOT_NODES_FID,
221 M0_CONF_NODE_PROCESSES_FID,
222 M0_CONF_PROCESS_SERVICES_FID);
228 *active_rm_ep =
NULL;
234 *active_rm_fid =
s->cs_obj.co_id;
235 *active_rm_ep =
m0_strdup(
s->cs_endpoints[0]);
241 if (*active_rm_ep ==
NULL)
275 &
rep.hae_active_rm_ep);
393 .hcf_ops = m0_motr_ha_ops,
394 .hcf_rpc_machine = mha->mh_cfg.mhc_rpc_machine,
395 .hcf_addr = mha->mh_cfg.mhc_addr,
396 .hcf_reqh = mha->mh_cfg.mhc_reqh,
397 .hcf_process_fid = mha->mh_cfg.mhc_process_fid,
469 .
ml_name =
"MOTR_HA_LEVEL_HA_INIT",
474 .ml_name =
"MOTR_HA_LEVEL_DISPATCHER",
479 .ml_name =
"MOTR_HA_LEVEL_INITIALISED",
482 .ml_name =
"MOTR_HA_LEVEL_HA_START",
487 .ml_name =
"MOTR_HA_LEVEL_INSTANCE_SET_HA",
492 .ml_name =
"MOTR_HA_LEVEL_STARTED",
495 .ml_name =
"MOTR_HA_LEVEL_CONNECT",
500 .ml_name =
"MOTR_HA_LEVEL_INSTANCE_SET_HA_LINK",
505 .ml_name =
"MOTR_HA_LEVEL_CONNECTED",
515 M0_ENTRY(
"mha=%p ha=%p mhc_addr=%s mhc_rpc_machine=%p mhc_reqh=%p " 516 "mhc_process_fid="FID_F,
522 if (addr_dup ==
NULL)
585 #undef M0_TRACE_SUBSYSTEM const struct m0_conf_obj_type * m0_conf_obj_type(const struct m0_conf_obj *obj)
struct m0_conf_obj * cc_root
#define M0_ALLOC_ARR(arr, nr)
static bool motr_ha_online_service_filter(const struct m0_conf_obj *obj)
M0_INTERNAL int m0_motr_ha_start(struct m0_motr_ha *mha)
M0_INTERNAL struct m0_ha_link * m0_ha_connect(struct m0_ha *ha)
struct m0_motr_ha_cfg mh_cfg
M0_INTERNAL void m0_ha_fini(struct m0_ha *ha)
static struct io_request req
static uint64_t tag(uint8_t code, uint64_t id)
struct m0_conf_obj rt_obj
static void motr_ha_link_disconnected_cb(struct m0_ha *ha, struct m0_ha_link *hl)
#define M0_LOG(level,...)
enum m0_trace_level level
const struct m0_conf_obj_type M0_CONF_SERVICE_TYPE
#define M0_FID_INIT(container, key)
struct m0_fid mhc_process_fid
M0_INTERNAL int m0_ha_start(struct m0_ha *ha)
static void motr_ha_msg_is_not_delivered_cb(struct m0_ha *ha, struct m0_ha_link *hl, uint64_t tag)
static void leave(struct m0_locality_chore *chore, struct m0_locality *loc, void *place)
M0_INTERNAL int m0_conf_diter_next_sync(struct m0_conf_diter *it, bool(*filter)(const struct m0_conf_obj *obj))
static struct m0_be_emap_cursor it
M0_INTERNAL struct m0 * m0_get(void)
static void motr_ha_link_absent_cb(struct m0_ha *ha, const struct m0_uint128 *req_id)
#define container_of(ptr, type, member)
static int motr_ha_confd_iter(struct m0_confc *confc, struct m0_ha_entrypoint_rep *rep, int(*confd_iter)(const struct m0_conf_service *, struct m0_ha_entrypoint_rep *, uint32_t))
M0_INTERNAL int m0_motr_ha_init(struct m0_motr_ha *mha, struct m0_motr_ha_cfg *mha_cfg)
M0_INTERNAL struct m0_confc * m0_ha_entrypoint_confc_override(void)
struct m0_fop_getxattr_rep * rep
struct m0_reqh * hcf_reqh
M0_INTERNAL void m0_ha_dispatcher_handle(struct m0_ha_dispatcher *hd, struct m0_ha *ha, struct m0_ha_link *hl, struct m0_ha_msg *msg, uint64_t tag)
void(* hao_entrypoint_request)(struct m0_ha *ha, const struct m0_ha_entrypoint_req *req, const struct m0_uint128 *req_id)
M0_INTERNAL void m0_motr_ha_disconnect(struct m0_motr_ha *mha)
M0_INTERNAL int m0_confc_root_open(struct m0_confc *confc, struct m0_conf_root **root)
M0_INTERNAL void m0_ha_disconnect(struct m0_ha *ha)
const struct m0_ha_ops m0_motr_ha_ops
struct m0_ha_link * mh_link
static bool motr_ha_service_filter(const struct m0_conf_obj *obj)
struct m0_conf_root * root
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL void m0_ha_flush(struct m0_ha *ha, struct m0_ha_link *hl)
static void motr_ha_link_reused_cb(struct m0_ha *ha, const struct m0_uint128 *req_id, struct m0_ha_link *hl)
M0_INTERNAL void m0_ha_stop(struct m0_ha *ha)
M0_INTERNAL struct m0_confc * m0_reqh2confc(struct m0_reqh *reqh)
M0_INTERNAL void m0_ha_delivered(struct m0_ha *ha, struct m0_ha_link *hl, struct m0_ha_msg *msg)
static int motr_ha_entrypoint_rep_confds_fill(struct m0_confc *confc, struct m0_ha_entrypoint_rep *rep)
static struct m0_confc * confc
M0_INTERNAL void m0_module_setup(struct m0_module *module, const char *name, const struct m0_modlev *level, int level_nr, struct m0 *instance)
M0_INTERNAL void m0_ha_dispatcher_fini(struct m0_ha_dispatcher *hd)
M0_INTERNAL void m0_motr_ha_connect(struct m0_motr_ha *mha)
static void motr_ha_entrypoint_replied_cb(struct m0_ha *ha, struct m0_ha_entrypoint_rep *hep)
static int motr_ha_level_enter(struct m0_module *module)
#define M0_CONF_CAST(ptr, type)
struct m0_module mh_module
static void motr_ha_link_connected_cb(struct m0_ha *ha, const struct m0_uint128 *req_id, struct m0_ha_link *hl)
static int motr_ha_entrypoint_rep_rm_fill(struct m0_confc *confc, struct m0_fid *active_rm_fid, char **active_rm_ep)
M0_INTERNAL void m0_ha_disconnect_incoming(struct m0_ha *ha, struct m0_ha_link *hl)
M0_INTERNAL int m0_ha_dispatcher_init(struct m0_ha_dispatcher *hd, struct m0_ha_dispatcher_cfg *hd_cfg)
struct m0_ha_link * i_ha_link
M0_INTERNAL struct m0_conf_obj * m0_conf_diter_result(const struct m0_conf_diter *it)
#define m0_conf_diter_init(iter, confc, origin,...)
static void motr_ha_msg_is_delivered_cb(struct m0_ha *ha, struct m0_ha_link *hl, uint64_t tag)
struct m0_rpc_machine * mhc_rpc_machine
#define M0_FI_ENABLED(tag)
struct m0_ha_dispatcher_cfg mhc_dispatcher_cfg
static int confd_count(const struct m0_conf_service *service, struct m0_ha_entrypoint_rep *rep, uint32_t index)
M0_INTERNAL void m0_motr_ha_cfg_make(struct m0_motr_ha_cfg *mha_cfg, struct m0_reqh *reqh, struct m0_rpc_machine *rmach, const char *addr)
M0_INTERNAL int m0_ha_init(struct m0_ha *ha, struct m0_ha_cfg *ha_cfg)
M0_INTERNAL void m0_conf_diter_fini(struct m0_conf_diter *it)
static void motr_ha_msg_received_cb(struct m0_ha *ha, struct m0_ha_link *hl, struct m0_ha_msg *msg, uint64_t tag)
static const struct m0_modlev motr_ha_levels[]
M0_INTERNAL void m0_confc_close(struct m0_conf_obj *obj)
static void motr_ha_entrypoint_request_cb(struct m0_ha *ha, const struct m0_ha_entrypoint_req *req, const struct m0_uint128 *req_id)
M0_INTERNAL void m0_motr_ha_stop(struct m0_motr_ha *mha)
void m0_ha_entrypoint_reply(struct m0_ha *ha, const struct m0_uint128 *req_id, const struct m0_ha_entrypoint_rep *rep, struct m0_ha_link **hl_ptr)
struct m0_reqh * mhc_reqh
static void motr_ha_level_leave(struct m0_module *module)
struct m0_ha_dispatcher mh_dispatcher
M0_INTERNAL void m0_motr_ha_fini(struct m0_motr_ha *mha)
M0_INTERNAL bool m0_conf_service_is_top_rms(const struct m0_conf_service *svc)
static struct m0_addb2_source * s
static int confd_fill(const struct m0_conf_service *service, struct m0_ha_entrypoint_rep *rep, uint32_t index)
static struct m0_reqh_service * service[REQH_IN_UT_MAX]
static void motr_ha_link_is_disconnecting_cb(struct m0_ha *ha, struct m0_ha_link *hl)
M0_INTERNAL void m0_module_fini(struct m0_module *module, int level)
static void motr_ha_entrypoint_rep_confds_free(struct m0_ha_entrypoint_rep *rep)
M0_INTERNAL int m0_module_init(struct m0_module *module, int level)
#define M0_IMPOSSIBLE(fmt,...)