Motr  M0
spiel_conf_ut.c File Reference
#include "lib/trace.h"
#include <fcntl.h>
#include <unistd.h>
#include "spiel/spiel.h"
#include "spiel/ut/spiel_ut_common.h"
#include "conf/cache.h"
#include "conf/obj_ops.h"
#include "conf/preload.h"
#include "conf/load_fop.h"
#include "conf/helpers.h"
#include "conf/ut/common.h"
#include "lib/finject.h"
#include "lib/fs.h"
#include "ut/misc.h"
#include "ut/ut.h"
Include dependency graph for spiel_conf_ut.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_SPIEL
 
#define FID_MOVE(fid, step)   &M0_FID_INIT((fid).f_container, (fid).f_key + (step))
 
#define SVC_EP   "0@lo:12345:41:201"
 

Enumerations

enum  {
  SPIEL_UT_OBJ_PROFILE, SPIEL_UT_OBJ_POOL, SPIEL_UT_OBJ_PVER, SPIEL_UT_OBJ_PVER_F,
  SPIEL_UT_OBJ_NODE, SPIEL_UT_OBJ_NODE2, SPIEL_UT_OBJ_PROCESS, SPIEL_UT_OBJ_PROCESS2,
  SPIEL_UT_OBJ_SERVICE, SPIEL_UT_OBJ_SERVICE2, SPIEL_UT_OBJ_SERVICE3, SPIEL_UT_OBJ_SERVICE4,
  SPIEL_UT_OBJ_SERVICE5, SPIEL_UT_OBJ_SERVICE6, SPIEL_UT_OBJ_SERVICE7, SPIEL_UT_OBJ_SERVICE8,
  SPIEL_UT_OBJ_SERVICE9, SPIEL_UT_OBJ_SERVICE10, SPIEL_UT_OBJ_SERVICE11, SPIEL_UT_OBJ_SERVICE12,
  SPIEL_UT_OBJ_SERVICE13, SPIEL_UT_OBJ_SDEV, SPIEL_UT_OBJ_SDEV2, SPIEL_UT_OBJ_SDEV3,
  SPIEL_UT_OBJ_SDEV4, SPIEL_UT_OBJ_SDEV5, SPIEL_UT_OBJ_SDEV6, SPIEL_UT_OBJ_SDEV7,
  SPIEL_UT_OBJ_SDEV8, SPIEL_UT_OBJ_SDEV9, SPIEL_UT_OBJ_SDEV10, SPIEL_UT_OBJ_SITE,
  SPIEL_UT_OBJ_RACK, SPIEL_UT_OBJ_RACK2, SPIEL_UT_OBJ_ENCLOSURE, SPIEL_UT_OBJ_ENCLOSURE2,
  SPIEL_UT_OBJ_CONTROLLER, SPIEL_UT_OBJ_CONTROLLER2, SPIEL_UT_OBJ_DRIVE, SPIEL_UT_OBJ_DRIVE2,
  SPIEL_UT_OBJ_DRIVE3, SPIEL_UT_OBJ_DRIVE4, SPIEL_UT_OBJ_DRIVE5, SPIEL_UT_OBJ_DRIVE6,
  SPIEL_UT_OBJ_DRIVE7, SPIEL_UT_OBJ_DRIVE8, SPIEL_UT_OBJ_DRIVE9, SPIEL_UT_OBJ_DRIVE10,
  SPIEL_UT_OBJ_SITE_V, SPIEL_UT_OBJ_RACK_V, SPIEL_UT_OBJ_ENCLOSURE_V, SPIEL_UT_OBJ_CONTROLLER_V,
  SPIEL_UT_OBJ_DRIVE_V
}
 
enum  spiel_conf_opts {
  SCO_NO_CHANGE, SCO_DROP_PROCESS = 1 << 1, SCO_DROP_SERVICE = 1 << 2, SCO_DROP_SDEV = 1 << 3,
  SCO_ADD_PROCESS = 1 << (1 + 16), SCO_ADD_SERVICE = 1 << (2 + 16), SCO_ADD_SDEV = 1 << (3 + 16)
}
 

Functions

static int spiel_copy_file (const char *source, const char *dest)
 
static void spiel_conf_ut_init (void)
 
static void spiel_conf_ut_fini (void)
 
static void spiel_conf_create_conf_with_opt (struct m0_spiel *spiel, struct m0_spiel_tx *tx, uint64_t opts)
 
static void spiel_conf_create_configuration (struct m0_spiel *spiel, struct m0_spiel_tx *tx)
 
