Motr  M0
setup.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2013-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 #pragma once
23 
24 #ifndef __MOTR_MOTR_MOTR_SETUP_H__
25 #define __MOTR_MOTR_MOTR_SETUP_H__
26 
27 #include <stdio.h> /* FILE */
28 
29 #include "lib/tlist.h"
30 #include "lib/types.h" /* m0_uint128 */
31 #include "reqh/reqh_service.h"
32 #include "stob/stob.h"
33 #include "net/lnet/lnet.h" /* M0_NET_LNET_XEP_ADDR_LEN */
34 #include "net/buffer_pool.h"
35 #include "mdstore/mdstore.h" /* m0_mdstore */
36 #include "fol/fol.h" /* m0_fol */
37 #include "reqh/reqh.h" /* m0_reqh */
38 #include "yaml.h" /* yaml_document_t */
39 
40 #include "be/ut/helper.h" /* m0_be_ut_backend_seg_add2 */
41 #include "dtm0/domain.h" /* m0_dtm0_domain */
42 #include "pool/pool.h" /* m0_pools_common */
43 #include "ha/ha.h" /* m0_ha */
44 #include "motr/ha.h" /* m0_motr_ha */
45 #include "module/module.h" /* m0_module */
46 
134 enum {
136 };
137 
138 enum {
140  M0_ADDB2_STOB_DOM_KEY = 0xaddbf11e, /* ADDB file */
141  M0_BE_SEG_SIZE_DEFAULT = 128 * 1024 * 1024ULL,
142 };
143 
144 enum stob_type {
148 };
149 
151 M0_EXTERN const char *m0_cs_stypes[M0_STOB_TYPE_NR];
152 
156 struct cs_args {
157  int ca_argc;
159  char **ca_argv;
160 };
161 
169  const char *ex_cep;
174  const char *ex_endpoint;
176  const char *ex_xprt;
180  char *ex_scrbuf;
181  uint64_t ex_magix;
188  uint32_t ex_tm_colour;
189 };
190 
197 struct cs_stob_file {
199  yaml_document_t sf_document;
200 };
201 
206 struct cs_stobs {
213 };
214 
220 };
221 
231  const char *rc_stpath;
232 
234  const char *rc_addb_stlocation;
235 
237  const char *rc_dfilepath;
238 
240  const char *rc_stype;
241 
243  const char *rc_bepath;
244 
246  char **rc_services;
247 
250 
252  uint32_t rc_nr_services;
253 
255  struct m0_tl rc_eps;
256 
262 
265 
269 
271 
276  const char *rc_be_log_path;
277  const char *rc_be_seg0_path;
278  const char *rc_be_seg_path;
291 
301  const char *rc_confdb;
302 
305 
307 
309  struct m0_fol *rc_fol;
310 
312  struct m0_reqh rc_reqh;
313 
315  uint64_t rc_magix;
316 
318  struct m0_motr *rc_motr;
319 
325 
333 
336 
338  struct m0_fid rc_fid;
339 
342 
345 
348 };
349 
354 struct m0_motr {
357 
360 
362 
365 
367  size_t cc_xprts_nr;
368 
374  struct m0_tl cc_ndoms;
375 
383  FILE *cc_outfile;
384 
390 
397 
399 
402 
405 
408 
409  uint32_t cc_pool_width;
410 
413  char *cc_ha_addr;
416  bool cc_daemon;
417 
419  bool cc_mkfs;
420 
422  bool cc_force;
423 
426 
429 
432 
435 
437  struct cs_args cc_args;
438 
441 
447 
455 
457  uint64_t cc_magic;
458 
461 
467 
470 };
471 
472 enum {
473  CS_MAX_EP_ADDR_LEN = 86 /* "lnet:" + M0_NET_LNET_XEP_ADDR_LEN */
474 };
476 
477 struct cs_ad_stob {
482  uint64_t as_magix;
484 };
485 
495 int m0_cs_init(struct m0_motr *cs_motr,
496  struct m0_net_xprt **xprts, size_t xprts_nr, FILE *out, bool mkfs);
500 void m0_cs_fini(struct m0_motr *cs_motr);
501 
513 int m0_cs_setup_env(struct m0_motr *cs_motr, int argc, char **argv);
514 
522 int m0_cs_start(struct m0_motr *cs_motr);
523 
524 M0_INTERNAL struct m0_rpc_machine *m0_motr_to_rmach(struct m0_motr *motr);
525 
526 M0_INTERNAL struct m0_confc *m0_motr2confc(struct m0_motr *motr);
527 
533 struct m0_reqh *m0_cs_reqh_get(struct m0_motr *cctx);
534 
540 M0_INTERNAL struct m0_motr *m0_cs_ctx_get(struct m0_reqh *reqh);
541 
547 M0_INTERNAL struct m0_reqh_context *m0_cs_reqh_context(struct m0_reqh *reqh);
548 
553 M0_INTERNAL struct m0_storage_devs *m0_cs_storage_devs_get(void);
554 
561 M0_INTERNAL struct m0_net_domain *m0_cs_net_domain_locate(struct m0_motr *cctx,
562  const char *xprtname);
563 
569 M0_INTERNAL int m0_ep_and_xprt_extract(struct cs_endpoint_and_xprt *epx,
570  const char *ep);
571 
576 M0_INTERNAL void m0_ep_and_xprt_fini(struct cs_endpoint_and_xprt *epx);
577 
578 M0_TL_DESCR_DECLARE(cs_eps, extern);
579 M0_TL_DECLARE(cs_eps, M0_INTERNAL, struct cs_endpoint_and_xprt);
581 
586 M0_INTERNAL int m0_motr_stob_reopen(struct m0_reqh *reqh,
587  struct m0_poolmach *pm,
588  uint32_t dev_id);
589 
592 #endif /* __MOTR_MOTR_MOTR_SETUP_H__ */
593 
594 /*
595  * Local variables:
596  * c-indentation-style: "K&R"
597  * c-basic-offset: 8
598  * tab-width: 8
599  * fill-column: 80
600  * scroll-step: 1
601  * End:
602  */
Definition: fol.h:140
const char * ex_endpoint
Definition: setup.h:174
FILE * cc_outfile
Definition: setup.h:383
m0_bcount_t rc_addb_record_file_size
Definition: setup.h:347
char ** cc_setup_env_argv
Definition: setup.h:454
size_t cc_xprts_nr
Definition: setup.h:367
struct m0_reqh * m0_cs_reqh_get(struct m0_motr *cctx)
Definition: setup.c:1762
m0_bcount_t rc_be_tx_group_reg_size_max
Definition: setup.h:284
bool cc_enable_finj
Definition: setup.h:434
uint64_t cc_magic
Definition: setup.h:457
M0_EXTERN const char * m0_cs_stypes[M0_STOB_TYPE_NR]
Definition: setup.h:151
const char * rc_stpath
Definition: setup.h:231
struct cs_args cc_args
Definition: setup.h:437
m0_bcount_t rc_be_tx_group_reg_nr_max
Definition: setup.h:283
struct m0_cob_domain_id rc_cdom_id
Definition: setup.h:306
m0_bcount_t rc_be_tx_group_tx_nr_max
Definition: setup.h:282
M0_INTERNAL int m0_motr_stob_reopen(struct m0_reqh *reqh, struct m0_poolmach *pm, uint32_t dev_id)
Definition: setup.c:3043
struct m0_motr_ha cc_motr_ha
Definition: setup.h:411
uint64_t m0_time_t
Definition: time.h:37
bool cc_skip_pools_and_ha_update
Definition: setup.h:466
const char * rc_confdb
Definition: setup.h:301
int m0_cs_setup_env(struct m0_motr *cctx, int argc, char **argv)
Definition: setup.c:2972
void m0_cs_fini(struct m0_motr *cctx)
Definition: setup.c:3029
char * ex_scrbuf
Definition: setup.h:180
uint32_t cc_pool_width
Definition: setup.h:409
struct m0_stob_domain * s_sdom
Definition: setup.h:208
m0_time_t rc_be_tx_group_freeze_timeout_max
Definition: setup.h:290
bool rc_be_seg_preallocate
Definition: setup.h:335
const char * rc_stype
Definition: setup.h:240
static struct m0_rpc_client_ctx cctx
Definition: rconfc.c:69
uint64_t m0_bcount_t
Definition: types.h:77
const char * rc_bepath
Definition: setup.h:243
bool cc_no_conf
Definition: setup.h:428
char ** ca_argv
Definition: setup.h:159
const char * ex_xprt
Definition: setup.h:176
struct m0_tl cc_ndoms
Definition: setup.h:374
struct m0_motr * rc_motr
Definition: setup.h:318
M0_INTERNAL struct m0_rpc_machine * m0_motr_to_rmach(struct m0_motr *motr)
Definition: setup.c:196
struct m0_fol * rc_fol
Definition: setup.h:309
const char * rc_dfilepath
Definition: setup.h:237
struct m0_be_ut_backend rc_be
Definition: setup.h:267
uint64_t rc_magix
Definition: setup.h:315
m0_bcount_t rc_be_tx_reg_size_max
Definition: setup.h:287
struct m0_stob * as_stob_back
Definition: setup.h:481
bool cc_force
Definition: setup.h:422
m0_time_t rc_be_tx_group_freeze_timeout_min
Definition: setup.h:289
Definition: sock.c:754
uint32_t rc_nr_services
Definition: setup.h:252
uint32_t rc_recv_queue_min_length
Definition: setup.h:324
struct m0_rwlock cc_rwlock
Definition: setup.h:359
m0_bcount_t rc_be_tx_payload_size_max
Definition: setup.h:288
stob_type
Definition: setup.h:144
Definition: stob.h:163
M0_BOB_DECLARE(M0_INTERNAL, cs_endpoint_and_xprt)
m0_bcount_t rc_be_tx_group_payload_size_max
Definition: setup.h:285
struct m0_be_seg * rc_beseg
Definition: setup.h:268
bool cc_no_storage
Definition: setup.h:425
M0_BASSERT(CS_MAX_EP_ADDR_LEN >=sizeof "lnet:"+M0_NET_LNET_XEP_ADDR_LEN)
m0_bcount_t rc_be_seg_size
Definition: setup.h:280
struct m0_tl rc_eps
Definition: setup.h:255
bool sf_is_initialised
Definition: setup.h:198
Definition: tlist.h:251
M0_INTERNAL struct m0_reqh_context * m0_cs_reqh_context(struct m0_reqh *reqh)
Definition: setup.c:1773
struct m0_reqh rc_reqh
Definition: setup.h:312
M0_TL_DECLARE(cs_eps, M0_INTERNAL, struct cs_endpoint_and_xprt)
struct m0_tl cc_buffer_pools
Definition: setup.h:389
bool cc_no_all2all_connections
Definition: setup.h:431
bool cc_ha_was_started
Definition: setup.h:469
M0_INTERNAL struct m0_confc * m0_motr2confc(struct m0_motr *motr)
Definition: setup.c:191
Definition: setup.h:156
int cc_setup_env_argc
Definition: setup.h:452
yaml_document_t sf_document
Definition: setup.h:199
bool cc_mkfs
Definition: setup.h:419
Definition: reqh.h:94
M0_INTERNAL struct m0_net_domain * m0_cs_net_domain_locate(struct m0_motr *cctx, const char *xprt_name)
Definition: setup.c:466
const char * rc_be_seg_path
Definition: setup.h:278
struct ping_xprt xprts[1]
Definition: main.c:71
const char * ex_cep
Definition: setup.h:169
struct m0_conf_root * cc_conf_root
Definition: setup.h:460
size_t cc_recv_queue_min_length
Definition: setup.h:396
Definition: seg.h:66
uint32_t rc_max_rpc_msg_size
Definition: setup.h:332
uint32_t ex_tm_colour
Definition: setup.h:188
M0_INTERNAL struct m0_storage_devs * m0_cs_storage_devs_get(void)
Definition: setup.c:1783
bool rc_fis_enabled
Definition: setup.h:344
m0_bcount_t rc_be_tx_reg_nr_max
Definition: setup.h:286
struct m0_dtm0_domain rc_dtm0_domain
Definition: setup.h:270
Definition: ha.h:54
bool cc_daemon
Definition: setup.h:416
uint64_t as_magix
Definition: setup.h:482
struct m0_fid rc_fid
Definition: setup.h:338
int m0_cs_init(struct m0_motr *cctx, struct m0_net_xprt **xprts, size_t xprts_nr, FILE *out, bool mkfs)
Definition: setup.c:2999
Definition: setup.h:354
int ca_argc
Definition: setup.h:157
struct m0_reqh reqh
Definition: rm_foms.c:48
struct m0_tl cc_mds_eps
Definition: setup.h:407
struct m0_reqh_context cc_reqh_ctx
Definition: setup.h:361
Definition: fid.h:38
struct m0_stob_domain * as_dom
Definition: setup.h:479
struct m0_motr motr
const char * rc_be_log_path
Definition: setup.h:276
struct cs_stob_file s_sfile
Definition: setup.h:210
uint64_t ex_magix
Definition: setup.h:181
struct m0_fid * rc_service_fids
Definition: setup.h:249
const char * rc_be_seg0_path
Definition: setup.h:277
struct m0_tlink as_linkage
Definition: setup.h:483
char * cc_ha_addr
Definition: setup.h:413
int m0_cs_start(struct m0_motr *cctx)
Definition: setup.c:2987
M0_INTERNAL int m0_ep_and_xprt_extract(struct cs_endpoint_and_xprt *epx, const char *ep)
Definition: setup.c:326
m0_bcount_t cc_sns_buf_nr
Definition: setup.h:440
enum cs_reqh_ctx_states rc_state
Definition: setup.h:261
bool s_ad_disks_init
Definition: setup.h:212
struct m0_net_xprt ** cc_xprts
Definition: setup.h:364
size_t cc_max_rpc_msg_size
Definition: setup.h:398
struct cs_stobs rc_stob
Definition: setup.h:264
#define out(...)
Definition: gen.c:41
bool rc_disable_direct_io
Definition: setup.h:341
struct m0_pools_common cc_pools_common
Definition: setup.h:356
struct m0_mdstore rc_mdstore
Definition: setup.h:304
const char * rc_addb_stlocation
Definition: setup.h:234
struct cs_endpoint_and_xprt cc_stats_svc_epx
Definition: setup.h:401
M0_TL_DESCR_DECLARE(cs_eps, extern)
struct m0_tlink ex_linkage
Definition: setup.h:183
struct m0_tl cc_ios_eps
Definition: setup.h:404
M0_INTERNAL struct m0_motr * m0_cs_ctx_get(struct m0_reqh *reqh)
Definition: setup.c:1778
char ** rc_services
Definition: setup.h:246
cs_reqh_ctx_states
Definition: setup.h:216
m0_bcount_t rc_be_log_size
Definition: setup.h:281
M0_INTERNAL void m0_ep_and_xprt_fini(struct cs_endpoint_and_xprt *epx)
Definition: setup.c:361
bool cc_ha_is_started
Definition: setup.h:412
int ca_argc_max
Definition: setup.h:158
struct m0_module cc_module
Definition: setup.h:446