Motr  M0
note.c File Reference
#include "ha/note.h"
#include "conf/pvers.h"
#include "conf/obj_ops.h"
#include "conf/helpers.h"
#include "rpc/rpclib.h"
#include "ha/note.c"
#include "lib/trace.h"
#include "lib/fs.h"
#include "lib/finject.h"
#include "ut/misc.h"
#include "ut/ut.h"
Include dependency graph for note.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_HA
 
#define CLIENT_DB_NAME   "ha_ut_client.db"
 
#define CLIENT_ENDPOINT_ADDR   "0@lo:12345:34:*"
 
#define SERVER_DB_NAME   "ha_ut_confd_server.db"
 
#define SERVER_STOB_NAME   "ha_ut_confd_server.stob"
 
#define SERVER_ADDB_STOB_NAME   "linuxstob:ha_ut_confd_server.addb_stob"
 
#define SERVER_LOG_NAME   "ha_ut_confd_server.log"
 
#define SERVER_ENDPOINT_ADDR   "0@lo:12345:34:1"
 
#define SERVER_ENDPOINT   M0_NET_XPRT_PREFIX_DEFAULT":"SERVER_ENDPOINT_ADDR
 

Enumerations

enum  {
  CLIENT_COB_DOM_ID = 16, SESSION_SLOTS = 1, MAX_RPCS_IN_FLIGHT = 1, NR_EQUEUE_LENGTH = 5,
  NR_FAILURES = 10, NR_OVERLAP = 5, NR_NO_OVERLAP = 10, NR_NODES = 10,
  NR_DISKS = 200, MAX_FAILURES = 20, NR_SPARE = 20
}
 

Functions

static void start_rpc_client_and_server (void)
 
static void stop_rpc_client_and_server (void)
 
static void ast_thread (int _ M0_UNUSED)
 
static int ast_thread_init (void)
 
static void ast_thread_fini (void)
 
static void done_get_chan_init (void)
 
static void done_get_chan_fini (void)
 
static void local_confc_init (struct m0_confc *confc)
 
static void compare_ha_state (struct m0_confc *confc, enum m0_ha_obj_state state)
 
static void pool_machine_fid_populate (struct m0_poolmach *pool_mach)
 
static int pm_event_construct_and_apply (struct m0_poolmach *pm, uint32_t dev_idx, uint32_t state)
 
static void test_ha_state_set_and_get (void)
 
static void test_ha_state_accept (void)
 
static void ha_ut_conf_init (struct m0_reqh *reqh)
 
static void ha_ut_conf_fini (struct m0_reqh *reqh)
 
static void ha_ut_pver_kind_check (const struct m0_fid *pver_fid, enum m0_conf_pver_kind expected)
 
static bool test_is_objv (const struct m0_conf_obj *obj)
 
static void check_pver_subtree (struct m0_confc *confc, const struct m0_fid *pver_fid)
 
static void test_failvec_fetch (void)
 
static void ha_state_accept_1 (const struct m0_fid *fid, uint32_t state)
 
static uint32_t recd_disks (const struct m0_conf_pver *pver)
 
static void test_poolversion_get (void)
 
static void test_ha_session_states (void)
 
static int ha_state_ut_init (void)
 
static int ha_state_ut_fini (void)
 

Variables

static struct m0_net_domain client_net_dom
 
struct m0_conf_rootroot
 
static struct m0_rpc_client_ctx cctx
 
static char * server_argv []
 
static struct m0_rpc_server_ctx sctx
 
static struct m0_reqh_init_args reqh_args
 
struct m0_reqh_service_type m0_rpc_service_type
 
static struct m0_mutex chan_lock
 
static struct m0_chan chan
 
static struct m0_clink clink
 
static struct m0_sm_group g_grp
 
struct {
   bool   run
 