static void spiel_conf_create_invalid_configuration (struct m0_spiel *spiel, struct m0_spiel_tx *tx)
 
static void spiel_conf_create_ok (void)
 
static void spiel_conf_pver_check (struct m0_spiel_tx *tx)
 
static void spiel_conf_pver_delete_check (struct m0_spiel_tx *tx)
 
static void spiel_conf_create_pver_tree (struct m0_spiel_tx *tx)
 
static void spiel_conf_create_fail (void)
 
static void spiel_conf_delete (void)
 
static void spiel_conf_file_create_tree (struct m0_spiel_tx *tx)
 
static void spiel_conf_file (void)
 
static void spiel_conf_cancel (void)
 
static void spiel_conf_load_send (void)
 
static void spiel_conf_drop_svc (void)
 
static void spiel_conf_add_svc (void)
 
static void spiel_conf_big_db (void)
 
static void spiel_conf_flip_fail (void)
 
static void spiel_conf_check_fail (void)
 
static void spiel_conf_load_fail (void)
 
static void spiel_conf_dump (void)
 
static void spiel_conf_tx_invalid (void)
 
static void spiel_conf_tx_no_spiel (void)
 
static void spiel_conf_expired (void)
 
static void spiel_conf_wlock_get_fail (void)
 

Variables

struct m0_spiel spiel
 
struct m0_spiel_ut_reqh ut_reqh
 
static struct m0_fid spiel_obj_fid []
 
struct m0_ut_suite spiel_conf_ut
 

Macro Definition Documentation

◆ FID_MOVE

#define FID_MOVE (   fid,
  step 
)    &M0_FID_INIT((fid).f_container, (fid).f_key + (step))

Definition at line 618 of file spiel_conf_ut.c.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_SPIEL

Definition at line 23 of file spiel_conf_ut.c.

◆ SVC_EP

#define SVC_EP   "0@lo:12345:41:201"

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SPIEL_UT_OBJ_PROFILE 
SPIEL_UT_OBJ_POOL 
SPIEL_UT_OBJ_PVER 
SPIEL_UT_OBJ_PVER_F 
SPIEL_UT_OBJ_NODE 
SPIEL_UT_OBJ_NODE2 
SPIEL_UT_OBJ_PROCESS 
SPIEL_UT_OBJ_PROCESS2 
SPIEL_UT_OBJ_SERVICE 
SPIEL_UT_OBJ_SERVICE2 
SPIEL_UT_OBJ_SERVICE3 
SPIEL_UT_OBJ_SERVICE4 
SPIEL_UT_OBJ_SERVICE5 
SPIEL_UT_OBJ_SERVICE6 
SPIEL_UT_OBJ_SERVICE7 
SPIEL_UT_OBJ_SERVICE8 
SPIEL_UT_OBJ_SERVICE9 
SPIEL_UT_OBJ_SERVICE10 
SPIEL_UT_OBJ_SERVICE11 
SPIEL_UT_OBJ_SERVICE12 
SPIEL_UT_OBJ_SERVICE13 
SPIEL_UT_OBJ_SDEV 
SPIEL_UT_OBJ_SDEV2 
SPIEL_UT_OBJ_SDEV3 
SPIEL_UT_OBJ_SDEV4 
SPIEL_UT_OBJ_SDEV5 
SPIEL_UT_OBJ_SDEV6 
SPIEL_UT_OBJ_SDEV7 
SPIEL_UT_OBJ_SDEV8 
SPIEL_UT_OBJ_SDEV9 
SPIEL_UT_OBJ_SDEV10 
SPIEL_UT_OBJ_SITE 
SPIEL_UT_OBJ_RACK 
SPIEL_UT_OBJ_RACK2 
SPIEL_UT_OBJ_ENCLOSURE 
SPIEL_UT_OBJ_ENCLOSURE2 
SPIEL_UT_OBJ_CONTROLLER 
SPIEL_UT_OBJ_CONTROLLER2 
SPIEL_UT_OBJ_DRIVE 
SPIEL_UT_OBJ_DRIVE2 
SPIEL_UT_OBJ_DRIVE3 
SPIEL_UT_OBJ_DRIVE4 
SPIEL_UT_OBJ_DRIVE5 
SPIEL_UT_OBJ_DRIVE6 
SPIEL_UT_OBJ_DRIVE7 
SPIEL_UT_OBJ_DRIVE8 
SPIEL_UT_OBJ_DRIVE9 
SPIEL_UT_OBJ_DRIVE10 
SPIEL_UT_OBJ_SITE_V 
SPIEL_UT_OBJ_RACK_V 
SPIEL_UT_OBJ_ENCLOSURE_V 
SPIEL_UT_OBJ_CONTROLLER_V 
SPIEL_UT_OBJ_DRIVE_V 

