DAOS API: src/include/daos_pool.h Source File

| DAOS API (v2.1 - dev)

Loading...
Searching...
No Matches
daos_pool.h
1
9#ifndef __DAOS_POOL_H__
10#define __DAOS_POOL_H__
11
12#define daos_pool_connect daos_pool_connect2
13
14#if defined(__cplusplus)
15extern "C" {
16#endif
17
19typedef enum {
20 DAOS_TP_UNKNOWN,
22 DAOS_TP_HDD,
24 DAOS_TP_SSD,
26 DAOS_TP_PM,
28 DAOS_TP_VM,
29} daos_target_type_t;
30
32typedef enum {
33 DAOS_TS_UNKNOWN,
34 /* Not available */
35 DAOS_TS_DOWN_OUT,
36 /* Not available, may need rebuild */
37 DAOS_TS_DOWN,
38 /* Up */
39 DAOS_TS_UP,
40 /* Up and running */
41 DAOS_TS_UP_IN,
42 /* Intermediate state for pool map change */
43 DAOS_TS_NEW,
44 /* Being drained */
45 DAOS_TS_DRAIN,
46} daos_target_state_t;
47
49 typedef struct {
51 int foo;
52} daos_target_perf_t;
53
54
56enum daos_media_type_t {
57 DAOS_MEDIA_SCM = 0,
58 DAOS_MEDIA_NVME,
59 DAOS_MEDIA_MAX
60};
61
63 struct daos_space {
65 uint64_t s_total[DAOS_MEDIA_MAX];
67 uint64_t s_free[DAOS_MEDIA_MAX];
68};
69
71 typedef struct {
73 daos_target_type_t ta_type;
75 daos_target_state_t ta_state;
77 daos_target_perf_t ta_perf;
79 struct daos_space ta_space;
80} daos_target_info_t;
81
83 struct daos_pool_space {
85 struct daos_space ps_space;
87 uint64_t ps_free_min[DAOS_MEDIA_MAX];
89 uint64_t ps_free_max[DAOS_MEDIA_MAX];
91 uint64_t ps_free_mean[DAOS_MEDIA_MAX];
93 uint32_t ps_ntargets;
95 uint32_t ps_padding;
96};
97
98enum daos_rebuild_state_t {
99 DRS_IN_PROGRESS = 0,
100 DRS_NOT_STARTED = 1,
101 DRS_COMPLETED = 2,
102};
103
105 struct daos_rebuild_status {
107 uint32_t rs_version;
109 uint32_t rs_seconds;
111 int32_t rs_errno;
115 union {
116 int32_t rs_state;
117 int32_t rs_done;
118 };
120 int32_t rs_padding32;
121
123 int32_t rs_fail_rank;
130 uint64_t rs_toberb_obj_nr;
132 uint64_t rs_obj_nr;
134 uint64_t rs_rec_nr;
135
137 uint64_t rs_size;
138};
139
151enum daos_pool_info_bit {
153 DPI_SPACE = 1ULL << 0,
155 DPI_REBUILD_STATUS = 1ULL << 1,
159 DPI_ENGINES_ENABLED = 1ULL << 2,
161 DPI_ALL = -1,
162};
163
167 typedef struct {
169 uuid_t pi_uuid;
171 uint32_t pi_ntargets;
173 uint32_t pi_nnodes;
175 uint32_t pi_ndisabled;
177 uint32_t pi_map_ver;
179 uint32_t pi_leader;
181 uint64_t pi_bits;
183 struct daos_pool_space pi_space;
185 struct daos_rebuild_status pi_rebuild_st;
186} daos_pool_info_t;
187
189 struct daos_pool_cont_info {
191 uuid_t pci_uuid;
193 char pci_label[DAOS_PROP_LABEL_MAX_LEN+1];
194};
195
197 struct daos_pool_cont_info2 {
199 struct daos_pool_cont_info pci_id;
200
202 daos_cont_info_t pci_cinfo;
203
205 void *pci_reserved[2];
206};
207
208#define DAOS_SYS_NAME_MAX_LEN 127
209
234int
235daos_pool_connect(const char *pool, const char *sys, unsigned int flags,
236 daos_handle_t *poh, daos_pool_info_t *info, daos_event_t *ev);
237
252int
253daos_pool_disconnect(daos_handle_t poh, daos_event_t *ev);
254
255/*
256 * Handle API
257 */
258
279int
280daos_pool_local2global(daos_handle_t poh, d_iov_t *glob);
281
294int
295daos_pool_global2local(d_iov_t glob, daos_handle_t *poh);
296
335int
336daos_pool_query(daos_handle_t poh, d_rank_list_t **ranks, daos_pool_info_t *info,
337 daos_prop_t *pool_prop, daos_event_t *ev);
338
357int
358daos_pool_query_target(daos_handle_t poh, uint32_t tgt, d_rank_t rank,
359 daos_target_info_t *info, daos_event_t *ev);
360
378int
379daos_pool_list_attr(daos_handle_t poh, char *buffer, size_t *size,
380 daos_event_t *ev);
381
400int
401daos_pool_get_attr(daos_handle_t poh, int n, char const *const names[],
402 void *const buffers[], size_t sizes[], daos_event_t *ev);
403
416int
417daos_pool_set_attr(daos_handle_t poh, int n, char const *const names[],
418 void const *const values[], size_t const sizes[],
419 daos_event_t *ev);
420
439int
440daos_pool_del_attr(daos_handle_t poh, int n, char const *const names[],
441 daos_event_t *ev);
442
460int
461daos_pool_list_cont(daos_handle_t poh, daos_size_t *ncont,
462 struct daos_pool_cont_info *cbuf, daos_event_t *ev);
463
465enum daos_pool_cont_filter_func {
467 PCF_FUNC_EQ = 0,
469 PCF_FUNC_NE,
471 PCF_FUNC_LT,
473 PCF_FUNC_LE,
475 PCF_FUNC_GT,
477 PCF_FUNC_GE,
478 /* future: add more functions */
479 PCF_FUNC_MAX
480};
481
483static inline const char *
484daos_pool_cont_filter_func_str(enum daos_pool_cont_filter_func f)
485{
486 switch(f) {
487 case PCF_FUNC_EQ:
488 return "==";
489 case PCF_FUNC_NE:
490 return "!=";
491 case PCF_FUNC_LT:
492 return "<";
493 case PCF_FUNC_LE:
494 return "<=";
495 case PCF_FUNC_GT:
496 return ">";
497 case PCF_FUNC_GE:
498 return ">=";
499 default:
500 return "UNKNOWN";
501 }
502}
503
505enum daos_pool_cont_filter_key {
507 PCF_KEY_MD_OTIME = 0,
509 PCF_KEY_MD_MTIME,
511 PCF_KEY_NUM_SNAPSHOTS,
513 PCF_KEY_NUM_HANDLES,
514 PCF_KEY_MAX
515};
516
518static inline const char *
519daos_pool_cont_filter_key_str(enum daos_pool_cont_filter_key k)
520{
521 switch(k) {
522 case PCF_KEY_MD_OTIME:
523 return "md_open_time";
524 case PCF_KEY_MD_MTIME:
525 return "md_modify_time";
526 case PCF_KEY_NUM_SNAPSHOTS:
527 return "num_snapshots";
528 case PCF_KEY_NUM_HANDLES:
529 return "num_handles";
530 default:
531 return "UNKNOWN";
532 }
533}
534
536 typedef struct daos_pool_cont_filter_part {
538 uint32_t pcfp_func;
539
541 uint32_t pcfp_key;
542
544 union {
545 uint64_t pcfp_val64;
546 d_string_t pcfp_valstr;
547 };
548} daos_pool_cont_filter_part_t;
549
551enum daos_pool_cont_filter_combine {
553 PCF_COMBINE_LOGICAL_AND = 0,
555 PCF_COMBINE_LOGICAL_OR,
556};
557
559 typedef struct daos_pool_cont_filter {
561 uint32_t pcf_combine_func;
563 uint32_t pcf_nparts;
565 struct daos_pool_cont_filter_part **pcf_parts;
566} daos_pool_cont_filter_t;
567
569#define DAOS_POOL_CONT_FILTER_MAX_NPARTS (8)
570
574int
575daos_pool_cont_filter_init(daos_pool_cont_filter_t *filt, uint32_t combine_func);
576
581int
582daos_pool_cont_filter_add(daos_pool_cont_filter_t *filt, daos_pool_cont_filter_part_t *part);
583
585void
586daos_pool_cont_filter_fini(daos_pool_cont_filter_t *filt);
587
610int
611daos_pool_filter_cont(daos_handle_t poh, daos_pool_cont_filter_t *filter,
612 daos_size_t *ncont, struct daos_pool_cont_info2 *cbuf, daos_event_t *ev);
613
629int
630daos_pool_get_perms(daos_prop_t *pool_prop, uid_t uid, gid_t *gids, size_t nr_gids,
631 uint64_t *perms);
632
633#if defined(__cplusplus)
634}
635#endif
636
637#endif /* __DAOS_POOL_H__ */
daos_cont_info_t
Definition daos_types.h:128
daos_handle_t
Definition daos_types.h:73
daos_pool_cont_filter_part
Definition daos_pool.h:536
daos_pool_cont_filter_part::pcfp_key
uint32_t pcfp_key
Definition daos_pool.h:541
daos_pool_cont_filter_part::pcfp_func
uint32_t pcfp_func
Definition daos_pool.h:538
daos_pool_cont_filter
Definition daos_pool.h:559
daos_pool_cont_filter::pcf_nparts
uint32_t pcf_nparts
Definition daos_pool.h:563
daos_pool_cont_filter::pcf_parts
struct daos_pool_cont_filter_part ** pcf_parts
Definition daos_pool.h:565
daos_pool_cont_filter::pcf_combine_func
uint32_t pcf_combine_func
Definition daos_pool.h:561
daos_pool_cont_info2
Definition daos_pool.h:197
daos_pool_cont_info2::pci_cinfo
daos_cont_info_t pci_cinfo
Definition daos_pool.h:202
daos_pool_cont_info2::pci_reserved
void * pci_reserved[2]
Definition daos_pool.h:205
daos_pool_cont_info2::pci_id
struct daos_pool_cont_info pci_id
Definition daos_pool.h:199
daos_pool_cont_info
Definition daos_pool.h:189
daos_pool_cont_info::pci_label
char pci_label[DAOS_PROP_LABEL_MAX_LEN+1]
Definition daos_pool.h:193
daos_pool_cont_info::pci_uuid
uuid_t pci_uuid
Definition daos_pool.h:191
daos_pool_info_t
Definition daos_pool.h:167
daos_pool_info_t::pi_nnodes
uint32_t pi_nnodes
Definition daos_pool.h:173
daos_pool_info_t::pi_leader
uint32_t pi_leader
Definition daos_pool.h:179
daos_pool_info_t::pi_space
struct daos_pool_space pi_space
Definition daos_pool.h:183
daos_pool_info_t::pi_uuid
uuid_t pi_uuid
Definition daos_pool.h:169
daos_pool_info_t::pi_map_ver
uint32_t pi_map_ver
Definition daos_pool.h:177
daos_pool_info_t::pi_bits
uint64_t pi_bits
Definition daos_pool.h:181
daos_pool_info_t::pi_rebuild_st
struct daos_rebuild_status pi_rebuild_st
Definition daos_pool.h:185
daos_pool_info_t::pi_ndisabled
uint32_t pi_ndisabled
Definition daos_pool.h:175
daos_pool_info_t::pi_ntargets
uint32_t pi_ntargets
Definition daos_pool.h:171
daos_pool_space
Definition daos_pool.h:83
daos_pool_space::ps_space
struct daos_space ps_space
Definition daos_pool.h:85
daos_pool_space::ps_free_max
uint64_t ps_free_max[DAOS_MEDIA_MAX]
Definition daos_pool.h:89
daos_pool_space::ps_padding
uint32_t ps_padding
Definition daos_pool.h:95
daos_pool_space::ps_ntargets
uint32_t ps_ntargets
Definition daos_pool.h:93
daos_pool_space::ps_free_mean
uint64_t ps_free_mean[DAOS_MEDIA_MAX]
Definition daos_pool.h:91
daos_pool_space::ps_free_min
uint64_t ps_free_min[DAOS_MEDIA_MAX]
Definition daos_pool.h:87
daos_prop_t
Definition daos_prop.h:635
daos_rebuild_status
Definition daos_pool.h:105
daos_rebuild_status::rs_seconds
uint32_t rs_seconds
Definition daos_pool.h:109
daos_rebuild_status::rs_toberb_obj_nr
uint64_t rs_toberb_obj_nr
Definition daos_pool.h:130
daos_rebuild_status::rs_size
uint64_t rs_size
Definition daos_pool.h:137
daos_rebuild_status::rs_version
uint32_t rs_version
Definition daos_pool.h:107
daos_rebuild_status::rs_errno
int32_t rs_errno
Definition daos_pool.h:111
daos_rebuild_status::rs_rec_nr
uint64_t rs_rec_nr
Definition daos_pool.h:134
daos_rebuild_status::rs_obj_nr
uint64_t rs_obj_nr
Definition daos_pool.h:132
daos_rebuild_status::rs_padding32
int32_t rs_padding32
Definition daos_pool.h:120
daos_rebuild_status::rs_fail_rank
int32_t rs_fail_rank
Definition daos_pool.h:123
daos_space
Definition daos_pool.h:63
daos_space::s_total
uint64_t s_total[DAOS_MEDIA_MAX]
Definition daos_pool.h:65
daos_space::s_free
uint64_t s_free[DAOS_MEDIA_MAX]
Definition daos_pool.h:67
daos_target_info_t
Definition daos_pool.h:71
daos_target_info_t::ta_type
daos_target_type_t ta_type
Definition daos_pool.h:73
daos_target_info_t::ta_perf
daos_target_perf_t ta_perf
Definition daos_pool.h:77
daos_target_info_t::ta_state
daos_target_state_t ta_state
Definition daos_pool.h:75
daos_target_info_t::ta_space
struct daos_space ta_space
Definition daos_pool.h:79
daos_target_perf_t
Definition daos_pool.h:49
daos_target_perf_t::foo
int foo
Definition daos_pool.h:51