Motr  M0
ha.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2016-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 
36 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_HA
37 #include "lib/trace.h"
38 
39 #include "motr/ha.h"
40 
41 #include "lib/string.h" /* m0_strdup */
42 #include "lib/memory.h" /* m0_free */
43 #include "lib/assert.h" /* M0_ASSERT */
44 #include "lib/errno.h" /* EHOSTUNREACH */
45 #include "lib/finject.h" /* M0_FI_ENABLED */
46 
47 #include "conf/helpers.h" /* m0_confc_root_open */
48 #include "conf/schema.h" /* M0_CST_CONFD */
49 #include "conf/obj.h" /* m0_conf_obj_type */
50 #include "conf/diter.h" /* m0_conf_diter_init */
51 #include "conf/confc.h" /* m0_confc_close */
52 
53 #include "fid/fid.h" /* m0_fid_is_set */
54 #include "module/instance.h" /* m0_get */
55 #include "reqh/reqh.h" /* m0_reqh2confc */
56 #include "ha/entrypoint_fops.h" /* m0_ha_entrypoint_rep */
57 #include "ha/note.h" /* M0_NC_ONLINE */
58 #include "ha/failvec.h" /* m0_ha_fvec_handler */
59 
60 
61 M0_INTERNAL void m0_motr_ha_cfg_make(struct m0_motr_ha_cfg *mha_cfg,
62  struct m0_reqh *reqh,
63  struct m0_rpc_machine *rmach,
64  const char *addr)
65 {
66  M0_ENTRY("reqh=%p rmach=%p", reqh, rmach);
67  M0_PRE(reqh != NULL);
68  M0_PRE(rmach != NULL);
69  *mha_cfg = (struct m0_motr_ha_cfg){
71  .hdc_enable_note = true,
72  .hdc_enable_keepalive = true,
73  .hdc_enable_fvec = true,
74  },
75  .mhc_addr = addr,
76  .mhc_rpc_machine = rmach,
77  .mhc_reqh = reqh,
78  .mhc_process_fid = M0_FID_INIT(0, 0),
79  };
80  M0_LEAVE();
81 }
82 
83 static bool motr_ha_service_filter(const struct m0_conf_obj *obj)
84 {
86 }
87 
88 static int confd_count(const struct m0_conf_service *service,
89  struct m0_ha_entrypoint_rep *rep,
90  uint32_t index)
91 {
92  M0_CNT_INC(rep->hae_confd_fids.af_count);
93  return 0;
94 }
95 
96 static int confd_fill(const struct m0_conf_service *service,
97  struct m0_ha_entrypoint_rep *rep,
98  uint32_t index)
99 {
100  rep->hae_confd_eps[index] = m0_strdup(service->cs_endpoints[0]);
101  if (rep->hae_confd_eps[index] == NULL)
102  return M0_ERR(-ENOMEM);
103  rep->hae_confd_fids.af_elems[index] = service->cs_obj.co_id;
104  return 0;
105 }
106 
107 static int motr_ha_confd_iter(struct m0_confc *confc,
108  struct m0_ha_entrypoint_rep *rep,
109  int (*confd_iter)(const struct m0_conf_service *,
110  struct m0_ha_entrypoint_rep *,
111  uint32_t))
112 {
113  struct m0_conf_root *root;
114  struct m0_conf_obj *obj;
115  struct m0_conf_service *s;
116  struct m0_conf_diter it;
117  uint32_t index = 0;
118  int rc;
119 
120  /*
121  * This code is executed only for testing purposes if there is no real
122  * HA service in cluster.
123  */
125  if (rc != 0)
126  return M0_ERR(rc);
127 
129  M0_CONF_ROOT_NODES_FID,
130  M0_CONF_NODE_PROCESSES_FID,
131  M0_CONF_PROCESS_SERVICES_FID);
132  if (rc != 0) {
134  return M0_ERR(rc);
135  }
136 
137  while ((rc = m0_conf_diter_next_sync(&it,
138  motr_ha_service_filter)) > 0) {
141  if (s->cs_type == M0_CST_CONFD) {
142  rc = confd_iter(s, rep, index++);
143  if (rc != 0)
144  goto leave;
145  }
146  }
147 leave:
150  return M0_RC(rc);
151 }
152 
153 static void
155 {
156  int i;
157 
158  m0_free0(&rep->hae_confd_fids.af_elems);
159  for (i = 0; i < rep->hae_confd_fids.af_count; i++)
160  m0_free((void *)rep->hae_confd_eps[i]);
161  m0_free0(&rep->hae_confd_eps);
162  rep->hae_confd_fids.af_count = 0;
163 }
164 
166  struct m0_ha_entrypoint_rep *rep)
167 {
168  int rc;
169 
170  if (confc->cc_root == NULL)
171  return M0_ERR(-EPERM);
172 
174  if (rc != 0)
175  return M0_ERR(rc);
176  M0_ALLOC_ARR(rep->hae_confd_eps, rep->hae_confd_fids.af_count);
177  if (rep->hae_confd_eps == NULL)
178  return M0_ERR(-ENOMEM);
179  M0_ALLOC_ARR(rep->hae_confd_fids.af_elems,
180  rep->hae_confd_fids.af_count);
181  if (rep->hae_confd_fids.af_elems == NULL) {
182  m0_free0(&rep->hae_confd_eps);
183  return M0_ERR(-ENOMEM);
184  }
186  if (rc == 0)
187  rep->hae_quorum = rep->hae_confd_fids.af_count / 2 + 1;
188  else
190  return M0_RC(rc);
191 }
192 
194 {
196  obj->co_ha_state == M0_NC_ONLINE;
197 }
198 
200  struct m0_fid *active_rm_fid,
201  char **active_rm_ep)
202 {
203  struct m0_conf_root *root;
204  struct m0_conf_obj *obj;
205  struct m0_conf_service *s;
206  struct m0_conf_diter it;
207  int rc;
208 
209  if (M0_FI_ENABLED("no_rms_fid"))
210  return M0_ERR(-EPERM);
211  /*
212  * This code is executed only for testing purposes if there is no real
213  * HA service in cluster.
214  */
216  if (rc != 0)
217  return M0_ERR(rc);
218 
220  M0_CONF_ROOT_NODES_FID,
221  M0_CONF_NODE_PROCESSES_FID,
222  M0_CONF_PROCESS_SERVICES_FID);
223  if (rc != 0) {
225  return M0_ERR(rc);
226  }
227 
228  *active_rm_ep = NULL;
229  while ((rc = m0_conf_diter_next_sync(&it,
233  if (s->cs_type == M0_CST_RMS && m0_conf_service_is_top_rms(s)) {
234  *active_rm_fid = s->cs_obj.co_id;
235  *active_rm_ep = m0_strdup(s->cs_endpoints[0]);
236  break;
237  }
238  }
241  if (*active_rm_ep == NULL)
242  /* Further operation not permitted on client side */
243  return M0_ERR(-EPERM);
244 
245  return M0_RC(0);
246 }
247 
254 M0_INTERNAL struct m0_confc *m0_ha_entrypoint_confc_override(void)
255 {
256  static struct m0_confc confc;
257  return &confc;
258 }
259 
260 static void
262  const struct m0_ha_entrypoint_req *req,
263  const struct m0_uint128 *req_id)
264 {
265  struct m0_reqh *reqh = ha->h_cfg.hcf_reqh;
266  struct m0_confc *confc = m0_reqh2confc(reqh);
267  struct m0_ha_entrypoint_rep rep = {0};
268  int rc;
269 
270  if (M0_FI_ENABLED("ut_confc"))
272 
274  motr_ha_entrypoint_rep_rm_fill(confc, &rep.hae_active_rm_fid,
275  &rep.hae_active_rm_ep);
276  switch (rc) {
277  case 0:
278  M0_ASSERT(rep.hae_confd_eps[0] != NULL);
279  rep.hae_control = M0_HA_ENTRYPOINT_CONSUME;
280  break;
281  case -EPERM:
282  rep.hae_control = M0_HA_ENTRYPOINT_QUIT;
283  break;
284  case -EAGAIN:
285  rep.hae_control = M0_HA_ENTRYPOINT_QUERY;
286  /*
287  * XXX: need to develop some policy in regard to .hec_delay_ns
288  * in case the re-querying is requested.
289  */
290  break;
291  default:
292  M0_IMPOSSIBLE("rc=%d is not expected", rc);
293  }
294  m0_ha_entrypoint_reply(ha, req_id, &rep, NULL);
295  m0_free(rep.hae_active_rm_ep);
297  M0_LEAVE("rc=%d hae_control=%d", rc, rep.hae_control);
298 }
299 
300 static void motr_ha_entrypoint_replied_cb(struct m0_ha *ha,
301  struct m0_ha_entrypoint_rep *hep)
302 {
303  M0_LOG(M0_DEBUG, "replied");
304 }
305 
306 static void motr_ha_msg_received_cb(struct m0_ha *ha,
307  struct m0_ha_link *hl,
308  struct m0_ha_msg *msg,
309  uint64_t tag)
310 {
311  struct m0_motr_ha *mha;
312 
313  mha = container_of(ha, struct m0_motr_ha, mh_ha);
314  m0_ha_dispatcher_handle(&mha->mh_dispatcher, ha, hl, msg, tag);
315  m0_ha_delivered(ha, hl, msg);
316 }
317 
318 static void motr_ha_msg_is_delivered_cb(struct m0_ha *ha,
319  struct m0_ha_link *hl,
320  uint64_t tag)
321 {
322 }
323 
324 static void motr_ha_msg_is_not_delivered_cb(struct m0_ha *ha,
325  struct m0_ha_link *hl,
326  uint64_t tag)
327 {
328 }
329 
330 static void motr_ha_link_connected_cb(struct m0_ha *ha,
331  const struct m0_uint128 *req_id,
332  struct m0_ha_link *hl)
333 {
334 }
335 
336 static void motr_ha_link_reused_cb(struct m0_ha *ha,
337  const struct m0_uint128 *req_id,
338  struct m0_ha_link *hl)
339 {
340 }
341 
342 static void motr_ha_link_absent_cb(struct m0_ha *ha,
343  const struct m0_uint128 *req_id)
344 {
345 }
346 
348  struct m0_ha_link *hl)
349 {
351 }
352 
353 static void motr_ha_link_disconnected_cb(struct m0_ha *ha,
354  struct m0_ha_link *hl)
355 {
356 }
357 
358 const struct m0_ha_ops m0_motr_ha_ops = {
360  .hao_entrypoint_replied = &motr_ha_entrypoint_replied_cb,
361  .hao_msg_received = &motr_ha_msg_received_cb,
362  .hao_msg_is_delivered = &motr_ha_msg_is_delivered_cb,
363  .hao_msg_is_not_delivered = &motr_ha_msg_is_not_delivered_cb,
364  .hao_link_connected = &motr_ha_link_connected_cb,
365  .hao_link_reused = &motr_ha_link_reused_cb,
366  .hao_link_absent = &motr_ha_link_absent_cb,
367  .hao_link_is_disconnecting = &motr_ha_link_is_disconnecting_cb,
368  .hao_link_disconnected = &motr_ha_link_disconnected_cb,
369 };
370 
381 };
382 
383 static int motr_ha_level_enter(struct m0_module *module)
384 {
385  enum motr_ha_level level = module->m_cur + 1;
386  struct m0_motr_ha *mha;
387 
388  mha = container_of(module, struct m0_motr_ha, mh_module);
389  M0_ENTRY("mha=%p level=%d", mha, level);
390  switch (level) {
392  return M0_RC(m0_ha_init(&mha->mh_ha, &(struct m0_ha_cfg){
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,
398  }));
401  &mha->mh_cfg.mhc_dispatcher_cfg));
403  return M0_RC(m0_ha_start(&mha->mh_ha));
405  M0_ASSERT(m0_get()->i_ha == NULL);
406  m0_get()->i_ha = &mha->mh_ha;
407  return M0_RC(0);
409  mha->mh_link = m0_ha_connect(&mha->mh_ha);
410  /*
411  * Currently m0_ha_connect() is synchronous and always
412  * successful. It may be changed in the future.
413  */
414  M0_ASSERT(mha->mh_link != NULL);
415  return M0_RC(0);
417  M0_ASSERT(m0_get()->i_ha_link == NULL);
418  m0_get()->i_ha_link = mha->mh_link;
419  return M0_RC(0);
423  M0_IMPOSSIBLE("can't be here");
424  }
425  return M0_ERR(-ENOSYS);
426 }
427 
428 static void motr_ha_level_leave(struct m0_module *module)
429 {
430  enum motr_ha_level level = module->m_cur;
431  struct m0_motr_ha *mha;
432 
433  mha = container_of(module, struct m0_motr_ha, mh_module);
434  M0_ENTRY("mha=%p level=%d", mha, level);
435  switch (level) {
437  m0_ha_fini(&mha->mh_ha);
438  break;
441  break;
443  m0_ha_stop(&mha->mh_ha);
444  break;
446  M0_ASSERT(m0_get()->i_ha == &mha->mh_ha);
447  m0_get()->i_ha = NULL;
448  break;
450  m0_ha_flush(&mha->mh_ha, mha->mh_link);
451  m0_ha_disconnect(&mha->mh_ha);
452  break;
454  M0_ASSERT(m0_get()->i_ha_link != NULL);
455  M0_ASSERT(m0_get()->i_ha_link == mha->mh_link);
456  m0_get()->i_ha_link = NULL;
457  break;
461  M0_IMPOSSIBLE("can't be here");
462  }
463  M0_LEAVE();
464 
465 }
466 
467 static const struct m0_modlev motr_ha_levels[] = {
469  .ml_name = "MOTR_HA_LEVEL_HA_INIT",
470  .ml_enter = motr_ha_level_enter,
471  .ml_leave = motr_ha_level_leave,
472  },
474  .ml_name = "MOTR_HA_LEVEL_DISPATCHER",
475  .ml_enter = motr_ha_level_enter,
476  .ml_leave = motr_ha_level_leave,
477  },
479  .ml_name = "MOTR_HA_LEVEL_INITIALISED",
480  },
482  .ml_name = "MOTR_HA_LEVEL_HA_START",
483  .ml_enter = motr_ha_level_enter,
484  .ml_leave = motr_ha_level_leave,
485  },
487  .ml_name = "MOTR_HA_LEVEL_INSTANCE_SET_HA",
488  .ml_enter = motr_ha_level_enter,
489  .ml_leave = motr_ha_level_leave,
490  },
492  .ml_name = "MOTR_HA_LEVEL_STARTED",
493  },
495  .ml_name = "MOTR_HA_LEVEL_CONNECT",
496  .ml_enter = motr_ha_level_enter,
497  .ml_leave = motr_ha_level_leave,
498  },
500  .ml_name = "MOTR_HA_LEVEL_INSTANCE_SET_HA_LINK",
501  .ml_enter = motr_ha_level_enter,
502  .ml_leave = motr_ha_level_leave,
503  },
505  .ml_name = "MOTR_HA_LEVEL_CONNECTED",
506  },
507 };
508 
509 M0_INTERNAL int m0_motr_ha_init(struct m0_motr_ha *mha,
510  struct m0_motr_ha_cfg *mha_cfg)
511 {
512  char *addr_dup;
513  int rc;
514 
515  M0_ENTRY("mha=%p ha=%p mhc_addr=%s mhc_rpc_machine=%p mhc_reqh=%p "
516  "mhc_process_fid="FID_F,
517  mha, &mha->mh_ha, mha_cfg->mhc_addr, mha_cfg->mhc_rpc_machine,
518  mha_cfg->mhc_reqh, FID_P(&mha_cfg->mhc_process_fid));
519 
520  mha->mh_cfg = *mha_cfg;
521  addr_dup = m0_strdup(mha_cfg->mhc_addr);
522  if (addr_dup == NULL)
523  return M0_ERR(-ENOMEM);
524  mha->mh_cfg.mhc_addr = addr_dup;
525 
526  m0_module_setup(&mha->mh_module, "m0_motr_ha",
529  if (rc != 0) {
531  m0_free(addr_dup);
532  return M0_ERR(rc);
533  }
534  return M0_RC(0);
535 }
536 
537 M0_INTERNAL void m0_motr_ha_fini(struct m0_motr_ha *mha)
538 {
539  M0_ENTRY("mha=%p", mha);
541  /*
542  * Removing "const" here is safe because the string is allocated in
543  * m0_motr_ha_init() using m0_strdup().
544  */
545  m0_free((char *)mha->mh_cfg.mhc_addr);
546  M0_LEAVE();
547 }
548 
549 M0_INTERNAL int m0_motr_ha_start(struct m0_motr_ha *mha)
550 {
551  int rc;
552 
553  M0_ENTRY("mha=%p", mha);
555  if (rc != 0)
557  return rc == 0 ? M0_RC(0) : M0_ERR(rc);
558 }
559 
560 M0_INTERNAL void m0_motr_ha_stop(struct m0_motr_ha *mha)
561 {
562  M0_ENTRY("mha=%p", mha);
564  M0_LEAVE();
565 }
566 
567 M0_INTERNAL void m0_motr_ha_connect(struct m0_motr_ha *mha)
568 {
569  int rc;
570 
571  M0_ENTRY("mha=%p", mha);
573  /* connect can't fail */
574  M0_ASSERT(rc == 0);
575  M0_LEAVE();
576 }
577 
578 M0_INTERNAL void m0_motr_ha_disconnect(struct m0_motr_ha *mha)
579 {
580  M0_ENTRY("mha=%p", mha);
582  M0_LEAVE();
583 }
584 
585 #undef M0_TRACE_SUBSYSTEM
586 
589 /*
590  * Local variables:
591  * c-indentation-style: "K&R"
592  * c-basic-offset: 8
593  * tab-width: 8
594  * fill-column: 80
595  * scroll-step: 1
596  * End:
597  */
598 /*
599  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
600  */
const struct m0_conf_obj_type * m0_conf_obj_type(const struct m0_conf_obj *obj)
Definition: obj.c:363
struct m0_conf_obj * cc_root
Definition: confc.h:404
#define M0_PRE(cond)
#define M0_ALLOC_ARR(arr, nr)
Definition: memory.h:84
static bool motr_ha_online_service_filter(const struct m0_conf_obj *obj)
Definition: ha.c:193
#define m0_strdup(s)
Definition: string.h:43
M0_INTERNAL int m0_motr_ha_start(struct m0_motr_ha *mha)
Definition: ha.c:549
#define NULL
Definition: misc.h:38
M0_INTERNAL struct m0_ha_link * m0_ha_connect(struct m0_ha *ha)
Definition: ha.c:687
struct m0_motr_ha_cfg mh_cfg
Definition: ha.h:55
M0_INTERNAL void m0_ha_fini(struct m0_ha *ha)
Definition: ha.c:679
static struct io_request req
Definition: file.c:100
motr_ha_level
Definition: ha.c:371
static uint64_t tag(uint8_t code, uint64_t id)
Definition: addb2.c:1047
struct m0_conf_obj rt_obj
Definition: obj.h:372
static void motr_ha_link_disconnected_cb(struct m0_ha *ha, struct m0_ha_link *hl)
Definition: ha.c:353
#define M0_LOG(level,...)
Definition: trace.h:167
M0_LEAVE()
enum m0_trace_level level
Definition: trace.c:111
const struct m0_conf_obj_type M0_CONF_SERVICE_TYPE
Definition: service.c:156
#define M0_FID_INIT(container, key)
Definition: fid.h:84
struct m0_fid mhc_process_fid
Definition: ha.h:51
M0_INTERNAL int m0_ha_start(struct m0_ha *ha)
Definition: ha.c:659
static void motr_ha_msg_is_not_delivered_cb(struct m0_ha *ha, struct m0_ha_link *hl, uint64_t tag)
Definition: ha.c:324
struct m0_ha_cfg h_cfg
Definition: ha.h:290
struct m0_ha * i_ha
Definition: instance.h:108
static void leave(struct m0_locality_chore *chore, struct m0_locality *loc, void *place)
Definition: locality.c:315
M0_INTERNAL int m0_conf_diter_next_sync(struct m0_conf_diter *it, bool(*filter)(const struct m0_conf_obj *obj))
Definition: diter.c:555
static struct m0_be_emap_cursor it
Definition: extmap.c:46
const char * ml_name
Definition: module.h:114
struct m0_ha mh_ha
Definition: ha.h:57
M0_INTERNAL struct m0 * m0_get(void)
Definition: instance.c:41
static void motr_ha_link_absent_cb(struct m0_ha *ha, const struct m0_uint128 *req_id)
Definition: ha.c:342
#define container_of(ptr, type, member)
Definition: misc.h:33
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))
Definition: ha.c:107
M0_INTERNAL int m0_motr_ha_init(struct m0_motr_ha *mha, struct m0_motr_ha_cfg *mha_cfg)
Definition: ha.c:509
M0_INTERNAL struct m0_confc * m0_ha_entrypoint_confc_override(void)
Definition: ha.c:254
struct m0_fop_getxattr_rep * rep
Definition: dir.c:455
static struct foo * obj
Definition: tlist.c:302
struct m0_reqh * hcf_reqh
Definition: ha.h:275
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)
Definition: dispatcher.c:231
void(* hao_entrypoint_request)(struct m0_ha *ha, const struct m0_ha_entrypoint_req *req, const struct m0_uint128 *req_id)
Definition: ha.h:241
M0_INTERNAL void m0_motr_ha_disconnect(struct m0_motr_ha *mha)
Definition: ha.c:578
return M0_RC(rc)
M0_INTERNAL int m0_confc_root_open(struct m0_confc *confc, struct m0_conf_root **root)
Definition: helpers.c:219
M0_INTERNAL void m0_ha_disconnect(struct m0_ha *ha)
Definition: ha.c:707
#define M0_ENTRY(...)
Definition: trace.h:170
const struct m0_ha_ops m0_motr_ha_ops
Definition: ha.c:358
static char * addr
Definition: node_k.c:37
int i
Definition: dir.c:1033
struct m0_ha_link * mh_link
Definition: ha.h:58
static bool motr_ha_service_filter(const struct m0_conf_obj *obj)
Definition: ha.c:83
struct m0_conf_root * root
Definition: note.c:50
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL void m0_ha_flush(struct m0_ha *ha, struct m0_ha_link *hl)
Definition: ha.c:966
static void motr_ha_link_reused_cb(struct m0_ha *ha, const struct m0_uint128 *req_id, struct m0_ha_link *hl)
Definition: ha.c:336
M0_INTERNAL void m0_ha_stop(struct m0_ha *ha)
Definition: ha.c:672
M0_INTERNAL struct m0_confc * m0_reqh2confc(struct m0_reqh *reqh)
Definition: reqh.c:753
M0_INTERNAL void m0_ha_delivered(struct m0_ha *ha, struct m0_ha_link *hl, struct m0_ha_msg *msg)
Definition: ha.c:870
#define m0_free0(pptr)
Definition: memory.h:77
static int motr_ha_entrypoint_rep_confds_fill(struct m0_confc *confc, struct m0_ha_entrypoint_rep *rep)
Definition: ha.c:165
#define M0_ASSERT(cond)
static struct m0_confc * confc
Definition: file.c:94
M0_INTERNAL void m0_module_setup(struct m0_module *module, const char *name, const struct m0_modlev *level, int level_nr, struct m0 *instance)
Definition: module.c:193
const char * mhc_addr
Definition: ha.h:48
Definition: msg.h:115
Definition: xcode.h:73
Definition: reqh.h:94
M0_INTERNAL void m0_ha_dispatcher_fini(struct m0_ha_dispatcher *hd)
Definition: dispatcher.c:212
M0_INTERNAL void m0_motr_ha_connect(struct m0_motr_ha *mha)
Definition: ha.c:567
static void motr_ha_entrypoint_replied_cb(struct m0_ha *ha, struct m0_ha_entrypoint_rep *hep)
Definition: ha.c:300
static int motr_ha_level_enter(struct m0_module *module)
Definition: ha.c:383
#define M0_CONF_CAST(ptr, type)
Definition: obj.h:780
struct m0_module mh_module
Definition: ha.h:56
static void motr_ha_link_connected_cb(struct m0_ha *ha, const struct m0_uint128 *req_id, struct m0_ha_link *hl)
Definition: ha.c:330
#define FID_P(f)
Definition: fid.h:77
static int motr_ha_entrypoint_rep_rm_fill(struct m0_confc *confc, struct m0_fid *active_rm_fid, char **active_rm_ep)
Definition: ha.c:199
M0_INTERNAL void m0_ha_disconnect_incoming(struct m0_ha *ha, struct m0_ha_link *hl)
Definition: ha.c:714
Definition: ha.h:289
M0_INTERNAL int m0_ha_dispatcher_init(struct m0_ha_dispatcher *hd, struct m0_ha_dispatcher_cfg *hd_cfg)
Definition: dispatcher.c:192
struct m0_ha_link * i_ha_link
Definition: instance.h:110
M0_INTERNAL struct m0_conf_obj * m0_conf_diter_result(const struct m0_conf_diter *it)
Definition: diter.c:576
#define m0_conf_diter_init(iter, confc, origin,...)
Definition: diter.h:235
Definition: ha.h:54
static void motr_ha_msg_is_delivered_cb(struct m0_ha *ha, struct m0_ha_link *hl, uint64_t tag)
Definition: ha.c:318
struct m0_reqh reqh
Definition: rm_foms.c:48
struct m0_rpc_machine * mhc_rpc_machine
Definition: ha.h:49
#define M0_CNT_INC(cnt)
Definition: arith.h:226
#define M0_FI_ENABLED(tag)
Definition: finject.h:231
Definition: fid.h:38
struct m0_ha_dispatcher_cfg mhc_dispatcher_cfg
Definition: ha.h:47
static int confd_count(const struct m0_conf_service *service, struct m0_ha_entrypoint_rep *rep, uint32_t index)
Definition: ha.c:88
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)
Definition: ha.c:61
M0_INTERNAL int m0_ha_init(struct m0_ha *ha, struct m0_ha_cfg *ha_cfg)
Definition: ha.c:641
M0_INTERNAL void m0_conf_diter_fini(struct m0_conf_diter *it)
Definition: diter.c:313
int m_cur
Definition: module.h:160
Definition: ha.h:272
Definition: ha.h:239
static void motr_ha_msg_received_cb(struct m0_ha *ha, struct m0_ha_link *hl, struct m0_ha_msg *msg, uint64_t tag)
Definition: ha.c:306
static const struct m0_modlev motr_ha_levels[]
Definition: ha.c:467
M0_INTERNAL void m0_confc_close(struct m0_conf_obj *obj)
Definition: confc.c:921
static void motr_ha_entrypoint_request_cb(struct m0_ha *ha, const struct m0_ha_entrypoint_req *req, const struct m0_uint128 *req_id)
Definition: ha.c:261
M0_INTERNAL void m0_motr_ha_stop(struct m0_motr_ha *mha)
Definition: ha.c:560
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)
Definition: ha.c:844
struct m0_reqh * mhc_reqh
Definition: ha.h:50
static void motr_ha_level_leave(struct m0_module *module)
Definition: ha.c:428
struct m0_ha_dispatcher mh_dispatcher
Definition: ha.h:59
M0_INTERNAL void m0_motr_ha_fini(struct m0_motr_ha *mha)
Definition: ha.c:537
M0_INTERNAL bool m0_conf_service_is_top_rms(const struct m0_conf_service *svc)
Definition: helpers.c:319
void m0_free(void *data)
Definition: memory.c:146
static struct m0_addb2_source * s
Definition: consumer.c:39
static int confd_fill(const struct m0_conf_service *service, struct m0_ha_entrypoint_rep *rep, uint32_t index)
Definition: ha.c:96
static struct m0_reqh_service * service[REQH_IN_UT_MAX]
Definition: long_lock_ut.c:46
int32_t rc
Definition: trigger_fop.h:47
#define ARRAY_SIZE(a)
Definition: misc.h:45
static void motr_ha_link_is_disconnecting_cb(struct m0_ha *ha, struct m0_ha_link *hl)
Definition: ha.c:347
M0_INTERNAL void m0_module_fini(struct m0_module *module, int level)
Definition: module.c:142
static void motr_ha_entrypoint_rep_confds_free(struct m0_ha_entrypoint_rep *rep)
Definition: ha.c:154
#define FID_F
Definition: fid.h:75
M0_INTERNAL int m0_module_init(struct m0_module *module, int level)
Definition: module.c:131
#define M0_IMPOSSIBLE(fmt,...)