Definition at line 45 of file spiel_conf_ut.c.

◆ spiel_conf_opts

Enumerator
SCO_NO_CHANGE 
SCO_DROP_PROCESS 
SCO_DROP_SERVICE 
SCO_DROP_SDEV 
SCO_ADD_PROCESS 
SCO_ADD_SERVICE 
SCO_ADD_SDEV 

Definition at line 225 of file spiel_conf_ut.c.

Function Documentation

◆ spiel_conf_add_svc()

static void spiel_conf_add_svc ( void  )
static

send Load command to confd having one service added

Definition at line 1747 of file spiel_conf_ut.c.

Here is the call graph for this function:

◆ spiel_conf_big_db()

static void spiel_conf_big_db ( void  )
static

send Load command using rpc bulk mechanism

Add sufficient number of services, so resulting conf db string after encoding doesn't fit into one RPC bulk segment.

Definition at line 1763 of file spiel_conf_ut.c.

Here is the call graph for this function:

◆ spiel_conf_cancel()

static void spiel_conf_cancel ( void  )
static

Definition at line 1689 of file spiel_conf_ut.c.

Here is the call graph for this function:

◆ spiel_conf_check_fail()

static void spiel_conf_check_fail ( void  )
static

Definition at line 1823 of file spiel_conf_ut.c.

Here is the call graph for this function:

◆ spiel_conf_create_conf_with_opt()

static void spiel_conf_create_conf_with_opt ( struct m0_spiel spiel,
struct m0_spiel_tx tx,
uint64_t  opts 
)
static

Definition at line 235 of file spiel_conf_ut.c.

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

◆ spiel_conf_create_configuration()

static void spiel_conf_create_configuration ( struct m0_spiel spiel,
struct m0_spiel_tx tx 
)
static

Creates configuration identical to conf.xc, i.e. having no changes.

Definition at line 612 of file spiel_conf_ut.c.

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

◆ spiel_conf_create_fail()

static void spiel_conf_create_fail ( void  )
static

alloc fail for rt_params. Note: 'm0_fi_enable_once' is not used here as some other threads were consuming this fault injection point by calling 'm0_alloc' before this thread could call that function leading to the assert condition below getting hit. With 'm0_fi_enable', those threads can still get -ENOMEM in the interim but that is acceptable for now.

Definition at line 1032 of file spiel_conf_ut.c.

Here is the call graph for this function:

◆ spiel_conf_create_invalid_configuration()

static void spiel_conf_create_invalid_configuration ( struct m0_spiel spiel,
struct m0_spiel_tx tx 
)
static

Definition at line 621 of file spiel_conf_ut.c.

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

◆ spiel_conf_create_ok()

static void spiel_conf_create_ok ( void  )
static

Definition at line 733 of file spiel_conf_ut.c.

Here is the call graph for this function:

◆ spiel_conf_create_pver_tree()

static void spiel_conf_create_pver_tree ( struct m0_spiel_tx tx)
static

Definition at line 817 of file spiel_conf_ut.c.

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

◆ spiel_conf_delete()

static void spiel_conf_delete ( void  )
static

Definition at line 1447 of file spiel_conf_ut.c.

Here is the call graph for this function:

◆ spiel_conf_drop_svc()

static void spiel_conf_drop_svc ( void  )
static

send Load command to confd having one service dropped

Definition at line 1731 of file spiel_conf_ut.c.

Here is the call graph for this function:

◆ spiel_conf_dump()

static void spiel_conf_dump ( void  )
static

Definition at line 1883 of file spiel_conf_ut.c.

Here is the call graph for this function:

◆ spiel_conf_expired()

static void spiel_conf_expired ( void  )
static

Definition at line 1939 of file spiel_conf_ut.c.

Here is the call graph for this function:

◆ spiel_conf_file()

static void spiel_conf_file ( void  )
static

Definition at line 1647 of file spiel_conf_ut.c.

Here is the call graph for this function:

◆ spiel_conf_file_create_tree()

static void spiel_conf_file_create_tree ( struct m0_spiel_tx tx)
static

spiel-conf-file create tree

Create conf file equvalent to ut/conf.xc

Definition at line 1480 of file spiel_conf_ut.c.

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

