Motr  M0
m0dixinit.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 
30 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_DIX
31 #include "lib/trace.h"
32 
33 #include <stdio.h>
34 #include "lib/getopts.h" /* M0_GETOPTS */
35 #include "lib/thread.h" /* LAMBDA */
36 #include "lib/hash_fnc.h" /* HASH_FNC_CITY */
37 #include "lib/uuid.h" /* m0_uuid_generate */
38 #include "lib/string.h" /* m0_streq */
39 #include "lib/ext.h" /* m0_ext */
40 #include "module/instance.h" /* m0 */
41 #include "pool/pool.h" /* m0_pool_version */
42 #include "conf/confc.h" /* m0_confc_close */
43 #include "conf/ha.h" /* m0_conf_ha_process_event_post */
44 #include "conf/helpers.h" /* m0_confc_args */
45 #include "motr/ha.h"
46 #include "rpc/rpc_machine.h" /* m0_rpc_machine */
47 #include "rpc/rpc.h" /* m0_rpc_bufs_nr */
48 #include "reqh/reqh.h" /* m0_reqh */
49 #include "rm/rm_service.h" /* m0_rms_type */
50 #include "net/buffer_pool.h" /* m0_net_buffer_pool */
51 #include "dix/meta.h"
52 #include "dix/layout.h"
53 #include "dix/client.h"
54 
55 enum dix_action {
59 };
60 
61 struct dix_ctx {
64  const char *dc_laddr;
67  struct m0_reqh dc_reqh;
69 };
70 
71 static uint32_t tm_recv_queue_min_len = 10;
73 
74 static int dix_ha_init(struct dix_ctx *ctx, const char *ha_addr)
75 {
77  int rc;
78 
79  M0_ENTRY();
80  motr_ha_cfg = (struct m0_motr_ha_cfg){
81  .mhc_addr = ha_addr,
82  .mhc_rpc_machine = &ctx->dc_rpc_machine,
83  .mhc_reqh = &ctx->dc_reqh,
84  .mhc_dispatcher_cfg = {
85  .hdc_enable_note = true,
86  .hdc_enable_keepalive = false,
87  .hdc_enable_fvec = true
88  },
89  };
90  rc = m0_motr_ha_init(&ctx->dc_motr_ha, &motr_ha_cfg);
91  if (rc != 0)
92  return M0_ERR(rc);
93  rc = m0_motr_ha_start(&ctx->dc_motr_ha);
94  if (rc != 0) {
95  m0_motr_ha_fini(&ctx->dc_motr_ha);
96  return M0_ERR(rc);
97  }
98  m0_motr_ha_connect(&ctx->dc_motr_ha);
99  return M0_RC(rc);
100 }
101 
102 static void dix_ha_stop(struct dix_ctx *ctx)
103 {
104  M0_ENTRY();
105  m0_conf_ha_process_event_post(&ctx->dc_motr_ha.mh_ha,
106  ctx->dc_motr_ha.mh_link,
107  &ctx->dc_reqh.rh_fid, m0_process(),
110  m0_motr_ha_disconnect(&ctx->dc_motr_ha);
111  m0_motr_ha_stop(&ctx->dc_motr_ha);
112  M0_LEAVE();
113 }
114 
115 static void dix_ha_fini(struct dix_ctx *ctx)
116 {
117  m0_motr_ha_fini(&ctx->dc_motr_ha);
118 }
119 
120 static int dix_net_init(struct dix_ctx *ctx, const char *local_addr)
121 {
122  M0_LOG(M0_DEBUG, "local ep is %s", local_addr);
123  ctx->dc_laddr = local_addr;
124  return M0_RC(m0_net_domain_init(&ctx->dc_ndom,
126 }
127 
128 static int dix_rpc_init(struct dix_ctx *ctx)
129 {
130  struct m0_rpc_machine *rpc_machine = &ctx->dc_rpc_machine;
131  struct m0_reqh *reqh = &ctx->dc_reqh;
132  struct m0_net_domain *ndom = &ctx->dc_ndom;
133  const char *laddr;
134  struct m0_net_buffer_pool *buffer_pool = &ctx->dc_buffer_pool;
135  struct m0_net_transfer_mc *tm;
136  int rc;
137  uint32_t bufs_nr;
138  uint32_t tms_nr;
139 
140  M0_ENTRY();
141  tms_nr = 1;
142  bufs_nr = m0_rpc_bufs_nr(tm_recv_queue_min_len, tms_nr);
143 
144  rc = m0_rpc_net_buffer_pool_setup(ndom, buffer_pool,
145  bufs_nr, tms_nr);
146  if (rc != 0)
147  return M0_ERR(rc);
148 
149  rc = M0_REQH_INIT(reqh,
150  .rhia_dtm = (void*)1,
151  .rhia_db = NULL,
152  .rhia_mdstore = (void*)1,
153  .rhia_pc = &ctx->dc_pools_common,
154  /* fake process fid */
155  .rhia_fid = &M0_FID_TINIT(
157  if (rc != 0)
158  goto pool_fini;
159  laddr = ctx->dc_laddr;
160  rc = m0_rpc_machine_init(rpc_machine, ndom, laddr, reqh,
161  buffer_pool, M0_BUFFER_ANY_COLOUR,
163  if (rc != 0)
164  goto reqh_fini;
166  tm = &rpc_machine->rm_tm;
167  M0_ASSERT(tm->ntm_recv_pool == buffer_pool);
168  return M0_RC(rc);
169 reqh_fini:
171 pool_fini:
172  m0_rpc_net_buffer_pool_cleanup(buffer_pool);
173  return M0_ERR(rc);
174 }
175 
176 static void dix_rpc_fini(struct dix_ctx *ctx)
177 {
178  M0_ENTRY();
179 
180  m0_rpc_machine_fini(&ctx->dc_rpc_machine);
181  if (m0_reqh_state_get(&ctx->dc_reqh) != M0_REQH_ST_STOPPED)
182  m0_reqh_services_terminate(&ctx->dc_reqh);
183  m0_reqh_fini(&ctx->dc_reqh);
184  m0_rpc_net_buffer_pool_cleanup(&ctx->dc_buffer_pool);
185  M0_LEAVE();
186 }
187 
188 static void dix_net_fini(struct dix_ctx *ctx)
189 {
190  M0_ENTRY();
191  m0_net_domain_fini(&ctx->dc_ndom);
192  M0_LEAVE();
193 }
194 
195 M0_INTERNAL struct m0_rconfc *dix2rconfc(struct dix_ctx *ctx)
196 {
197  return &ctx->dc_reqh.rh_rconfc;
198 }
199 
200 static int dix_layouts_init(struct dix_ctx *ctx)
201 {
202  int rc;
203 
204  M0_ENTRY();
205  rc = m0_reqh_mdpool_layout_build(&ctx->dc_reqh);
206  return M0_RC(rc);
207 }
208 
209 static void dix_layouts_fini(struct dix_ctx *ctx)
210 {
211  M0_ENTRY();
212  m0_reqh_layouts_cleanup(&ctx->dc_reqh);
213  M0_LEAVE();
214 }
215 
217  struct m0_reqh *reqh)
218 {
219  struct m0_reqh_service *service;
220  struct m0_uint128 uuid;
221 
225  (struct m0_fid *)&uuid);
226 }
227 
229 {
230  struct m0_reqh *reqh = &ctx->dc_reqh;
231  int rc;
232 
234  if (rc != 0) {
235  M0_ERR(rc);
237  }
238  return M0_RC(rc);
239 }
240 
241 static int dix_init(struct dix_ctx *ctx,
242  const char *local_addr,
243  const char *ha_addr,
244  const char *profile)
245 {
246  struct m0_pools_common *pc = &ctx->dc_pools_common;
247  struct m0_confc_args *confc_args;
248  struct m0_reqh *reqh = &ctx->dc_reqh;
249  struct m0_conf_root *root;
250  int rc;
251 
252  M0_ENTRY();
253  rc = m0_layout_domain_init(&ctx->dc_reqh.rh_ldom);
254  if (rc != 0)
255  return M0_ERR(rc);
256  rc = m0_layout_standard_types_register(&ctx->dc_reqh.rh_ldom);
257  if (rc != 0)
258  goto err_domain_fini;
259 
261  if (rc != 0)
262  goto err_domain_fini;
263 
264  rc = dix_rpc_init(ctx);
265  if (rc != 0)
266  goto err_net_fini;
267 
268  confc_args = &(struct m0_confc_args) {
269  .ca_profile = profile,
270  .ca_rmach = &ctx->dc_rpc_machine,
271  .ca_group = m0_locality0_get()->lo_grp
272  };
273 
275  if (rc != 0)
276  goto err_ha_fini;
277 
278  rc = m0_reqh_conf_setup(reqh, confc_args);
279  if (rc != 0)
280  goto err_ha_fini;
281 
283  if (rc != 0)
284  goto err_rconfc_stop;
285 
287  if (rc != 0)
288  goto err_rconfc_stop;
289 
291  if (rc != 0)
292  goto err_conf_fs_close;
293 
294  rc = m0_pools_common_init(pc, &ctx->dc_rpc_machine);
295  if (rc != 0)
296  goto err_conf_fs_close;
297 
299  if (rc != 0)
300  goto err_pools_common_fini;
301 
303  if (rc != 0)
304  goto err_pools_destroy;
305 
307 
309  if (rc != 0)
310  goto err_pools_service_ctx_destroy;
311 
313  if (rc != 0)
314  goto err_pool_versions_destroy;
315 
317  if (rc != 0) {
319  goto err_pool_versions_destroy;
320  }
321 
323  return M0_RC(0);
324 
325 err_pool_versions_destroy:
326  m0_pool_versions_destroy(&ctx->dc_pools_common);
327 err_pools_service_ctx_destroy:
328  m0_pools_service_ctx_destroy(&ctx->dc_pools_common);
329 err_pools_destroy:
330  m0_pools_destroy(&ctx->dc_pools_common);
331 err_pools_common_fini:
332  m0_pools_common_fini(&ctx->dc_pools_common);
333 err_conf_fs_close:
335 err_rconfc_stop:
339 err_ha_fini:
340  dix_ha_stop(ctx);
341  dix_ha_fini(ctx);
342  dix_rpc_fini(ctx);
343 err_net_fini:
344  dix_net_fini(ctx);
345 err_domain_fini:
346  m0_layout_domain_fini(&ctx->dc_reqh.rh_ldom);
347  return M0_ERR(rc);
348 }
349 
350 static void dix_fini(struct dix_ctx *ctx)
351 {
353  m0_layout_domain_cleanup(&ctx->dc_reqh.rh_ldom);
354  m0_layout_standard_types_unregister(&ctx->dc_reqh.rh_ldom);
355  m0_layout_domain_fini(&ctx->dc_reqh.rh_ldom);
356  m0_pools_service_ctx_destroy(&ctx->dc_pools_common);
357  m0_pool_versions_destroy(&ctx->dc_pools_common);
358  m0_pools_destroy(&ctx->dc_pools_common);
359  m0_pools_common_fini(&ctx->dc_pools_common);
360  dix_ha_stop(ctx);
363  dix_ha_fini(ctx);
364  dix_rpc_fini(ctx);
365  dix_net_fini(ctx);
366 }
367 
368 static int dix_root_pver_find(struct dix_ctx *ctx, struct m0_fid *out)
369 {
370  struct m0_reqh *reqh = &ctx->dc_reqh;
371  struct m0_conf_root *root;
372  int rc;
373 
375  if (rc != 0)
376  return M0_ERR(rc);
377  *out = root->rt_imeta_pver;
379  return 0;
380 }
381 
382 static int dix_pver_fids_check(struct dix_ctx *ctx,
383  const struct m0_fid *root,
384  const struct m0_fid *layout,
385  const struct m0_fid *ldescr)
386 {
387  struct m0_pool_version *pv;
388  const struct m0_fid *fids[3] = { root, layout, ldescr };
389  int i;
390  int rc = 0;
391 
392  for (i = 0; i < ARRAY_SIZE(fids); i++) {
393  pv = m0_pool_version_find(&ctx->dc_pools_common, fids[i]);
394  if (pv == NULL) {
395  rc = M0_ERR(-ENOENT);
396  fprintf(stderr,
397  "Pool version for FID="FID_F" is not found.\n",
398  FID_P(fids[i]));
399  }
400  }
401  return rc;
402 }
403 
404 int main(int argc, char **argv)
405 {
406  int rc;
407  struct m0 instance;
408  struct dix_ctx ctx;
409  char *local_addr = NULL;
410  char *ha_addr = NULL;
411  char *prof = NULL;
412  char *layout_pver = NULL;
413  char *ldescr_pver = NULL;
414  char *action = NULL;
415  enum dix_action act;
416  struct m0_fid layout_pver_fid;
417  struct m0_fid ldescr_pver_fid;
418  struct m0_fid root_pver_fid;
419  struct m0_dix_ldesc dld1;
420  struct m0_dix_ldesc dld2;
421  struct m0_dix_cli cli;
422  struct m0_sm_group *sm_grp;
423  struct m0_ext range[] = {
424  { .e_start = 0, .e_end = IMASK_INF },
425  };
426 
427  M0_SET0(&instance);
430  if (rc != 0) {
431  fprintf(stderr, "Cannot init module %i\n", rc);
432  goto end;
433  }
434  M0_SET0(&ctx);
435  rc = M0_GETOPTS("m0dixinit", argc, argv,
436  M0_HELPARG('h'),
437  M0_STRINGARG('l', "Local endpoint address",
438  LAMBDA(void, (const char *string) {
439  local_addr = (char*)string;
440  })),
441  M0_STRINGARG('H', "HA address",
442  LAMBDA(void, (const char *str) {
443  ha_addr = (char*)str;
444  })),
445  M0_STRINGARG('p', "Profile options for Motr",
446  LAMBDA(void, (const char *str) {
447  prof = (char*)str;
448  })),
449  M0_STRINGARG('I', "'layout' index pool version FID",
450  LAMBDA(void, (const char *string) {
451  layout_pver = (char*)string;
452  })),
453  M0_STRINGARG('d', "'layoutd-descr' index pool version"
454  " FID",
455  LAMBDA(void, (const char *string) {
456  ldescr_pver = (char*)string;
457  })),
458  M0_STRINGARG('a', "\n\t\t\tcreate - create meta"
459  " info\n\t\t\tcheck - check meta info\n"
460  "\t\t\tdestroy - destroy meta info",
461  LAMBDA(void, (const char *string) {
462  action = (char*)string;
463  })),
464  );
465  if (rc != 0)
466  goto end;
467  if (local_addr == NULL ||
468  ha_addr == NULL ||
469  prof == NULL ||
470  action == NULL) {
471  fprintf(stderr, "Invalid parameter(s).\n");
472  rc = EINVAL;
473  goto end;
474  }
475  if (m0_streq(action, "create")) {
476  act = ACTION_CREATE;
477  } else if (m0_streq(action, "check")) {
478  act = ACTION_CHECK;
479  } else if (m0_streq(action, "destroy")) {
480  act = ACTION_DESTROY;
481  } else {
482  fprintf(stderr,
483  "Invalid action! Actions: create|check|destroy.\n");
484  rc = EINVAL;
485  goto end;
486  }
487  if (act == ACTION_CREATE &&
488  (layout_pver == NULL || ldescr_pver == NULL)) {
489  fprintf(stderr, "layout in case of CREATE is mandatory.\n");
490  rc = EINVAL;
491  goto end;
492  }
493 
494  /* Init Layout descriptors */
495  rc = m0_fid_sscanf(layout_pver, &layout_pver_fid);
496  if (rc != 0) {
497  fprintf(stderr, "Incorrect FID format for: %s\n", layout_pver);
498  goto end;
499  }
500  m0_fid_sscanf(ldescr_pver, &ldescr_pver_fid);
501  if (rc != 0) {
502  fprintf(stderr, "Incorrect FID format for: %s\n", ldescr_pver);
503  goto end;
504  }
506  if (rc != 0) {
507  fprintf(stderr, "Initialisation error: %d\n", rc);
508  goto end;
509  }
510  rc = dix_root_pver_find(&ctx, &root_pver_fid);
511  if (rc != 0) {
512  fprintf(stderr, "Can't find root pver fid: %d\n", rc);
513  goto fini;
514  }
515 
516  rc = dix_pver_fids_check(&ctx, &root_pver_fid, &layout_pver_fid,
517  &ldescr_pver_fid);
518  if (rc != 0)
519  goto fini;
520  rc = m0_dix_ldesc_init(&dld1, range, ARRAY_SIZE(range),
521  HASH_FNC_CITY, &layout_pver_fid);
522  if (rc != 0)
523  goto fini;
524  rc = m0_dix_ldesc_init(&dld2, range, ARRAY_SIZE(range),
525  HASH_FNC_CITY, &ldescr_pver_fid);
526  if (rc != 0) {
527  m0_dix_ldesc_fini(&dld1);
528  goto fini;
529  }
530 
531  if (rc == 0) {
532  sm_grp = m0_locality0_get()->lo_grp;
533  rc = m0_dix_cli_init(&cli, sm_grp, &ctx.dc_pools_common,
534  &ctx.dc_reqh.rh_ldom, &root_pver_fid);
535  if (rc != 0) {
536  fprintf(stderr,
537  "DIX client initialisation failure: (%d)\n",
538  rc);
539  goto ldesc_fini;
540  }
541  if (act == ACTION_CREATE)
543  else
544  rc = m0_dix_cli_start_sync(&cli);
545  if (rc == 0) {
546  switch(act) {
547  case ACTION_CREATE:
548  rc = m0_dix_meta_create(&cli, sm_grp, &dld1,
549  &dld2);
550  break;
551  case ACTION_CHECK:
552  {
553  bool exists = true;
554 
555  rc = m0_dix_meta_check(&cli, sm_grp, &exists);
556  if (rc == 0)
557  fprintf(stdout, "Metadata exists: %s\n",
558  exists ? "true" : "false");
559  break;
560  }
561  case ACTION_DESTROY:
562  rc = m0_dix_meta_destroy(&cli, sm_grp);
563  break;
564  default:
565  M0_IMPOSSIBLE("Wrong action");
566  }
567  fprintf(stdout, "Execution result: %s (%d)\n", rc == 0 ?
568  "Success" : "Failure", rc);
569  m0_dix_cli_stop_lock(&cli);
570  } else {
571  /*
572  * -ENOENT most probably means that root index is not
573  * created. If user checks for meta-data then don't
574  * return error, just say that metadata doesn't exist.
575  */
576  if (rc == -ENOENT && act == ACTION_CHECK) {
577  fprintf(stdout, "Metadata exists: false\n");
578  rc = 0;
579  } else {
580  fprintf(stderr,
581  "DIX client start failure: (%d)\n", rc);
582  if (rc == -ENOENT)
583  fprintf(stderr, "No metadata found?\n");
584  }
585  }
586  m0_dix_cli_fini_lock(&cli);
587  }
588 
589 ldesc_fini:
590  m0_dix_ldesc_fini(&dld1);
591  m0_dix_ldesc_fini(&dld2);
592 fini:
593  dix_fini(&ctx);
594 end:
595  return M0_RC(rc >= 0 ? rc : -rc);
596 }
597 
598 #undef M0_TRACE_SUBSYSTEM
599 
602 /*
603  * Local variables:
604  * c-indentation-style: "K&R"
605  * c-basic-offset: 8
606  * tab-width: 8
607  * fill-column: 80
608  * scroll-step: 1
609  * End:
610  */
611 /*
612  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
613  */
#define M0_GETOPTS(progname, argc, argv,...)
Definition: getopts.h:169
M0_INTERNAL uint64_t m0_process(void)
Definition: kthread.c:295
struct m0_net_domain dc_ndom
Definition: m0dixinit.c:65
M0_INTERNAL void m0_pools_common_fini(struct m0_pools_common *pc)
Definition: pool.c:1549
struct m0_uint128 uuid[1000]
Definition: uuid.c:73
void m0_rpc_machine_fini(struct m0_rpc_machine *machine)
Definition: rpc_machine.c:233
M0_INTERNAL void m0_reqh_services_terminate(struct m0_reqh *reqh)
Definition: reqh.c:675
M0_INTERNAL void m0_dix_cli_stop_lock(struct m0_dix_cli *cli)
Definition: client.c:261
static bool exists(const struct m0_ut_module *m, const char *s_name, const char *t_name)
Definition: ut.c:169
void m0_net_domain_fini(struct m0_net_domain *dom)
Definition: domain.c:71
static int dix_root_pver_find(struct dix_ctx *ctx, struct m0_fid *out)
Definition: m0dixinit.c:368
static int dix_init(struct dix_ctx *ctx, const char *local_addr, const char *ha_addr, const char *profile)
Definition: m0dixinit.c:241
M0_INTERNAL int m0_motr_ha_start(struct m0_motr_ha *mha)
Definition: ha.c:549
M0_INTERNAL int m0_dix_meta_create(struct m0_dix_cli *cli, struct m0_sm_group *grp, struct m0_dix_ldesc *dld_layout, struct m0_dix_ldesc *dld_ldescr)
Definition: meta.c:326
#define NULL
Definition: misc.h:38
M0_INTERNAL int m0_conf_full_load(struct m0_conf_root *r)
Definition: helpers.c:165
static void dix_layouts_fini(struct dix_ctx *ctx)
Definition: m0dixinit.c:209
M0_INTERNAL int m0_layout_domain_init(struct m0_layout_domain *dom)
Definition: layout.c:610
#define M0_REQH_INIT(reqh,...)
Definition: reqh.h:262
M0_INTERNAL void m0_uuid_generate(struct m0_uint128 *u)
Definition: uuid.c:44
M0_INTERNAL struct m0_pool_version * m0_pool_version_find(struct m0_pools_common *pc, const struct m0_fid *id)
Definition: pool.c:586
static uint32_t max_rpc_msg_size
Definition: m0dixinit.c:72
static void dix_rpc_fini(struct dix_ctx *ctx)
Definition: m0dixinit.c:176
struct m0_conf_obj rt_obj
Definition: obj.h:372
struct m0_pool_version * pv
Definition: dir.c:629
static struct m0_motr_ha_cfg motr_ha_cfg
Definition: client_init.c:714
#define M0_LOG(level,...)
Definition: trace.h:167
M0_LEAVE()
M0_INTERNAL void m0_reqh_layouts_cleanup(struct m0_reqh *reqh)
Definition: reqh.c:169
static char * local_addr
Definition: m0hsm.c:42
uint8_t ft_id
Definition: fid.h:101
const struct m0_conf_obj_type M0_CONF_SERVICE_TYPE
Definition: service.c:156
Definition: beck.c:189
int main(int argc, char **argv)
Definition: m0dixinit.c:404
M0_INTERNAL void m0_layout_domain_fini(struct m0_layout_domain *dom)
Definition: layout.c:633
M0_INTERNAL void m0_rconfc_stop_sync(struct m0_rconfc *rconfc)
Definition: rconfc.c:2995
struct m0_rpc_machine dc_rpc_machine
Definition: m0dixinit.c:66
M0_INTERNAL void m0_instance_setup(struct m0 *instance)
Definition: instance.c:110
static int dix_service_start(struct m0_reqh_service_type *stype, struct m0_reqh *reqh)
Definition: m0dixinit.c:216
const char * dc_laddr
Definition: m0dixinit.c:64
static char * ha_addr
Definition: m0hsm.c:43
#define M0_SET0(obj)
Definition: misc.h:64
static char * prof
Definition: st_kmain.c:50
M0_INTERNAL int m0_pools_setup(struct m0_pools_common *pc, const struct m0_fid *profile, struct m0_sm_group *sm_grp, struct m0_dtm *dtm)
Definition: pool.c:1810
M0_INTERNAL void m0_reqh_fini(struct m0_reqh *reqh)
Definition: reqh.c:320
M0_INTERNAL int m0_motr_ha_init(struct m0_motr_ha *mha, struct m0_motr_ha_cfg *mha_cfg)
Definition: ha.c:509
static struct m0_pools_common pc
Definition: iter_ut.c:59
struct m0_pools_common dc_pools_common
Definition: m0dixinit.c:62
M0_INTERNAL void m0_motr_ha_disconnect(struct m0_motr_ha *mha)
Definition: ha.c:578
M0_INTERNAL int m0_confc_root_open(struct m0_confc *confc, struct m0_conf_root **root)
Definition: helpers.c:219
return M0_RC(rc)
#define M0_ENTRY(...)
Definition: trace.h:170
static void dix_ha_fini(struct dix_ctx *ctx)
Definition: m0dixinit.c:115
static void dix_ha_stop(struct dix_ctx *ctx)
Definition: m0dixinit.c:102
M0_INTERNAL struct m0_fid * m0_reqh2profile(struct m0_reqh *reqh)
Definition: reqh.c:758
#define M0_STRINGARG(ch, desc, func)
Definition: getopts.h:207
int i
Definition: dir.c:1033
struct m0_conf_root * root
Definition: note.c:50
return M0_ERR(-EOPNOTSUPP)
#define LAMBDA(T,...)
Definition: thread.h:153
M0_INTERNAL struct m0_confc * m0_reqh2confc(struct m0_reqh *reqh)
Definition: reqh.c:753
#define M0_FID_TINIT(type, container, key)
Definition: fid.h:90
static const struct socktype stype[]
Definition: sock.c:1156
struct m0_fid rt_imeta_pver
Definition: obj.h:403
const struct m0_fid_type cot_ftype
Definition: obj.h:314
M0_INTERNAL int m0_reqh_conf_setup(struct m0_reqh *reqh, struct m0_confc_args *args)
Definition: reqh.c:729
struct m0_net_transfer_mc rm_tm
Definition: rpc_machine.h:88
#define M0_ASSERT(cond)
M0_INTERNAL int m0_dix_cli_start_sync(struct m0_dix_cli *cli)
Definition: client.c:221
M0_INTERNAL void m0_pools_common_service_ctx_connect_sync(struct m0_pools_common *pc)
Definition: pool.c:1608
M0_INTERNAL int m0_rpc_net_buffer_pool_setup(struct m0_net_domain *ndom, struct m0_net_buffer_pool *app_pool, uint32_t bufs_nr, uint32_t tm_nr)
Definition: rpc.c:229
#define m0_streq(a, b)
Definition: string.h:34
M0_INTERNAL uint32_t m0_rpc_bufs_nr(uint32_t len, uint32_t tms_nr)
Definition: rpc.c:271
static void dix_net_fini(struct dix_ctx *ctx)
Definition: m0dixinit.c:188
static int dix_reqh_services_start(struct dix_ctx *ctx)
Definition: m0dixinit.c:228
M0_INTERNAL int m0_dix_ldesc_init(struct m0_dix_ldesc *ld, struct m0_ext *range, m0_bcount_t range_nr, enum m0_dix_hash_fnc_type htype, struct m0_fid *pver)
Definition: layout.c:171
const char * mhc_addr
Definition: ha.h:48
M0_INTERNAL int m0_dix_meta_check(struct m0_dix_cli *cli, struct m0_sm_group *grp, bool *result)
Definition: meta.c:343
Definition: instance.h:80
M0_INTERNAL int m0_rpc_machine_init(struct m0_rpc_machine *machine, struct m0_net_domain *net_dom, const char *ep_addr, struct m0_reqh *reqh, struct m0_net_buffer_pool *receive_pool, uint32_t colour, m0_bcount_t msg_size, uint32_t queue_len)
Definition: rpc_machine.c:123
struct m0_net_xprt * m0_net_xprt_default_get(void)
Definition: net.c:151
M0_INTERNAL void m0_pools_service_ctx_destroy(struct m0_pools_common *pc)
Definition: pool.c:1617
M0_INTERNAL int m0_reqh_mdpool_layout_build(struct m0_reqh *reqh)
Definition: reqh.c:145
static int dix_ha_init(struct dix_ctx *ctx, const char *ha_addr)
Definition: m0dixinit.c:74
static int m0_rconfc_start_sync(struct m0_rconfc *rconfc)
Definition: rconfc.h:502
Definition: reqh.h:94
struct m0_reqh dc_reqh
Definition: m0dixinit.c:67
struct m0_sm_group * lo_grp
Definition: locality.h:67
M0_INTERNAL void m0_motr_ha_connect(struct m0_motr_ha *mha)
Definition: ha.c:567
static const struct m0_fid fids[]
Definition: diter.c:76
M0_INTERNAL int m0_reqh_service_setup(struct m0_reqh_service **out, struct m0_reqh_service_type *stype, struct m0_reqh *reqh, struct m0_reqh_context *rctx, const struct m0_fid *fid)
Definition: reqh_service.c:565
M0_INTERNAL int m0_fid_sscanf(const char *s, struct m0_fid *fid)
Definition: fid.c:227
M0_INTERNAL int m0_layout_standard_types_register(struct m0_layout_domain *dom)
Definition: layout.c:671
#define FID_P(f)
Definition: fid.h:77
static int dix_rpc_init(struct dix_ctx *ctx)
Definition: m0dixinit.c:128
M0_INTERNAL int m0_dix_cli_init(struct m0_dix_cli *cli, struct m0_sm_group *sm_group, struct m0_pools_common *pc, struct m0_layout_domain *ldom, const struct m0_fid *pver)
Definition: client.c:130
M0_INTERNAL void m0_rconfc_fini(struct m0_rconfc *rconfc)
Definition: rconfc.c:3009
M0_INTERNAL int m0_reqh_state_get(struct m0_reqh *reqh)
Definition: reqh.c:398
M0_INTERNAL void m0_dix_ldesc_fini(struct m0_dix_ldesc *ld)
Definition: layout.c:197
struct m0_reqh_service_type m0_rms_type
Definition: rm_service.c:69
Definition: ha.h:54
M0_INTERNAL void m0_dix_cli_bootstrap_lock(struct m0_dix_cli *cli)
Definition: client.c:245
M0_INTERNAL void m0_reqh_start(struct m0_reqh *reqh)
Definition: reqh.c:711
struct m0_reqh reqh
Definition: rm_foms.c:48
static struct m0_fid profile
Definition: rconfc.c:49
int m0_net_domain_init(struct m0_net_domain *dom, const struct m0_net_xprt *xprt)
Definition: domain.c:36
M0_INTERNAL int m0_pools_common_init(struct m0_pools_common *pc, struct m0_rpc_machine *rmach)
Definition: pool.c:1425
M0_INTERNAL struct m0_locality * m0_locality0_get(void)
Definition: locality.c:169
M0_INTERNAL int m0_dix_meta_destroy(struct m0_dix_cli *cli, struct m0_sm_group *grp)
Definition: meta.c:467
M0_INTERNAL void m0_layout_domain_cleanup(struct m0_layout_domain *dom)
Definition: layout.c:653
Definition: ext.h:37
Definition: fid.h:38
m0_bindex_t e_start
Definition: ext.h:39
static void dix_fini(struct dix_ctx *ctx)
Definition: m0dixinit.c:350
M0_INTERNAL void m0_conf_ha_process_event_post(struct m0_ha *ha, struct m0_ha_link *hl, const struct m0_fid *process_fid, uint64_t pid, enum m0_conf_ha_process_event event, enum m0_conf_ha_process_type type)
Definition: ha.c:45
M0_INTERNAL int m0_pools_service_ctx_create(struct m0_pools_common *pc)
Definition: pool.c:1535
#define M0_HELPARG(ch)
Definition: getopts.h:242
struct m0_motr_ha dc_motr_ha
Definition: m0dixinit.c:63
M0_INTERNAL void m0_layout_standard_types_unregister(struct m0_layout_domain *dom)
Definition: layout.c:697
static struct m0 instance
Definition: main.c:78
static int dix_net_init(struct dix_ctx *ctx, const char *local_addr)
Definition: m0dixinit.c:120
int fini(struct workload *w)
dix_action
Definition: m0dixinit.c:55
M0_INTERNAL void m0_confc_close(struct m0_conf_obj *obj)
Definition: confc.c:921
static void reqh_fini(void)
Definition: ms_fom_ut.c:351
M0_INTERNAL void m0_motr_ha_stop(struct m0_motr_ha *mha)
Definition: ha.c:560
struct m0_net_buffer_pool dc_buffer_pool
Definition: m0dixinit.c:68
M0_INTERNAL void m0_dix_cli_fini_lock(struct m0_dix_cli *cli)
Definition: client.c:278
const struct m0_conf_obj_type M0_CONF_PROCESS_TYPE
Definition: process.c:161
Definition: nucleus.c:42
#define out(...)
Definition: gen.c:41
M0_INTERNAL int m0_pool_versions_setup(struct m0_pools_common *pc)
Definition: pool.c:1640
void m0_rpc_net_buffer_pool_cleanup(struct m0_net_buffer_pool *app_pool)
Definition: rpc.c:264
M0_INTERNAL void m0_pool_versions_destroy(struct m0_pools_common *pc)
Definition: pool.c:1876
M0_INTERNAL void m0_motr_ha_fini(struct m0_motr_ha *mha)
Definition: ha.c:537
struct m0_module i_self
Definition: instance.h:88
const char * ca_profile
Definition: helpers.h:34
static uint32_t tm_recv_queue_min_len
Definition: m0dixinit.c:71
static int dix_pver_fids_check(struct dix_ctx *ctx, const struct m0_fid *root, const struct m0_fid *layout, const struct m0_fid *ldescr)
Definition: m0dixinit.c:382
M0_INTERNAL struct m0_rconfc * dix2rconfc(struct dix_ctx *ctx)
Definition: m0dixinit.c:195
static struct m0_reqh_service * service[REQH_IN_UT_MAX]
Definition: long_lock_ut.c:46
static struct m0_rpc_machine rpc_machine
Definition: service_ut.c:63
int32_t rc
Definition: trigger_fop.h:47
#define ARRAY_SIZE(a)
Definition: misc.h:45
static int dix_layouts_init(struct dix_ctx *ctx)
Definition: m0dixinit.c:200
#define FID_F
Definition: fid.h:75
M0_INTERNAL int m0_module_init(struct m0_module *module, int level)
Definition: module.c:131
M0_INTERNAL void m0_fid_tassume(struct m0_fid *fid, const struct m0_fid_type *ft)
Definition: fid.c:146
#define M0_IMPOSSIBLE(fmt,...)
M0_INTERNAL void m0_pools_destroy(struct m0_pools_common *pc)
Definition: pool.c:1887
struct m0_net_buffer_pool * ntm_recv_pool
Definition: net.h:896