   struct m0_thread   thread
 
g_ast
 
struct m0_ut_suite ha_state_ut
 

Macro Definition Documentation

◆ CLIENT_DB_NAME

#define CLIENT_DB_NAME   "ha_ut_client.db"

Definition at line 39 of file note.c.

◆ CLIENT_ENDPOINT_ADDR

#define CLIENT_ENDPOINT_ADDR   "0@lo:12345:34:*"

Definition at line 40 of file note.c.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_HA

Definition at line 31 of file note.c.

◆ SERVER_ADDB_STOB_NAME

#define SERVER_ADDB_STOB_NAME   "linuxstob:ha_ut_confd_server.addb_stob"

Definition at line 44 of file note.c.

◆ SERVER_DB_NAME

#define SERVER_DB_NAME   "ha_ut_confd_server.db"

Definition at line 42 of file note.c.

◆ SERVER_ENDPOINT

#define SERVER_ENDPOINT   M0_NET_XPRT_PREFIX_DEFAULT":"SERVER_ENDPOINT_ADDR

Definition at line 47 of file note.c.

◆ SERVER_ENDPOINT_ADDR

#define SERVER_ENDPOINT_ADDR   "0@lo:12345:34:1"

Definition at line 46 of file note.c.

◆ SERVER_LOG_NAME

#define SERVER_LOG_NAME   "ha_ut_confd_server.log"

Definition at line 45 of file note.c.

◆ SERVER_STOB_NAME

#define SERVER_STOB_NAME   "ha_ut_confd_server.stob"

Definition at line 43 of file note.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
CLIENT_COB_DOM_ID 
SESSION_SLOTS 
MAX_RPCS_IN_FLIGHT 
NR_EQUEUE_LENGTH 
NR_FAILURES 
NR_OVERLAP 
NR_NO_OVERLAP 
NR_NODES 
NR_DISKS 
MAX_FAILURES 
NR_SPARE 

Definition at line 52 of file note.c.

Function Documentation

◆ ast_thread()

static void ast_thread ( int _  M0_UNUSED)
static

Definition at line 138 of file note.c.

Here is the caller graph for this function:

◆ ast_thread_fini()

static void ast_thread_fini ( void  )
static

Definition at line 156 of file note.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ast_thread_init()

static int ast_thread_init ( void  )
static

Definition at line 148 of file note.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_pver_subtree()

static void check_pver_subtree ( struct m0_confc confc,
const struct m0_fid pver_fid 
)
static

Ensures that pver subtree exists and is traversable.

Definition at line 362 of file note.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compare_ha_state()

static void compare_ha_state ( struct m0_confc confc,
enum m0_ha_obj_state  state 
)
static

Definition at line 204 of file note.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ done_get_chan_fini()

static void done_get_chan_fini ( void  )
static

Definition at line 173 of file note.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ done_get_chan_init()

static void done_get_chan_init ( void  )
static

Definition at line 165 of file note.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ha_state_accept_1()

static void ha_state_accept_1 ( const struct m0_fid fid,
uint32_t  state 
)
static

Definition at line 461 of file note.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ha_state_ut_fini()

static int ha_state_ut_fini ( void  )
static

Definition at line 629 of file note.c.

Here is the call graph for this function:

◆ ha_state_ut_init()

static int ha_state_ut_init ( void  )
static

Definition at line 617 of file note.c.

Here is the call graph for this function:

◆ ha_ut_conf_fini()

static void ha_ut_conf_fini ( struct m0_reqh reqh)
static

Definition at line 338 of file note.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ha_ut_conf_init()

static void ha_ut_conf_init ( struct m0_reqh reqh)
static

Definition at line 318 of file note.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ha_ut_pver_kind_check()

static void ha_ut_pver_kind_check ( const struct m0_fid pver_fid,
enum m0_conf_pver_kind  expected 
)
static

Definition at line 345 of file note.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ local_confc_init()

static void local_confc_init ( struct m0_confc confc)
static

Definition at line 181 of file note.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pm_event_construct_and_apply()

static int pm_event_construct_and_apply ( struct m0_poolmach pm,
uint32_t  dev_idx,
uint32_t  state 
)
static

Definition at line 449 of file note.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pool_machine_fid_populate()

static void pool_machine_fid_populate ( struct m0_poolmach pool_mach)
static

Definition at line 440 of file note.c.

Here is the caller graph for this function:

◆ recd_disks()

static uint32_t recd_disks ( const struct m0_conf_pver pver)
static

Definition at line 468 of file note.c.

Here is the caller graph for this function:

◆ start_rpc_client_and_server()

static void start_rpc_client_and_server ( void  )
static

Definition at line 111 of file note.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stop_rpc_client_and_server()

static void stop_rpc_client_and_server ( void  )
static

Definition at line 126 of file note.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_failvec_fetch()

static void test_failvec_fetch ( void  )
static

Definition at line 390 of file note.c.

Here is the call graph for this function:

◆ test_ha_session_states()

static void test_ha_session_states ( void  )
static

Definition at line 585 of file note.c.

Here is the call graph for this function:

◆ test_ha_state_accept()

static void test_ha_state_accept ( void  )
static

Definition at line 278 of file note.c.

Here is the call graph for this function:

◆ test_ha_state_set_and_get()

static void test_ha_state_set_and_get ( void  )
static

Definition at line 250 of file note.c.

Here is the call graph for this function:

◆ test_is_objv()

static bool test_is_objv ( const struct m0_conf_obj obj)
static

Definition at line 356 of file note.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_poolversion_get()

static void test_poolversion_get ( void  )
static

Definition at line 475 of file note.c.

Here is the call graph for this function:

Variable Documentation

◆ cctx

struct m0_rpc_client_ctx cctx
static
Initial value:
= {
.rcx_net_dom = &client_net_dom,
.rcx_local_addr = CLIENT_ENDPOINT_ADDR,
.rcx_remote_addr = SERVER_ENDPOINT_ADDR,
.rcx_max_rpcs_in_flight = MAX_RPCS_IN_FLIGHT,
.rcx_fid = &g_process_fid,
}
#define SERVER_ENDPOINT_ADDR
Definition: note.c:46
#define CLIENT_ENDPOINT_ADDR
Definition: note.c:40
static struct m0_net_domain client_net_dom
Definition: note.c:49
struct m0_fid g_process_fid
Definition: ut.c:689

Definition at line 66 of file note.c.

◆ chan

struct m0_chan chan
static

Definition at line 97 of file note.c.

◆ chan_lock

struct m0_mutex chan_lock
static

Definition at line 96 of file note.c.

◆ client_net_dom

struct m0_net_domain client_net_dom
static

Definition at line 49 of file note.c.

◆ clink

struct m0_clink clink
static

Definition at line 98 of file note.c.

◆ g_ast

struct { ... } g_ast

◆ g_grp

struct m0_sm_group g_grp
static

Definition at line 100 of file note.c.

◆ ha_state_ut

struct m0_ut_suite ha_state_ut
Initial value:
= {
.ts_name = "ha-state-ut",
.ts_init = ha_state_ut_init,
.ts_fini = ha_state_ut_fini,
.ts_tests = {
{ "ha-state-set-and-get", test_ha_state_set_and_get },
{ "ha-state-accept", test_ha_state_accept },
{ "ha-failvecl-fetch", test_failvec_fetch },
{ "ha-poolversion-get", test_poolversion_get },
{ "ha-session-states", test_ha_session_states },
{ NULL, NULL }
}
}
static void test_poolversion_get(void)
Definition: note.c:475
#define NULL
Definition: misc.h:38
static void test_failvec_fetch(void)
Definition: note.c:390
static int ha_state_ut_fini(void)
Definition: note.c:629
static void test_ha_state_set_and_get(void)
Definition: note.c:250
static void test_ha_state_accept(void)
Definition: note.c:278
static int ha_state_ut_init(void)
Definition: note.c:617
static void test_ha_session_states(void)
Definition: note.c:585

Definition at line 637 of file note.c.

◆ reqh_args

struct m0_reqh_init_args reqh_args
static
Initial value:
= {
.rhia_fid = &M0_FID_TINIT('r', 1, 1),
.rhia_mdstore = (void *)1
}
#define M0_FID_TINIT(type, container, key)
Definition: fid.h:90

Definition at line 89 of file note.c.

◆ root

struct m0_conf_root* root

Definition at line 50 of file note.c.

◆ run

bool run

Definition at line 103 of file note.c.

◆ sctx

struct m0_rpc_server_ctx sctx
static
Initial value:
= {
.rsx_xprts_nr = 1,
.rsx_argv = server_argv,
.rsx_argc = ARRAY_SIZE(server_argv),
.rsx_log_file_name = SERVER_LOG_NAME,
}
#define SERVER_LOG_NAME
Definition: note.c:45
static char * server_argv[]
Definition: note.c:74
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 82 of file note.c.

◆ server_argv

char* server_argv[]
static
Initial value:
= {
"ha_ut", "-T", "AD", "-D", SERVER_DB_NAME,
"-w", "10", "-e", SERVER_ENDPOINT, "-H", SERVER_ENDPOINT_ADDR,
"-c", M0_UT_PATH("conf.xc")
}
#define SERVER_DB_NAME
Definition: note.c:42
#define SERVER_ENDPOINT
Definition: note.c:47
#define SERVER_ENDPOINT_ADDR
Definition: note.c:46
#define SERVER_ADDB_STOB_NAME
Definition: note.c:44
#define M0_UT_CONF_PROCESS
Definition: misc.h:45
#define M0_UT_PATH(name)
Definition: misc.h:41
#define SERVER_STOB_NAME
Definition: note.c:43

Definition at line 74 of file note.c.

◆ thread

struct m0_thread thread

Definition at line 104 of file note.c.