◆ spiel_conf_flip_fail()

static void spiel_conf_flip_fail ( void  )
static

Definition at line 1809 of file spiel_conf_ut.c.

Here is the call graph for this function:

◆ spiel_conf_load_fail()

static void spiel_conf_load_fail ( void  )
static

Definition at line 1868 of file spiel_conf_ut.c.

Here is the call graph for this function:

◆ spiel_conf_load_send()

static void spiel_conf_load_send ( void  )
static

send Load command to confd

Definition at line 1702 of file spiel_conf_ut.c.

Here is the call graph for this function:

◆ spiel_conf_pver_check()

static void spiel_conf_pver_check ( struct m0_spiel_tx tx)
static

Definition at line 743 of file spiel_conf_ut.c.

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

◆ spiel_conf_pver_delete_check()

static void spiel_conf_pver_delete_check ( struct m0_spiel_tx tx)
static

Definition at line 789 of file spiel_conf_ut.c.

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

◆ spiel_conf_tx_invalid()

static void spiel_conf_tx_invalid ( void  )
static

Definition at line 1910 of file spiel_conf_ut.c.

Here is the call graph for this function:

◆ spiel_conf_tx_no_spiel()

static void spiel_conf_tx_no_spiel ( void  )
static

Definition at line 1922 of file spiel_conf_ut.c.

Here is the call graph for this function:

◆ spiel_conf_ut_fini()

static void spiel_conf_ut_fini ( void  )
static

Definition at line 211 of file spiel_conf_ut.c.

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

◆ spiel_conf_ut_init()

static void spiel_conf_ut_init ( void  )
static
Todo:
Use fid convert function to set kind.

Definition at line 190 of file spiel_conf_ut.c.

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

◆ spiel_conf_wlock_get_fail()

static void spiel_conf_wlock_get_fail ( void  )
static

Definition at line 1961 of file spiel_conf_ut.c.

Here is the call graph for this function:

◆ spiel_copy_file()

static int spiel_copy_file ( const char *  source,
const char *  dest 
)
static

Definition at line 157 of file spiel_conf_ut.c.

Here is the caller graph for this function:

Variable Documentation

◆ spiel

struct m0_spiel spiel

Definition at line 42 of file spiel_conf_ut.c.

◆ spiel_conf_ut

struct m0_ut_suite spiel_conf_ut
Initial value:
= {
.ts_name = "spiel-conf-ut",
.ts_tests = {
{ "create-ok", spiel_conf_create_ok },
{ "create-fail", spiel_conf_create_fail },
{ "delete", spiel_conf_delete },
{ "file", spiel_conf_file },
{ "cancel", spiel_conf_cancel },
{ "load-send", spiel_conf_load_send },
{ "big-db", spiel_conf_big_db },
{ "flip-fail", spiel_conf_flip_fail },
{ "check-fail", spiel_conf_check_fail },
{ "load-fail", spiel_conf_load_fail },
{ "dump", spiel_conf_dump },
{ "tx-invalid", spiel_conf_tx_invalid },
{ "tx-no-spiel", spiel_conf_tx_no_spiel },
{ "drop-svc", spiel_conf_drop_svc },
{ "add-svc", spiel_conf_add_svc },
{ "conf-expired", spiel_conf_expired },
{ "wlock-get-fail", spiel_conf_wlock_get_fail },
{ NULL, NULL },
},
}
static void spiel_conf_add_svc(void)
static void spiel_conf_load_send(void)
#define NULL
Definition: misc.h:38
static void spiel_conf_wlock_get_fail(void)
static void spiel_conf_tx_no_spiel(void)
static void spiel_conf_tx_invalid(void)
static void spiel_conf_check_fail(void)
static void spiel_conf_load_fail(void)
static void spiel_conf_drop_svc(void)
static void spiel_conf_create_ok(void)
static void spiel_conf_expired(void)
static void spiel_conf_delete(void)
static void spiel_conf_file(void)
static void spiel_conf_flip_fail(void)
static void spiel_conf_cancel(void)
static void spiel_conf_big_db(void)
static void spiel_conf_dump(void)
static void spiel_conf_create_fail(void)

Definition at line 1975 of file spiel_conf_ut.c.

◆ spiel_obj_fid

struct m0_fid spiel_obj_fid[]
static

Definition at line 101 of file spiel_conf_ut.c.

◆ ut_reqh

struct m0_spiel_ut_reqh ut_reqh

Definition at line 31 of file spiel_ut_common.c.