Motr  M0
spiel_conf_ut.c
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 
23 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_SPIEL
24 #include "lib/trace.h"
25 
26 #include <fcntl.h> /* open */
27 #include <unistd.h> /* close */
28 
29 #include "spiel/spiel.h"
31 #include "conf/cache.h" /* m0_conf_cache_from_string */
32 #include "conf/obj_ops.h" /* m0_conf_obj_create */
33 #include "conf/preload.h" /* m0_confx_string_free */
34 #include "conf/load_fop.h" /* m0_conf_segment_size */
35 #include "conf/helpers.h" /* m0_confc_expired_cb */
36 #include "conf/ut/common.h"
37 #include "lib/finject.h"
38 #include "lib/fs.h" /* m0_file_read */
39 #include "ut/misc.h" /* M0_UT_PATH */
40 #include "ut/ut.h"
41 
42 struct m0_spiel spiel;
43 extern struct m0_spiel_ut_reqh ut_reqh;
44 
45 enum {
99 };
100 
101 static struct m0_fid spiel_obj_fid[] = {
102  [SPIEL_UT_OBJ_PROFILE] = M0_FID_TINIT('p', 1, 0 ),
103  [SPIEL_UT_OBJ_POOL] = M0_FID_TINIT('o', 1, 4 ),
104  [SPIEL_UT_OBJ_PVER] = M0_FID_TINIT('v', 5, 5 ),
105  [SPIEL_UT_OBJ_PVER_F] = M0_FID_TINIT('v', 6, 6 ),
106  [SPIEL_UT_OBJ_NODE] = M0_FID_TINIT('n', 1, 2 ),
107  [SPIEL_UT_OBJ_NODE2] = M0_FID_TINIT('n', 1, 48),
108  [SPIEL_UT_OBJ_PROCESS] = M0_FID_TINIT('r', 1, 5 ),
109  [SPIEL_UT_OBJ_PROCESS2] = M0_FID_TINIT('r', 1, 49),
110  [SPIEL_UT_OBJ_SERVICE] = M0_FID_TINIT('s', 1, 9 ),
111  [SPIEL_UT_OBJ_SERVICE2] = M0_FID_TINIT('s', 1, 10),
112  [SPIEL_UT_OBJ_SERVICE3] = M0_FID_TINIT('s', 1, 20),
113  [SPIEL_UT_OBJ_SERVICE4] = M0_FID_TINIT('s', 1, 21),
114  [SPIEL_UT_OBJ_SERVICE5] = M0_FID_TINIT('s', 1, 22),
115  [SPIEL_UT_OBJ_SERVICE6] = M0_FID_TINIT('s', 1, 23),
116  [SPIEL_UT_OBJ_SERVICE7] = M0_FID_TINIT('s', 1, 24),
117  [SPIEL_UT_OBJ_SERVICE8] = M0_FID_TINIT('s', 1, 25),
118  [SPIEL_UT_OBJ_SERVICE9] = M0_FID_TINIT('s', 1, 26),
119  [SPIEL_UT_OBJ_SERVICE10] = M0_FID_TINIT('s', 1, 27),
120  [SPIEL_UT_OBJ_SERVICE11] = M0_FID_TINIT('s', 1, 28),
121  [SPIEL_UT_OBJ_SERVICE12] = M0_FID_TINIT('s', 1, 29),
122  [SPIEL_UT_OBJ_SERVICE13] = M0_FID_TINIT('s', 1, 100),
123  [SPIEL_UT_OBJ_SDEV] = M0_FID_TINIT('d', 1, 15),
124  [SPIEL_UT_OBJ_SDEV2] = M0_FID_TINIT('d', 1, 71),
125  [SPIEL_UT_OBJ_SDEV3] = M0_FID_TINIT('d', 1, 72),
126  [SPIEL_UT_OBJ_SDEV4] = M0_FID_TINIT('d', 1, 73),
127  [SPIEL_UT_OBJ_SDEV5] = M0_FID_TINIT('d', 1, 74),
128  [SPIEL_UT_OBJ_SDEV6] = M0_FID_TINIT('d', 1, 51),
129  [SPIEL_UT_OBJ_SDEV7] = M0_FID_TINIT('d', 1, 83),
130  [SPIEL_UT_OBJ_SDEV8] = M0_FID_TINIT('d', 1, 84),
131  [SPIEL_UT_OBJ_SDEV9] = M0_FID_TINIT('d', 1, 85),
132  [SPIEL_UT_OBJ_SDEV10] = M0_FID_TINIT('d', 1, 86),
133  [SPIEL_UT_OBJ_SITE] = M0_FID_TINIT('S', 1, 3 ),
134  [SPIEL_UT_OBJ_RACK] = M0_FID_TINIT('a', 1, 3 ),
135  [SPIEL_UT_OBJ_RACK2] = M0_FID_TINIT('a', 1, 52),
136  [SPIEL_UT_OBJ_ENCLOSURE] = M0_FID_TINIT('e', 1, 7 ),
137  [SPIEL_UT_OBJ_ENCLOSURE2] = M0_FID_TINIT('e', 1, 53),
138  [SPIEL_UT_OBJ_CONTROLLER] = M0_FID_TINIT('c', 1, 11),
139  [SPIEL_UT_OBJ_CONTROLLER2] = M0_FID_TINIT('c', 1, 54),
140  [SPIEL_UT_OBJ_DRIVE] = M0_FID_TINIT('k', 1, 16),
141  [SPIEL_UT_OBJ_DRIVE2] = M0_FID_TINIT('k', 1, 75),
142  [SPIEL_UT_OBJ_DRIVE3] = M0_FID_TINIT('k', 1, 76),
143  [SPIEL_UT_OBJ_DRIVE4] = M0_FID_TINIT('k', 1, 77),
144  [SPIEL_UT_OBJ_DRIVE5] = M0_FID_TINIT('k', 1, 78),
145  [SPIEL_UT_OBJ_DRIVE6] = M0_FID_TINIT('k', 1, 55),
146  [SPIEL_UT_OBJ_DRIVE7] = M0_FID_TINIT('k', 1, 87),
147  [SPIEL_UT_OBJ_DRIVE8] = M0_FID_TINIT('k', 1, 88),
148  [SPIEL_UT_OBJ_DRIVE9] = M0_FID_TINIT('k', 1, 89),
149  [SPIEL_UT_OBJ_DRIVE10] = M0_FID_TINIT('k', 1, 90),
150  [SPIEL_UT_OBJ_SITE_V] = M0_FID_TINIT('j', 13, 14),
151  [SPIEL_UT_OBJ_RACK_V] = M0_FID_TINIT('j', 14, 14),
152  [SPIEL_UT_OBJ_ENCLOSURE_V] = M0_FID_TINIT('j', 15, 15),
153  [SPIEL_UT_OBJ_CONTROLLER_V] = M0_FID_TINIT('j', 16, 16),
154  [SPIEL_UT_OBJ_DRIVE_V] = M0_FID_TINIT('j', 17, 17)
155 };
156 
157 static int spiel_copy_file(const char *source, const char* dest)
158 {
159  char buf[1024];
160  int in_fd;
161  int out_fd;
162  size_t result;
163  int rc = 0;
164 
165  in_fd = open(source, O_RDONLY);
166  if (in_fd < 0)
167  return -EINVAL;
168 
169  out_fd = open(dest, O_WRONLY | O_CREAT, 0666);
170  if (in_fd < 0) {
171  close(in_fd);
172  return -EINVAL;
173  }
174 
175  while (1) {
176  rc = (result = read(in_fd, &buf[0], sizeof(buf))) >= 0 ?
177  0 : -EINVAL;
178  if (result == 0 || rc != 0)
179  break;
180  rc = write(out_fd, &buf[0], result) == result ? 0 : -EINVAL;
181  if (rc != 0)
182  break;
183  }
184  close(in_fd);
185  close(out_fd);
186 
187  return rc;
188 }
189 
190 static void spiel_conf_ut_init(void)
191 {
192  struct m0_rconfc *rconfc =
194  int rc;
195 
197  M0_ASSERT(rc == 0);
198  spiel_copy_file(M0_UT_PATH("conf.xc"), "tmp-conf.xc");
199 
200  /* Use a copy of conf.xc file as confd path - file may have changed */
201  m0_spiel__ut_init(&spiel, "tmp-conf.xc", false);
208  (uint64_t)1 << (64 - 10);
209 }
210 
211 static void spiel_conf_ut_fini(void)
212 {
213  int rc;
214 
215  m0_spiel__ut_fini(&spiel, false);
216 
217  rc = system("rm -rf confd");
218  M0_UT_ASSERT(rc != -1);
219  rc = unlink("tmp-conf.xc");
220  M0_UT_ASSERT(rc == 0);
222  M0_UT_ASSERT(rc == 0);
223 }
224 
227  SCO_DROP_PROCESS = 1 << 1, /* unused */
229  SCO_DROP_SDEV = 1 << 3, /* unused */
230  SCO_ADD_PROCESS = 1 << (1 + 16), /* unused */
231  SCO_ADD_SERVICE = 1 << (2 + 16),
232  SCO_ADD_SDEV = 1 << (3 + 16), /* unused */
233 };
234 
236  struct m0_spiel_tx *tx,
237  uint64_t opts)
238 {
239  int rc;
240  struct m0_pdclust_attr pdclust_attr = { .pa_N=1,
241  .pa_K=0,
242  .pa_S=0,
243  .pa_P=1};
244  const char *params[] = { "11111", "22222", NULL };
245  const char *ep[] = { SERVER_ENDPOINT_ADDR, NULL };
246  struct m0_spiel_service_info service_info = {.svi_endpoints=ep};
247  uint32_t tolerance[] = {0, 0, 0, 0, 1};
248  uint32_t allowance[] = {0, 0, 0, 0, 1};
249  struct m0_bitmap bitmap;
250 
251  m0_bitmap_init(&bitmap, 32);
252  m0_bitmap_set(&bitmap, 0, true);
253  m0_bitmap_set(&bitmap, 1, true);
254 
255  m0_spiel_tx_open(spiel, tx);
256 
257  rc = m0_spiel_root_add(tx,
258  &M0_FID0,
261  10, params);
262  M0_UT_ASSERT(rc == 0);
263 
265  M0_UT_ASSERT(rc == 0);
266 
269  M0_UT_ASSERT(rc == 0);
270 
272  M0_UT_ASSERT(rc == 0);
273 
275  M0_UT_ASSERT(rc == 0);
276 
279  M0_UT_ASSERT(rc == 0);
280 
283  M0_UT_ASSERT(rc == 0);
284 
285  rc = m0_spiel_node_add(tx,
287  256,
288  2,
289  10,
290  0xff00ff00);
291  M0_UT_ASSERT(rc == 0);
292 
293  rc = m0_spiel_node_add(tx,
295  256,
296  2,
297  10,
298  0xff00ff00);
299  M0_UT_ASSERT(rc == 0);
300 
304  M0_UT_ASSERT(rc == 0);
305 
309  M0_UT_ASSERT(rc == 0);
310 
314  M0_UT_ASSERT(rc == 0);
315 
319  M0_UT_ASSERT(rc == 0);
320 
321  rc = m0_spiel_drive_add(tx,
324  M0_UT_ASSERT(rc == 0);
325 
326  rc = m0_spiel_drive_add(tx,
329  M0_UT_ASSERT(rc == 0);
330 
331  rc = m0_spiel_drive_add(tx,
334  M0_UT_ASSERT(rc == 0);
335 
336  rc = m0_spiel_drive_add(tx,
339  M0_UT_ASSERT(rc == 0);
340 
341  rc = m0_spiel_drive_add(tx,
344  M0_UT_ASSERT(rc == 0);
345 
346  rc = m0_spiel_drive_add(tx,
349  M0_UT_ASSERT(rc == 0);
350 
351  rc = m0_spiel_drive_add(tx,
354  M0_UT_ASSERT(rc == 0);
355 
356  rc = m0_spiel_drive_add(tx,
359  M0_UT_ASSERT(rc == 0);
360 
361  rc = m0_spiel_drive_add(tx,
364  M0_UT_ASSERT(rc == 0);
365 
366  rc = m0_spiel_drive_add(tx,
369  M0_UT_ASSERT(rc == 0);
370 
374  &pdclust_attr,
375  tolerance, ARRAY_SIZE(tolerance));
376  M0_UT_ASSERT(rc == 0);
380  1,
382  allowance, ARRAY_SIZE(allowance));
383  M0_UT_ASSERT(rc == 0);
384 
385  rc = m0_spiel_site_v_add(tx,
389  M0_UT_ASSERT(rc == 0);
390 
391  rc = m0_spiel_rack_v_add(tx,
395  M0_UT_ASSERT(rc == 0);
396 
401  M0_UT_ASSERT(rc == 0);
402 
407  M0_UT_ASSERT(rc == 0);
408 
413  M0_UT_ASSERT(rc == 0);
414 
416  M0_UT_ASSERT(rc == 0);
417 
421  &bitmap, 4000, 1, 2, 3, ep[0]);
422  M0_UT_ASSERT(rc == 0);
423 
427  &bitmap, 4000, 1, 2, 3, ep[0]);
428  M0_UT_ASSERT(rc == 0);
429 
430  service_info.svi_type = M0_CST_IOS;
434  &service_info);
435  M0_UT_ASSERT(rc == 0);
436 
437  service_info.svi_type = M0_CST_MDS;
441  &service_info);
442  M0_UT_ASSERT(rc == 0);
443 
444  service_info.svi_type = M0_CST_CONFD;
448  &service_info);
449  M0_UT_ASSERT(rc == 0);
450 
451  service_info.svi_type = M0_CST_ADDB2;
455  &service_info);
456  M0_UT_ASSERT(rc == 0);
457 
458  service_info.svi_type = M0_CST_RMS;
462  &service_info);
463  M0_UT_ASSERT(rc == 0);
464 
465  service_info.svi_type = M0_CST_HA;
469  &service_info);
470  M0_UT_ASSERT(rc == 0);
471 
472  service_info.svi_type = M0_CST_SNS_REP;
476  &service_info);
477  M0_UT_ASSERT(rc == 0);
478 
479  service_info.svi_type = M0_CST_SNS_REB;
483  &service_info);
484  M0_UT_ASSERT(rc == 0);
485 
486  service_info.svi_type = M0_CST_DS1;
490  &service_info);
491  M0_UT_ASSERT(rc == 0);
492 
493  service_info.svi_type = M0_CST_IOS;
497  &service_info);
498  M0_UT_ASSERT(rc == 0);
499 
500  if ((opts & SCO_DROP_SERVICE) == 0) {
501  service_info.svi_type = M0_CST_DS2;
505  &service_info);
506  M0_UT_ASSERT(rc == 0);
507  }
508 
509  if ((opts & SCO_ADD_SERVICE) != 0) {
510  service_info.svi_type = M0_CST_DS2;
514  &service_info);
515  M0_UT_ASSERT(rc == 0);
516  }
517 
518  service_info.svi_type = M0_CST_FDMI;
522  &service_info);
523  M0_UT_ASSERT(rc == 0);
524 
525  rc = m0_spiel_device_add(tx,
531  1024, 512, 123, 0x55, "/dev/sdev2");
532  M0_UT_ASSERT(rc == 0);
533 
534  rc = m0_spiel_device_add(tx,
540  1024, 512, 123, 0x55, "/dev/sdev2");
541  M0_UT_ASSERT(rc == 0);
542  rc = m0_spiel_device_add(tx,
548  1024, 512, 123, 0x55, "/dev/sdev3");
549  M0_UT_ASSERT(rc == 0);
550  rc = m0_spiel_device_add(tx,
556  1024, 512, 123, 0x55, "/dev/sdev4");
557  M0_UT_ASSERT(rc == 0);
558  rc = m0_spiel_device_add(tx,
564  1024, 512, 123, 0x55, "/dev/sdev5");
565  M0_UT_ASSERT(rc == 0);
566  rc = m0_spiel_device_add(tx,
572  1024, 512, 123, 0x55, "/dev/sdev0");
573  M0_UT_ASSERT(rc == 0);
574  rc = m0_spiel_device_add(tx,
580  1024, 512, 123, 0x55, "/dev/sdev1");
581  M0_UT_ASSERT(rc == 0);
582  rc = m0_spiel_device_add(tx,
588  1024, 512, 123, 0x55, "/dev/sdev2");
589  M0_UT_ASSERT(rc == 0);
590  rc = m0_spiel_device_add(tx,
596  1024, 512, 123, 0x55, "/dev/sdev3");
597  M0_UT_ASSERT(rc == 0);
598  rc = m0_spiel_device_add(tx,
604  1024, 512, 123, 0x55, "/dev/sdev4");
605  M0_UT_ASSERT(rc == 0);
606  m0_bitmap_fini(&bitmap);
607 }
608 
613  struct m0_spiel_tx *tx)
614 {
616 }
617 
618 #define FID_MOVE(fid, step) \
619  &M0_FID_INIT((fid).f_container, (fid).f_key + (step))
620 
622  struct m0_spiel_tx *tx)
623 {
624  int rc;
625  struct m0_pdclust_attr pdclust_attr = { .pa_N=0,
626  .pa_K=0,
627  .pa_S=0,
628  .pa_P=0};
629  const char *params[] = { "11111", "22222", NULL };
630  const char *ep[] = { SERVER_ENDPOINT_ADDR, NULL };
631  struct m0_spiel_service_info service_info = {.svi_endpoints=ep};
632  uint32_t tolerance[] = {0, 0, 0, 0, 1};
633  struct m0_bitmap bitmap;
634 
635  m0_bitmap_init(&bitmap, 32);
636  m0_bitmap_set(&bitmap, 0, true);
637  m0_bitmap_set(&bitmap, 1, true);
638 
639  m0_spiel_tx_open(spiel, tx);
640  rc = m0_spiel_root_add(tx,
644  10, params);
645  M0_UT_ASSERT(rc == 0);
646 
649  M0_UT_ASSERT(rc == 0);
650 
651  rc = m0_spiel_pool_add(tx,
653  0);
654  M0_UT_ASSERT(rc == 0);
655 
656  rc = m0_spiel_site_add(tx,
658  M0_UT_ASSERT(rc == 0);
659 
660  rc = m0_spiel_rack_add(tx,
663  M0_UT_ASSERT(rc == 0);
664 
665  rc = m0_spiel_node_add(tx,
667  256,
668  2,
669  10,
670  0xff00ff00);
671  M0_UT_ASSERT(rc == 0);
672 
677  M0_UT_ASSERT(rc == 0);
678 
682  M0_UT_ASSERT(rc == 0);
683 
684  rc = m0_spiel_drive_add(tx,
687  M0_UT_ASSERT(rc == 0);
688 
692  &pdclust_attr,
693  tolerance, ARRAY_SIZE(tolerance));
694  M0_UT_ASSERT(rc == 0);
695 
696  rc = m0_spiel_site_v_add(tx,
700  M0_UT_ASSERT(rc == 0);
701 
702  rc = m0_spiel_rack_v_add(tx,
706  M0_UT_ASSERT(rc == 0);
707 
711  &bitmap, 4000, 1, 2, 3, ep[0]);
712  M0_UT_ASSERT(rc == 0);
713 
714  service_info.svi_type = M0_CST_IOS;
718  &service_info);
719  M0_UT_ASSERT(rc == 0);
720 
721  rc = m0_spiel_device_add(tx,
727  1024, 512, 123, 0x55, "fake_filename");
728  M0_UT_ASSERT(rc == 0);
729 
730  m0_bitmap_fini(&bitmap);
731 }
732 
733 static void spiel_conf_create_ok(void)
734 {
735  struct m0_spiel_tx tx;
736 
739  m0_spiel_tx_close(&tx);
741 }
742 
743 static void spiel_conf_pver_check(struct m0_spiel_tx *tx)
744 {
745  struct m0_conf_obj *obj;
746  struct m0_conf_pver *pver;
747  struct m0_conf_rack *rack;
748  struct m0_conf_enclosure *enclosure;
749  struct m0_conf_controller *controller;
750 
751  m0_mutex_lock(&tx->spt_lock);
755  M0_UT_ASSERT(pver != NULL);
756 
759  rack = M0_CONF_CAST(obj, m0_conf_rack);
760  M0_UT_ASSERT(rack != NULL);
761  M0_UT_ASSERT(rack->cr_pvers != NULL);
762  M0_UT_ASSERT(rack->cr_pvers[0] == pver);
763  M0_UT_ASSERT(rack->cr_pvers[1] == NULL);
764 
767  enclosure = M0_CONF_CAST(obj, m0_conf_enclosure);
768  M0_UT_ASSERT(enclosure != NULL);
769  M0_UT_ASSERT(enclosure->ce_pvers != NULL);
770  M0_UT_ASSERT(enclosure->ce_pvers[0] == pver);
771  M0_UT_ASSERT(enclosure->ce_pvers[1] == NULL);
772 
775  controller = M0_CONF_CAST(obj, m0_conf_controller);
776  M0_UT_ASSERT(controller != NULL);
777  M0_UT_ASSERT(controller->cc_pvers != NULL);
778  M0_UT_ASSERT(controller->cc_pvers[0] == pver);
779  M0_UT_ASSERT(controller->cc_pvers[1] == NULL);
780 
784  M0_UT_ASSERT(pver != NULL);
785 
787 }
788 
790 {
791  struct m0_conf_obj *obj;
792 
793  m0_mutex_lock(&tx->spt_lock);
796  M0_UT_ASSERT(obj == NULL);
797 
800  M0_UT_ASSERT(obj == NULL);
801 
804  M0_UT_ASSERT(obj == NULL);
805 
808  M0_UT_ASSERT(obj == NULL);
809 
812  M0_UT_ASSERT(obj == NULL);
813 
815 }
816 
818 {
819  int rc;
820  struct m0_fid fake_fid = spiel_obj_fid[SPIEL_UT_OBJ_PROFILE];
821  struct m0_pdclust_attr pdclust_attr = { .pa_N=1, .pa_K=1, .pa_S=1,
822  .pa_P=3};
823  struct m0_pdclust_attr pdclust_attr_invalid = { .pa_N=1, .pa_K=2,
824  .pa_S=2, .pa_P=3};
825  uint32_t tolerance[] = {0, 0, 0, 0, 1};
826  uint32_t allowance[] = {0, 0, 0, 0, 1};
827 
828  /* Actual Pool version */
830  &fake_fid,
832  &pdclust_attr,
833  tolerance, ARRAY_SIZE(tolerance));
834  M0_UT_ASSERT(rc == -EINVAL);
835 
838  &fake_fid,
839  &pdclust_attr,
840  tolerance, ARRAY_SIZE(tolerance));
841  M0_UT_ASSERT(rc == -EINVAL);
842 
846  &pdclust_attr,
847  NULL,
848  0);
849  M0_UT_ASSERT(rc == -EINVAL);
850 
854  &pdclust_attr_invalid,
855  tolerance, ARRAY_SIZE(tolerance));
856  M0_UT_ASSERT(rc == -EINVAL);
857 
861  &pdclust_attr,
862  tolerance, ARRAY_SIZE(tolerance));
863  M0_UT_ASSERT(rc == 0);
864 
865  /* Formulaic pool version */
867  &fake_fid,
869  1,
871  allowance, ARRAY_SIZE(allowance));
872  M0_UT_ASSERT(rc == -EINVAL);
873 
876  &fake_fid,
877  1,
879  allowance, ARRAY_SIZE(allowance));
880  M0_UT_ASSERT(rc == -EINVAL);
881 
885  1,
886  &fake_fid,
887  allowance, ARRAY_SIZE(allowance));
888  M0_UT_ASSERT(rc == -EINVAL);
889 
893  1,
895  NULL, 0);
896  M0_UT_ASSERT(rc == -EINVAL);
897 
901  1,
903  allowance, ARRAY_SIZE(allowance));
904  M0_UT_ASSERT(rc == 0);
905 
906  /* site-v */
907  rc = m0_spiel_site_v_add(tx,
910  &fake_fid);
911  M0_UT_ASSERT(rc == -EINVAL);
912 
913  rc = m0_spiel_site_v_add(tx,
914  &fake_fid,
917  M0_UT_ASSERT(rc == -EINVAL);
918 
919  rc = m0_spiel_site_v_add(tx,
921  &fake_fid,
923  M0_UT_ASSERT(rc == -EINVAL);
924 
925  rc = m0_spiel_site_v_add(tx,
929  M0_UT_ASSERT(rc == 0);
930 
931  /* rack-v */
932  rc = m0_spiel_rack_v_add(tx,
935  &fake_fid);
936  M0_UT_ASSERT(rc == -EINVAL);
937 
938  rc = m0_spiel_rack_v_add(tx,
939  &fake_fid,
942  M0_UT_ASSERT(rc == -EINVAL);
943 
944  rc = m0_spiel_rack_v_add(tx,
946  &fake_fid,
948  M0_UT_ASSERT(rc == -EINVAL);
949 
950  rc = m0_spiel_rack_v_add(tx,
954  M0_UT_ASSERT(rc == 0);
955 
956  /* enclosure-v */
960  &fake_fid);
961  M0_UT_ASSERT(rc == -EINVAL);
962 
964  &fake_fid,
967  M0_UT_ASSERT(rc == -EINVAL);
968 
971  &fake_fid,
973  M0_UT_ASSERT(rc == -EINVAL);
974 
979  M0_UT_ASSERT(rc == 0);
980 
981  /* controller-v */
985  &fake_fid);
986  M0_UT_ASSERT(rc == -EINVAL);
987 
989  &fake_fid,
992  M0_UT_ASSERT(rc == -EINVAL);
993 
996  &fake_fid,
998  M0_UT_ASSERT(rc == -EINVAL);
999 
1004  M0_UT_ASSERT(rc == 0);
1005 
1006  /* drive-v */
1007  rc = m0_spiel_drive_v_add(tx,
1010  &fake_fid);
1011  M0_UT_ASSERT(rc == -EINVAL);
1012 
1013  rc = m0_spiel_drive_v_add(tx,
1014  &fake_fid,
1017  M0_UT_ASSERT(rc == -EINVAL);
1018 
1019  rc = m0_spiel_drive_v_add(tx,
1021  &fake_fid,
1023  M0_UT_ASSERT(rc == -EINVAL);
1024 
1025  rc = m0_spiel_drive_v_add(tx,
1029  M0_UT_ASSERT(rc == 0);
1030 }
1031 
1032 static void spiel_conf_create_fail(void)
1033 {
1034  struct m0_spiel_tx tx;
1035  const char *ep[] = { SERVER_ENDPOINT_ADDR, NULL };
1036  int rc;
1037  const char *params[] = { "11111", "22222", NULL };
1038  struct m0_spiel_service_info service_info = {
1039  .svi_endpoints = params };
1040  struct m0_fid fake_profile_fid =
1042  struct m0_fid fake_fid =
1044  struct m0_bitmap bitmap;
1045  uint64_t zero_mask[] = {0, 0};
1046  struct m0_bitmap zero_bitmap = {
1047  .b_nr = 2,
1048  .b_words = zero_mask
1049  };
1050 
1052  m0_bitmap_init(&bitmap, 32);
1053  m0_bitmap_set(&bitmap, 0, true);
1054  m0_bitmap_set(&bitmap, 1, true);
1055 
1056  m0_spiel_tx_open(&spiel, &tx);
1066  m0_fi_enable("m0_alloc", "fail_allocation");
1067  rc = m0_spiel_root_add(&tx,
1071  10, params);
1072  m0_fi_disable("m0_alloc", "fail_allocation");
1073  M0_UT_ASSERT(rc == -ENOMEM);
1074 
1075  /* alloc fail for rt_params */
1076  m0_fi_enable_off_n_on_m("m0_strings_dup",
1077  "strdup_failed", 1, 1);
1078  rc = m0_spiel_root_add(&tx,
1082  10, params);
1083  m0_fi_disable("m0_strings_dup", "strdup_failed");
1084  M0_UT_ASSERT(rc == -ENOMEM);
1085 
1086  /* Check that M0_FID0 can be passed as imeta_pver. */
1087  rc = m0_spiel_root_add(&tx,
1090  &M0_FID0,
1091  10, params);
1092  M0_UT_ASSERT(rc == 0);
1093 
1094  /* Profile */
1095  rc = m0_spiel_profile_add(&tx, &fake_profile_fid);
1096  M0_UT_ASSERT(rc == -EINVAL);
1097 
1098  rc = m0_spiel_profile_add(&tx, NULL);
1099  M0_UT_ASSERT(rc == -EINVAL);
1100 
1102  M0_UT_ASSERT(rc == -EINVAL);
1103 
1105  M0_UT_ASSERT(rc == 0);
1106 
1108  M0_UT_ASSERT(rc == -EEXIST);
1109 
1110  rc = m0_spiel_root_add(&tx,
1112  &fake_fid,
1114  10, params);
1115  M0_UT_ASSERT(rc == -EINVAL);
1116  rc = m0_spiel_root_add(&tx,
1119  &fake_fid,
1120  10, params);
1121  M0_UT_ASSERT(rc == -EINVAL);
1122 
1123  /* Pool */
1124  rc = m0_spiel_pool_add(&tx, &fake_fid, 0);
1125  M0_UT_ASSERT(rc == -EINVAL);
1126 
1128  M0_UT_ASSERT(rc == 0);
1129 
1130  /* Pool at profile */
1133  M0_UT_ASSERT(rc == 0);
1136  M0_UT_ASSERT(rc == -EEXIST);
1137 
1138  /* Site */
1139  rc = m0_spiel_site_add(&tx, &fake_fid);
1140  M0_UT_ASSERT(rc == -EINVAL);
1141 
1143  M0_UT_ASSERT(rc == 0);
1144 
1145  /* Rack */
1146  rc = m0_spiel_rack_add(&tx, &fake_fid,
1148  M0_UT_ASSERT(rc == -EINVAL);
1149 
1151  &fake_fid);
1152  M0_UT_ASSERT(rc == -EINVAL);
1153 
1156  M0_UT_ASSERT(rc == 0);
1157 
1158  /* Node */
1159  rc = m0_spiel_node_add(&tx,
1160  &fake_fid,
1161  256, 2, 10, 0xff00ff00);
1162  M0_UT_ASSERT(rc == -EINVAL);
1163 
1164  rc = m0_spiel_node_add(&tx,
1166  256, 2, 10, 0xff00ff00);
1167  M0_UT_ASSERT(rc == 0);
1168 
1169  /* Enclosure */
1170  rc = m0_spiel_enclosure_add(&tx,
1171  &fake_fid,
1174  M0_UT_ASSERT(rc == -EINVAL);
1175 
1176  rc = m0_spiel_enclosure_add(&tx,
1178  &fake_fid,
1180  M0_UT_ASSERT(rc == -EINVAL);
1181 
1182  rc = m0_spiel_enclosure_add(&tx,
1185  &fake_fid);
1186  M0_UT_ASSERT(rc == -EINVAL);
1187 
1188  rc = m0_spiel_enclosure_add(&tx,
1192  M0_UT_ASSERT(rc == 0);
1193 
1194  /* Controller */
1196  &fake_fid,
1198  M0_UT_ASSERT(rc == -EINVAL);
1199 
1202  &fake_fid);
1203  M0_UT_ASSERT(rc == -EINVAL);
1204 
1208  M0_UT_ASSERT(rc == 0);
1209 
1210  /* drive */
1211  rc = m0_spiel_drive_add(&tx,
1212  &fake_fid,
1214  M0_UT_ASSERT(rc == -EINVAL);
1215 
1216  rc = m0_spiel_drive_add(&tx,
1218  &fake_fid);
1219  M0_UT_ASSERT(rc == -EINVAL);
1220 
1221  rc = m0_spiel_drive_add(&tx,
1224  M0_UT_ASSERT(rc == 0);
1225 
1226  /* Finish pool version */
1227  /* Pver done error */
1229  m0_fi_enable_off_n_on_m("spiel_pver_add", "fail_allocation", 1, 1);
1231  m0_fi_disable("spiel_pver_add", "fail_allocation");
1232  M0_UT_ASSERT(rc == -ENOMEM);
1233 
1235 
1237 
1238  /* Pver done OK */
1241  M0_UT_ASSERT(rc == 0);
1242  spiel_conf_pver_check(&tx);
1243 
1244  /* Process */
1245  rc = m0_spiel_process_add(&tx,
1246  &fake_fid,
1248  &bitmap, 4000, 1, 2, 3, ep[0]);
1249  M0_UT_ASSERT(rc == -EINVAL);
1250 
1251  rc = m0_spiel_process_add(&tx,
1253  &fake_fid,
1254  &bitmap, 4000, 1, 2, 3, ep[0]);
1255  M0_UT_ASSERT(rc == -EINVAL);
1256 
1257  rc = m0_spiel_process_add(&tx,
1260  NULL, 4000, 1, 2, 3, ep[0]);
1261  M0_UT_ASSERT(rc == -EINVAL);
1262 
1263  rc = m0_spiel_process_add(&tx,
1266  &bitmap, 4000, 1, 2, 3, NULL);
1267  M0_UT_ASSERT(rc == -EINVAL);
1268 
1269  rc = m0_spiel_process_add(&tx,
1272  &zero_bitmap, 4000, 1, 2, 3, ep[0]);
1273  M0_UT_ASSERT(rc == -EINVAL);
1274 
1275  rc = m0_spiel_process_add(&tx,
1278  &bitmap, 4000, 1, 2, 3, ep[0]);
1279  M0_UT_ASSERT(rc == 0);
1280 
1281  /* Service */
1282  service_info.svi_endpoints = ep;
1283  service_info.svi_type = M0_CST_CONFD;
1284  rc = m0_spiel_service_add(&tx,
1285  &fake_fid,
1287  &service_info);
1288  M0_UT_ASSERT(rc == -EINVAL);
1289 
1290  rc = m0_spiel_service_add(&tx,
1292  &fake_fid,
1293  &service_info);
1294  M0_UT_ASSERT(rc == -EINVAL);
1295 
1296  rc = m0_spiel_service_add(&tx,
1299  NULL);
1300  M0_UT_ASSERT(rc == -EINVAL);
1301 
1302  /* Check copy endpoints parameter */
1303  m0_fi_enable("m0_alloc", "fail_allocation");
1304  rc = m0_spiel_service_add(&tx,
1307  &service_info);
1308  M0_UT_ASSERT(rc == -ENOMEM);
1309  m0_fi_disable("m0_alloc", "fail_allocation");
1310 
1311  /* Check copy cs_u parameter & switch by type */
1312  service_info.svi_type = M0_CST_MDS;
1313  rc = m0_spiel_service_add(&tx,
1316  &service_info);
1317  M0_UT_ASSERT(rc == 0);
1318 
1319  service_info.svi_type = M0_CST_IOS;
1322  rc = m0_spiel_service_add(&tx,
1325  &service_info);
1326  M0_UT_ASSERT(rc == 0);
1327 
1328  service_info.svi_type = M0_CST_CONFD;
1331  rc = m0_spiel_service_add(&tx,
1334  &service_info);
1335  M0_UT_ASSERT(rc == 0);
1336 
1337  service_info.svi_type = M0_CST_RMS;
1340  rc = m0_spiel_service_add(&tx,
1343  &service_info);
1344  M0_UT_ASSERT(rc == 0);
1345 
1346  service_info.svi_type = M0_CST_SSS;
1349  rc = m0_spiel_service_add(&tx,
1352  &service_info);
1353  M0_UT_ASSERT(rc == 0);
1354 
1355  service_info.svi_type = M0_CST_HA;
1358  rc = m0_spiel_service_add(&tx,
1361  &service_info);
1362  M0_UT_ASSERT(rc == 0);
1363 
1364  service_info.svi_type = M0_CST_NR;
1367  rc = m0_spiel_service_add(&tx,
1370  &service_info);
1371  M0_UT_ASSERT(rc == -EINVAL);
1372 
1373  /* Normal */
1374  service_info.svi_type = M0_CST_CONFD;
1377  rc = m0_spiel_service_add(&tx,
1380  &service_info);
1381  M0_UT_ASSERT(rc == 0);
1382 
1383  /* Device */
1384  rc = m0_spiel_device_add(&tx,
1385  &fake_fid,
1390  1024, 512, 123, 0x55, "fake_filename");
1391  M0_UT_ASSERT(rc == -EINVAL);
1392 
1393  rc = m0_spiel_device_add(&tx,
1395  &fake_fid,
1396  &fake_fid,
1399  1024, 512, 123, 0x55, "fake_filename");
1400  M0_UT_ASSERT(rc == -EINVAL);
1401 
1402  rc = m0_spiel_device_add(&tx,
1408  1024, 512, 123, 0x55, "fake_filename");
1409  M0_UT_ASSERT(rc == -EINVAL);
1410 
1411  rc = m0_spiel_device_add(&tx,
1417  1024, 512, 123, 0x55, "fake_filename");
1418  M0_UT_ASSERT(rc == -EINVAL);
1419 
1420  rc = m0_spiel_device_add(&tx,
1426  1024, 512, 123, 0x55, NULL);
1427  M0_UT_ASSERT(rc == -EINVAL);
1428 
1429  rc = m0_spiel_device_add(&tx,
1435  1024, 512, 123, 0x55, "fake_filename");
1436  M0_UT_ASSERT(rc == 0);
1437 
1438  m0_spiel_tx_close(&tx);
1439 
1440  m0_bitmap_fini(&bitmap);
1443 
1445 }
1446 
1447 static void spiel_conf_delete(void)
1448 {
1449  struct m0_spiel_tx tx;
1450  int rc;
1451  struct m0_conf_obj *obj;
1452  struct m0_conf_enclosure *enclosure;
1453 
1455 
1459  enclosure = M0_CONF_CAST(obj, m0_conf_enclosure);
1460  M0_UT_ASSERT(enclosure != NULL);
1461 
1463  M0_UT_ASSERT(rc == 0);
1464 
1465  M0_UT_ASSERT(enclosure->ce_pvers[0] != NULL);
1467  M0_UT_ASSERT(rc == 0);
1468  M0_UT_ASSERT(enclosure->ce_pvers[0] == NULL);
1469 
1470  m0_spiel_tx_close(&tx);
1471 
1473 }
1474 
1481 {
1482  int rc;
1483  const char *ep[] = { SERVER_ENDPOINT_ADDR,
1484  NULL };
1485  const char *ep_service1[] = { "addr-0",
1486  "addr-1",
1487  "addr-2",
1488  NULL };
1489  const char *ep_service2[] = { "addr-3", NULL };
1490  const char *ep_service3[] = { "addr-3", NULL };
1491  struct m0_pdclust_attr pdclust_attr = { 0, 0, 0, 0 };
1492  const char *params[] = { "param-0",
1493  "param-1",
1494  "param-2",
1495  NULL };
1496  struct m0_spiel_service_info service_info1 = {
1497  .svi_endpoints = ep_service1 };
1498  struct m0_spiel_service_info service_info2 = {
1499  .svi_endpoints = ep_service2 };
1500  struct m0_spiel_service_info service_info3 = {
1501  .svi_endpoints = ep_service3 };
1502  /* @todo Add support for fdmi objects (filters group and filters) */
1503  struct m0_fid fid_profile = M0_FID_TINIT('p', 1, 0);
1504  struct m0_fid fid_node = M0_FID_TINIT('n', 1, 2);
1505  struct m0_fid fid_site = M0_FID_TINIT('S', 1, 3);
1506  struct m0_fid fid_rack = M0_FID_TINIT('a', 1, 3);
1507  struct m0_fid fid_pool = M0_FID_TINIT('o', 1, 4);
1508  struct m0_fid fid_process1 = M0_FID_TINIT('r', 1, 5);
1509  struct m0_fid fid_process2 = M0_FID_TINIT('r', 1, 6);
1510  struct m0_fid fid_process3 = M0_FID_TINIT('r', 1, 7);
1511  struct m0_fid fid_enclosure = M0_FID_TINIT('e', 1, 8);
1512  struct m0_fid fid_pver = M0_FID_TINIT('v', 1, 9);
1513  struct m0_fid fid_service1 = M0_FID_TINIT('s', 1, 10);
1514  struct m0_fid fid_service2 = M0_FID_TINIT('s', 1, 11);
1515  struct m0_fid fid_service3 = M0_FID_TINIT('s', 1, 12);
1516  struct m0_fid fid_controller = M0_FID_TINIT('c', 1, 13);
1517  struct m0_fid fid_drive1 = M0_FID_TINIT('k', 1, 14);
1518  struct m0_fid fid_drive2 = M0_FID_TINIT('k', 1, 15);
1519  struct m0_fid fid_drive3 = M0_FID_TINIT('k', 1, 16);
1520  struct m0_fid fid_site_v = M0_FID_TINIT('j', 2, 17);
1521  struct m0_fid fid_rack_v = M0_FID_TINIT('j', 1, 17);
1522  struct m0_fid fid_sdev1 = M0_FID_TINIT('d', 1, 18);
1523  struct m0_fid fid_sdev2 = M0_FID_TINIT('d', 1, 19);
1524  struct m0_fid fid_sdev3 = M0_FID_TINIT('d', 1, 20);
1525  struct m0_fid fid_enclosure_v = M0_FID_TINIT('j', 1, 21);
1526  struct m0_fid fid_controller_v = M0_FID_TINIT('j', 1, 22);
1527  struct m0_fid fid_drive_v1 = M0_FID_TINIT('j', 1, 23);
1528  struct m0_fid fid_drive_v2 = M0_FID_TINIT('j', 1, 24);
1529  struct m0_fid fid_drive_v3 = M0_FID_TINIT('j', 1, 25);
1530  uint32_t tolerance[] = {0, 0, 0, 0, 1};
1531  struct m0_bitmap bitmap;
1532 
1533  m0_bitmap_init(&bitmap, 32);
1534  m0_bitmap_set(&bitmap, 0, true);
1535  m0_bitmap_set(&bitmap, 1, true);
1536 
1537  rc = m0_spiel_root_add(tx, &fid_profile, &fid_pool,
1538  &fid_pver, 41212, params);
1539  M0_UT_ASSERT(rc == 0);
1540 
1541  rc = m0_spiel_profile_add(tx, &fid_profile);
1542  M0_UT_ASSERT(rc == 0);
1543 
1544  rc = m0_spiel_pool_add(tx, &fid_pool, 0);
1545  M0_UT_ASSERT(rc == 0);
1546 
1547  rc = m0_spiel_site_add(tx, &fid_site);
1548  M0_UT_ASSERT(rc == 0);
1549 
1550  rc = m0_spiel_rack_add(tx, &fid_rack, &fid_site);
1551  M0_UT_ASSERT(rc == 0);
1552 
1553  rc = m0_spiel_node_add(tx, &fid_node, 16000, 2, 3, 2);
1554  M0_UT_ASSERT(rc == 0);
1555 
1556  rc = m0_spiel_enclosure_add(tx, &fid_enclosure, &fid_rack,
1557  &fid_node);
1558  M0_UT_ASSERT(rc == 0);
1559 
1560  rc = m0_spiel_controller_add(tx, &fid_controller, &fid_enclosure);
1561  M0_UT_ASSERT(rc == 0);
1562 
1563  rc = m0_spiel_drive_add(tx, &fid_drive1, &fid_controller);
1564  M0_UT_ASSERT(rc == 0);
1565 
1566  rc = m0_spiel_drive_add(tx, &fid_drive2, &fid_controller);
1567  M0_UT_ASSERT(rc == 0);
1568 
1569  rc = m0_spiel_drive_add(tx, &fid_drive3, &fid_controller);
1570  M0_UT_ASSERT(rc == 0);
1571 
1572  rc = m0_spiel_pver_actual_add(tx, &fid_pver, &fid_pool, &pdclust_attr,
1573  tolerance, ARRAY_SIZE(tolerance));
1574  M0_UT_ASSERT(rc == 0);
1575 
1576  rc = m0_spiel_site_v_add(tx, &fid_site_v, &fid_pver, &fid_site);
1577  M0_UT_ASSERT(rc == 0);
1578 
1579  rc = m0_spiel_rack_v_add(tx, &fid_rack_v, &fid_site_v, &fid_rack);
1580  M0_UT_ASSERT(rc == 0);
1581 
1582  rc = m0_spiel_enclosure_v_add(tx, &fid_enclosure_v, &fid_rack_v,
1583  &fid_enclosure);
1584  M0_UT_ASSERT(rc == 0);
1585 
1586  rc = m0_spiel_controller_v_add(tx, &fid_controller_v, &fid_enclosure_v,
1587  &fid_controller);
1588  M0_UT_ASSERT(rc == 0);
1589 
1590  rc = m0_spiel_drive_v_add(tx, &fid_drive_v1, &fid_controller_v,
1591  &fid_drive1);
1592  M0_UT_ASSERT(rc == 0);
1593 
1594  rc = m0_spiel_drive_v_add(tx, &fid_drive_v2, &fid_controller_v,
1595  &fid_drive2);
1596  M0_UT_ASSERT(rc == 0);
1597 
1598  rc = m0_spiel_drive_v_add(tx, &fid_drive_v3, &fid_controller_v,
1599  &fid_drive3);
1600  M0_UT_ASSERT(rc == 0);
1601 
1602  rc = m0_spiel_pool_version_done(tx, &fid_pver);
1603  M0_UT_ASSERT(rc == 0);
1604 
1605  rc = m0_spiel_process_add(tx, &fid_process1, &fid_node,
1606  &bitmap, 4000, 1, 2, 3, ep[0]);
1607  M0_UT_ASSERT(rc == 0);
1608 
1609  rc = m0_spiel_process_add(tx, &fid_process2, &fid_node,
1610  &bitmap, 4000, 1, 2, 3, ep[0]);
1611  M0_UT_ASSERT(rc == 0);
1612 
1613  rc = m0_spiel_process_add(tx, &fid_process3, &fid_node,
1614  &bitmap, 4000, 1, 2, 3, ep[0]);
1615  M0_UT_ASSERT(rc == 0);
1616 
1617  service_info1.svi_type = M0_CST_CONFD;
1618  rc = m0_spiel_service_add(tx, &fid_service1, &fid_process1,
1619  &service_info1);
1620  M0_UT_ASSERT(rc == 0);
1621 
1622  service_info2.svi_type = M0_CST_MDS;
1623  rc = m0_spiel_service_add(tx, &fid_service2, &fid_process2,
1624  &service_info2);
1625  M0_UT_ASSERT(rc == 0);
1626 
1627  service_info3.svi_type = M0_CST_FDMI;
1628  rc = m0_spiel_service_add(tx, &fid_service3, &fid_process3,
1629  &service_info3);
1630  M0_UT_ASSERT(rc == 0);
1631 
1632  rc = m0_spiel_device_add(tx, &fid_sdev1, &fid_service1, &fid_drive1, 1,
1633  4, 1, 4096, 596000000000, 3, 4, "/dev/sdev0");
1634  M0_UT_ASSERT(rc == 0);
1635 
1636  rc = m0_spiel_device_add(tx, &fid_sdev2, &fid_service1, &fid_drive2, 2,
1637  4, 1, 4096, 596000000000, 3, 4, "/dev/sdev1");
1638  M0_UT_ASSERT(rc == 0);
1639 
1640  rc = m0_spiel_device_add(tx, &fid_sdev3, &fid_service2, &fid_drive3, 3,
1641  7, 2, 8192, 320000000000, 2, 4, "/dev/sdev2");
1642  M0_UT_ASSERT(rc == 0);
1643 
1644  m0_bitmap_fini(&bitmap);
1645 }
1646 
1647 static void spiel_conf_file(void)
1648 {
1649  int rc;
1650  struct m0_spiel_tx tx;
1651  char *confstr = NULL;
1652  const char filename[] = "spiel-conf.xc";
1653  const int ver_forced = 10;
1654  struct m0_conf_cache cache;
1655  struct m0_mutex lock;
1656 
1658 
1659  m0_spiel_tx_open(&spiel, &tx);
1661 
1662  /* Convert to file */
1663  rc = m0_spiel_tx_dump(&tx, ver_forced, filename);
1664  M0_UT_ASSERT(rc == 0);
1665  M0_UT_ASSERT(m0_conf_version(&tx.spt_cache) == ver_forced);
1666  m0_spiel_tx_close(&tx);
1667 
1668  /* Load file */
1669  rc = m0_file_read(filename, &confstr);
1670  M0_UT_ASSERT(rc == 0);
1671  rc = unlink(filename);
1672  M0_UT_ASSERT(rc == 0);
1673 
1674  m0_mutex_init(&lock);
1676 
1677  m0_mutex_lock(&lock);
1678 
1679  rc = m0_conf_cache_from_string(&cache, confstr);
1680  m0_free(confstr);
1681  M0_UT_ASSERT(rc == 0);
1683 
1685  m0_mutex_fini(&lock);
1687 }
1688 
1689 static void spiel_conf_cancel(void)
1690 {
1691  struct m0_spiel_tx tx;
1692 
1695  m0_spiel_tx_close(&tx);
1697 }
1698 
1702 static void spiel_conf_load_send(void)
1703 {
1704  struct m0_spiel_tx tx;
1705  int i;
1706  int rc;
1707 
1709  /*
1710  * Check that the second commit is possible and there is no panic.
1711  * See MOTR-2311.
1712  */
1713  m0_fi_enable("storage_devs_conf_expired_cb", "skip_storage_devs_expired_cb");
1714  m0_fi_enable("storage_devs_conf_ready_async_cb",
1715  "skip_storage_devs_ready_cb");
1716  for (i = 0; i < 2; i++) {
1718  rc = m0_spiel_tx_commit(&tx);
1719  M0_UT_ASSERT(rc == 0);
1720  m0_spiel_tx_close(&tx);
1721  }
1722  m0_fi_disable("storage_devs_conf_expired_cb", "skip_storage_devs_expired_cb");
1723  m0_fi_disable("storage_devs_conf_ready_async_cb",
1724  "skip_storage_devs_ready_cb");
1726 }
1727 
1731 static void spiel_conf_drop_svc(void)
1732 {
1733  struct m0_spiel_tx tx;
1734  int rc;
1735 
1738  rc = m0_spiel_tx_commit(&tx);
1739  M0_UT_ASSERT(rc == 0);
1740  m0_spiel_tx_close(&tx);
1742 }
1743 
1747 static void spiel_conf_add_svc(void)
1748 {
1749  struct m0_spiel_tx tx;
1750  int rc;
1751 
1754  rc = m0_spiel_tx_commit(&tx);
1755  M0_UT_ASSERT(rc == 0);
1756  m0_spiel_tx_close(&tx);
1758 }
1759 
1763 static void spiel_conf_big_db(void)
1764 {
1765 #define SVC_EP "0@lo:12345:41:201"
1766  struct m0_spiel_tx tx;
1767  int rc;
1768  int i;
1769  int svc_nr;
1771  const char *svc_ep[] = { SVC_EP, NULL };
1772  struct m0_spiel_service_info svc_info = {
1773  .svi_type = M0_CST_DS1,
1774  .svi_endpoints = svc_ep
1775  };
1777  char *cache_str;
1778  uint32_t svc_str_size =
1779  sizeof("{0x73|((^s|1:0), @M0_CST_MDS, [1: "SVC_EP"], [0],"
1780  " [0])},") - 1;
1781 
1788  m0_fi_enable("m0_conf_segment_size", "const_size");
1790  m0_fi_disable("m0_conf_segment_size", "const_size");
1791  svc_nr = seg_size/svc_str_size + 1;
1792  for (i = 0; i < svc_nr; i++) {
1793  fid.f_key++;
1794  rc = m0_spiel_service_add(&tx, &fid,
1796  &svc_info);
1797  M0_UT_ASSERT(rc == 0);
1798  }
1799  rc = m0_conf_cache_to_string(&tx.spt_cache, &cache_str, false);
1800  M0_UT_ASSERT(rc == 0);
1801  M0_UT_ASSERT(strlen(cache_str) > seg_size);
1802  rc = m0_spiel_tx_commit(&tx);
1803  M0_UT_ASSERT(rc == 0);
1804  m0_confx_string_free(cache_str);
1805  m0_spiel_tx_close(&tx);
1807 }
1808 
1809 static void spiel_conf_flip_fail(void)
1810 {
1811  struct m0_spiel_tx tx;
1812  int rc;
1813 
1816  m0_fi_enable_once("conf_flip_confd_config_save", "fcreate_failed");
1817  rc = m0_spiel_tx_commit(&tx);
1818  M0_UT_ASSERT(rc == -ENOENT);
1819  m0_spiel_tx_close(&tx);
1821 }
1822 
1823 static void spiel_conf_check_fail(void)
1824 {
1825  struct m0_spiel_tx tx;
1826  int rc;
1827  struct m0_conf_obj *obj = NULL;
1828  struct m0_conf_obj *obj_parent;
1829  struct m0_conf_cache *cache = &tx.spt_cache;
1830  struct m0_fid fake_fid = M0_FID_TINIT('n', 6, 600 );
1831 
1834 
1835  m0_tl_for(m0_conf_cache, &cache->ca_registry, obj) {
1837  break;
1838  } m0_tl_endfor;
1839 
1840  /* spiel_check_cache(tx) test */
1841  obj->co_status = M0_CS_MISSING;
1842  rc = m0_spiel_tx_commit(&tx);
1843  obj->co_status = M0_CS_READY;
1844  M0_UT_ASSERT(rc == -EBUSY);
1845 
1846  obj_parent = obj->co_parent;
1847 
1848  obj->co_parent = NULL;
1849  rc = m0_spiel_tx_commit(&tx);
1850  M0_UT_ASSERT(rc == -ENOENT);
1851 
1852  obj->co_parent = m0_conf_obj_create(&fake_fid, cache);
1853  rc = m0_spiel_tx_commit(&tx);
1854  M0_UT_ASSERT(rc == -ENOENT);
1855 
1856  obj->co_parent->co_ops->coo_delete(obj->co_parent);
1857  obj->co_parent = obj_parent;
1858 
1859  /* conf_cache_encode test */
1860  m0_fi_enable_once("m0_spiel_tx_commit_forced", "encode_fail");
1861  rc = m0_spiel_tx_commit(&tx);
1862  M0_UT_ASSERT(rc == -ENOMEM);
1863 
1864  m0_spiel_tx_close(&tx);
1866 }
1867 
1868 static void spiel_conf_load_fail(void)
1869 {
1870  struct m0_spiel_tx tx;
1871  int rc;
1872 
1875  m0_fi_enable_once("m0_spiel_tx_commit_forced", "cmd_alloc_fail");
1876  rc = m0_spiel_tx_commit(&tx);
1877  M0_UT_ASSERT(rc == -ENOMEM);
1878 
1879  m0_spiel_tx_close(&tx);
1881 }
1882 
1883 static void spiel_conf_dump(void)
1884 {
1885  struct m0_spiel_tx tx;
1886  struct m0_spiel_tx tx_bad;
1887  const char *filename = "config.xc";
1888  const char *filename_bad = "config_b.xc";
1889  const int ver_forced = 10;
1890  int rc;
1891 
1893 
1895  rc = m0_spiel_tx_validate(&tx);
1896  M0_UT_ASSERT(rc == 0);
1897  rc = m0_spiel_tx_dump(&tx, ver_forced, filename);
1898  M0_UT_ASSERT(rc == 0);
1899  M0_UT_ASSERT(m0_conf_version(&tx.spt_cache) == ver_forced);
1900 
1902  rc = m0_spiel_tx_validate(&tx_bad);
1903  M0_UT_ASSERT(rc != 0);
1904  rc = m0_spiel_tx_dump_debug(&tx_bad, 2, filename_bad);
1905  M0_UT_ASSERT(rc == 0);
1906 
1908 }
1909 
1910 static void spiel_conf_tx_invalid(void)
1911 {
1912  struct m0_spiel_tx tx;
1913  int rc;
1914 
1917  rc = m0_spiel_tx_validate(&tx);
1918  M0_UT_ASSERT(rc != 0);
1920 }
1921 
1922 static void spiel_conf_tx_no_spiel(void)
1923 {
1924  struct m0_spiel_tx tx;
1925  const int ver_forced = 10;
1926  char *local_conf;
1927  int rc;
1928 
1930  rc = m0_spiel_tx_validate(&tx);
1931  M0_UT_ASSERT(rc == 0);
1932  rc = m0_spiel_tx_to_str(&tx, ver_forced, &local_conf);
1933  M0_UT_ASSERT(rc == 0);
1934  M0_UT_ASSERT(m0_conf_version(&tx.spt_cache) == ver_forced);
1936  m0_spiel_tx_close(&tx);
1937 }
1938 
1939 static void spiel_conf_expired(void)
1940 {
1941  struct m0_confc *confc = m0_motr2confc(
1943  struct m0_spiel_tx tx;
1944  struct m0_rm_ha_tracker tracker;
1945  char *rm_ep = "0@lo:12345:34:1";
1946  int rc;
1947 
1948  m0_fi_enable("rm_ha_sbscr_diter_next", "subscribe");
1950  m0_rm_ha_tracker_init(&tracker, NULL);
1951  m0_rm_ha_subscribe_sync(confc, rm_ep, &tracker);
1953  rc = m0_spiel_tx_commit(&tx);
1954  M0_UT_ASSERT(rc == 0);
1955  m0_spiel_tx_close(&tx);
1956  m0_rm_ha_tracker_fini(&tracker);
1958  m0_fi_disable("rm_ha_sbscr_diter_next", "subscribe");
1959 }
1960 
1961 static void spiel_conf_wlock_get_fail(void)
1962 {
1963  struct m0_spiel_tx tx;
1964  int rc;
1965 
1968  m0_fi_enable_once("spiel_tx_write_lock_get", "borrow-request-failure");
1969  rc = m0_spiel_tx_commit(&tx);
1970  M0_UT_ASSERT(rc == -EIO);
1971  m0_spiel_tx_close(&tx);
1973 }
1974 
1976  .ts_name = "spiel-conf-ut",
1977  .ts_tests = {
1978  { "create-ok", spiel_conf_create_ok },
1979  { "create-fail", spiel_conf_create_fail },
1980  { "delete", spiel_conf_delete },
1981  { "file", spiel_conf_file },
1982  { "cancel", spiel_conf_cancel },
1983  { "load-send", spiel_conf_load_send },
1984  { "big-db", spiel_conf_big_db },
1985  { "flip-fail", spiel_conf_flip_fail },
1986  { "check-fail", spiel_conf_check_fail },
1987  { "load-fail", spiel_conf_load_fail },
1988  { "dump", spiel_conf_dump },
1989  { "tx-invalid", spiel_conf_tx_invalid },
1990  { "tx-no-spiel", spiel_conf_tx_no_spiel },
1991  { "drop-svc", spiel_conf_drop_svc },
1992  { "add-svc", spiel_conf_add_svc },
1993  { "conf-expired", spiel_conf_expired },
1994  { "wlock-get-fail", spiel_conf_wlock_get_fail },
1995  { NULL, NULL },
1996  },
1997 };
1998 M0_EXPORTED(spiel_conf_ut);
1999 
2000 #undef M0_TRACE_SUBSYSTEM
2001 
2002 /*
2003  * Local variables:
2004  * c-indentation-style: "K&R"
2005  * c-basic-offset: 8
2006  * tab-width: 8
2007  * fill-column: 80
2008  * scroll-step: 1
2009  * End:
2010  */
static m0_bcount_t seg_size
Definition: net.c:118
const struct m0_conf_obj_type * m0_conf_obj_type(const struct m0_conf_obj *obj)
Definition: obj.c:363
int m0_spiel_pver_formulaic_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, uint32_t index, const struct m0_fid *base_pver, uint32_t *allowance, uint32_t allowance_len)
Definition: conf_mgmt.c:1659
Definition: beck.c:235
static struct m0_mutex lock
Definition: transmit.c:326
struct m0_conf_pver ** cr_pvers
Definition: obj.h:675
static void spiel_conf_add_svc(void)
m0_conf_version
Definition: cache.h:75
M0_INTERNAL int m0_bitmap_init(struct m0_bitmap *map, size_t nr)
Definition: bitmap.c:86
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
Definition: mutex.c:66
static void spiel_conf_load_send(void)
int m0_spiel_tx_dump_debug(struct m0_spiel_tx *tx, uint64_t ver_forced, const char *filename)
Definition: conf_mgmt.c:2212
int m0_spiel_tx_commit(struct m0_spiel_tx *tx)
Definition: conf_mgmt.c:723
#define NULL
Definition: misc.h:38
static void spiel_conf_wlock_get_fail(void)
static void spiel_conf_file_create_tree(struct m0_spiel_tx *tx)
M0_INTERNAL void m0_bitmap_fini(struct m0_bitmap *map)
Definition: bitmap.c:97
int m0_spiel_tx_validate(struct m0_spiel_tx *tx)
Definition: conf_mgmt.c:136
int m0_spiel_service_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, const struct m0_spiel_service_info *service_info)
Definition: conf_mgmt.c:1101
int m0_spiel_profile_add(struct m0_spiel_tx *tx, const struct m0_fid *fid)
Definition: conf_mgmt.c:1236
int m0_spiel_pool_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, uint32_t pver_policy)
Definition: conf_mgmt.c:1339
static void spiel_conf_tx_no_spiel(void)
static void spiel_conf_create_invalid_configuration(struct m0_spiel *spiel, struct m0_spiel_tx *tx)
uint32_t pa_N
Definition: pdclust.h:104
static void spiel_conf_ut_fini(void)
M0_INTERNAL struct m0_conf_obj * m0_conf_cache_lookup(const struct m0_conf_cache *cache, const struct m0_fid *id)
Definition: cache.c:106
M0_INTERNAL int m0_file_read(const char *path, char **out)
Definition: fs.c:61
static void spiel_conf_tx_invalid(void)
M0_INTERNAL void m0_confx_string_free(char *str)
Definition: preload.c:86
static void spiel_conf_check_fail(void)
spiel_conf_opts
struct m0_conf_pver ** cc_pvers
Definition: obj.h:703
struct m0_conf_pver ** ce_pvers
Definition: obj.h:690
struct m0_rpc_server_ctx sur_confd_srv
static void spiel_conf_create_configuration(struct m0_spiel *spiel, struct m0_spiel_tx *tx)
void m0_spiel_tx_str_free(char *str)
Definition: conf_mgmt.c:2182
static void spiel_conf_pver_check(struct m0_spiel_tx *tx)
int m0_spiel_pool_version_done(struct m0_spiel_tx *tx, const struct m0_fid *fid)
Definition: conf_mgmt.c:2075
int m0_spiel_root_add(struct m0_spiel_tx *tx, const struct m0_fid *rootfid, const struct m0_fid *mdpool, const struct m0_fid *imeta_pver, uint32_t mdredundancy, const char **params)
Definition: conf_mgmt.c:902
const char ** svi_endpoints
Definition: spiel.h:445
uint64_t m0_bcount_t
Definition: types.h:77
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
Definition: mutex.c:49
#define SVC_EP
Definition: ut.h:77
M0_INTERNAL m0_bcount_t m0_conf_segment_size(struct m0_fop *fop)
Definition: load_fop.c:65
static struct foo * obj
Definition: tlist.c:302
Definition: sock.c:887
#define m0_tl_endfor
Definition: tlist.h:700
struct m0_fid fid
Definition: di.c:46
void m0_spiel_tx_close(struct m0_spiel_tx *tx)
Definition: conf_mgmt.c:171
int m0_spiel_site_add(struct m0_spiel_tx *tx, const struct m0_fid *fid)
Definition: conf_mgmt.c:1382
Definition: sock.c:754
M0_INTERNAL void m0_spiel__ut_fini(struct m0_spiel *spiel, bool cmd_iface)
int i
Definition: dir.c:1033
static void spiel_conf_ut_init(void)
M0_INTERNAL void m0_rm_ha_tracker_fini(struct m0_rm_ha_tracker *tracker)
Definition: rm_ha.c:408
static void spiel_conf_load_fail(void)
int m0_spiel_enclosure_v_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, const struct m0_fid *real)
Definition: conf_mgmt.c:1816
#define M0_FID_TINIT(type, container, key)
Definition: fid.h:90
int m0_spiel_drive_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent)
Definition: conf_mgmt.c:1562
int m0_spiel_tx_dump(struct m0_spiel_tx *tx, uint64_t ver_forced, const char *filename)
Definition: conf_mgmt.c:2205
M0_INTERNAL void m0_fi_disable(const char *fp_func, const char *fp_tag)
Definition: finject.c:485
M0_INTERNAL int m0_conf_ut_ast_thread_fini(void)
Definition: common.c:96
static void spiel_conf_drop_svc(void)
static void m0_fi_enable(const char *func, const char *tag)
Definition: finject.h:276
#define M0_ASSERT(cond)
M0_INTERNAL int m0_conf_cache_to_string(struct m0_conf_cache *cache, char **str, bool debug)
Definition: cache.c:257
static struct m0_confc * confc
Definition: file.c:94
int m0_spiel_profile_pool_add(struct m0_spiel_tx *tx, const struct m0_fid *profile, const struct m0_fid *pool)
Definition: conf_mgmt.c:1304
struct m0_spiel_ut_reqh ut_reqh
struct m0_fid pver
Definition: idx_dix.c:74
static void spiel_conf_create_ok(void)
static void spiel_conf_create_pver_tree(struct m0_spiel_tx *tx)
struct m0_ut_suite spiel_conf_ut
M0_INTERNAL void m0_conf_cache_init(struct m0_conf_cache *cache, struct m0_mutex *lock)
Definition: cache.c:66
struct m0_reqh rc_reqh
Definition: setup.h:312
int m0_spiel_element_del(struct m0_spiel_tx *tx, const struct m0_fid *fid)
Definition: conf_mgmt.c:2124
static char local_conf[]
Definition: file.c:115
int m0_spiel_rack_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent)
Definition: conf_mgmt.c:1426
struct m0_mutex spt_lock
Definition: spiel.h:266
static void spiel_conf_expired(void)
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
Definition: mutex.c:35
uint64_t f_container
Definition: fid.h:39
static void spiel_conf_delete(void)
M0_INTERNAL struct m0_confc * m0_motr2confc(struct m0_motr *motr)
Definition: setup.c:191
M0_INTERNAL void m0_rconfc_lock(struct m0_rconfc *rconfc)
Definition: rconfc.c:2841
int m0_spiel_enclosure_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, const struct m0_fid *node)
Definition: conf_mgmt.c:1470
M0_INTERNAL void m0_bitmap_set(struct m0_bitmap *map, size_t idx, bool val)
Definition: bitmap.c:139
int m0_spiel_pver_actual_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, const struct m0_pdclust_attr *attrs, uint32_t *tolerance, uint32_t tolerance_len)
Definition: conf_mgmt.c:1601
M0_INTERNAL int m0_rm_ha_subscribe_sync(struct m0_confc *confc, const char *rem_ep, struct m0_rm_ha_tracker *tracker)
Definition: rm_ha.c:360
int m0_spiel_controller_v_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, const struct m0_fid *real)
Definition: conf_mgmt.c:1864
#define M0_CONF_CAST(ptr, type)
Definition: obj.h:780
int m0_spiel_controller_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent)
Definition: conf_mgmt.c:1518
int m0_spiel_device_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, const struct m0_fid *drive, uint32_t dev_idx, enum m0_cfg_storage_device_interface_type iface, enum m0_cfg_storage_device_media_type media, uint32_t bsize, uint64_t size, uint64_t last_state, uint64_t flags, const char *filename)
Definition: conf_mgmt.c:1156
M0_INTERNAL void m0_spiel__ut_init(struct m0_spiel *spiel, const char *confd_path, bool cmd_iface)
M0_INTERNAL int m0_conf_ut_ast_thread_init(void)
Definition: common.c:86
static void m0_fi_enable_off_n_on_m(const char *func, const char *tag, uint32_t n, uint32_t m)
Definition: finject.h:346
void m0_spiel_tx_open(struct m0_spiel *spiel, struct m0_spiel_tx *tx)
Definition: conf_mgmt.c:105
static void spiel_conf_create_conf_with_opt(struct m0_spiel *spiel, struct m0_spiel_tx *tx, uint64_t opts)
const char * ts_name
Definition: ut.h:99
static void spiel_conf_file(void)
static int spiel_copy_file(const char *source, const char *dest)
M0_INTERNAL void m0_rconfc_unlock(struct m0_rconfc *rconfc)
Definition: rconfc.c:2855
m0_rconfc_cb_t rc_expired_cb
Definition: rconfc.h:278
static struct m0_fid spiel_obj_fid[]
M0_INTERNAL struct m0_conf_obj * m0_conf_obj_create(const struct m0_fid *id, struct m0_conf_cache *cache)
Definition: obj_ops.c:80
int m0_spiel_tx_to_str(struct m0_spiel_tx *tx, uint64_t ver_forced, char **str)
Definition: conf_mgmt.c:2174
int m0_spiel_rack_v_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, const struct m0_fid *real)
Definition: conf_mgmt.c:1768
int m0_spiel_drive_v_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, const struct m0_fid *real)
Definition: conf_mgmt.c:1912
char * ep
Definition: sw.h:132
int m0_spiel_process_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, struct m0_bitmap *cores, uint64_t memlimit_as, uint64_t memlimit_rss, uint64_t memlimit_stack, uint64_t memlimit_memlock, const char *endpoint)
Definition: conf_mgmt.c:1033
struct m0_conf_cache spt_cache
Definition: spiel.h:264
struct m0_reqh_context cc_reqh_ctx
Definition: setup.h:361
Definition: fid.h:38
uint64_t f_key
Definition: fid.h:40
static void spiel_conf_flip_fail(void)
M0_INTERNAL int m0_conf_cache_from_string(struct m0_conf_cache *cache, const char *str)
Definition: cache.c:278
struct m0_spiel spiel
Definition: spiel_conf_ut.c:42
static void spiel_conf_pver_delete_check(struct m0_spiel_tx *tx)
int m0_spiel_node_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, uint32_t memsize, uint32_t nr_cpu, uint64_t last_state, uint64_t flags)
Definition: conf_mgmt.c:974
Definition: common.h:34
static void spiel_conf_cancel(void)
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
Definition: mutex.c:42
static void m0_fi_enable_once(const char *func, const char *tag)
Definition: finject.h:301
static struct m0_rconfc * rconfc(struct m0_client *m0c)
Definition: client_init.c:310
struct m0_rconfc rh_rconfc
Definition: reqh.h:166
M0_INTERNAL void m0_rm_ha_tracker_init(struct m0_rm_ha_tracker *tracker, m0_chan_cb_t cb)
Definition: rm_ha.c:399
M0_INTERNAL void m0_confc_ready_cb(struct m0_rconfc *rconfc)
Definition: helpers.c:488
#define SERVER_ENDPOINT_ADDR
Definition: common.h:30
enum m0_conf_service_type svi_type
Definition: spiel.h:440
const struct m0_conf_obj_type M0_CONF_PROCESS_TYPE
Definition: process.c:161
#define M0_UT_PATH(name)
Definition: misc.h:41
int m0_spiel_site_v_add(struct m0_spiel_tx *tx, const struct m0_fid *fid, const struct m0_fid *parent, const struct m0_fid *real)
Definition: conf_mgmt.c:1716
M0_INTERNAL void m0_confc_expired_cb(struct m0_rconfc *rconfc)
Definition: helpers.c:465
size_t b_nr
Definition: bitmap.h:44
#define M0_FID0
Definition: fid.h:93
M0_INTERNAL void m0_conf_cache_fini(struct m0_conf_cache *cache)
Definition: cache.c:183
static void spiel_conf_big_db(void)
Definition: net.c:93
#define m0_tl_for(name, head, obj)
Definition: tlist.h:695
static void spiel_conf_dump(void)
void m0_free(void *data)
Definition: memory.c:146
Definition: mutex.h:47
#define FID_MOVE(fid, step)
int32_t rc
Definition: trigger_fop.h:47
#define ARRAY_SIZE(a)
Definition: misc.h:45
#define M0_UT_ASSERT(a)
Definition: ut.h:46
struct m0_motr rsx_motr_ctx
Definition: rpclib.h:84
m0_rconfc_cb_t rc_ready_cb
Definition: rconfc.h:294
static void spiel_conf_create_fail(void)