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
49typedef struct {
51 int foo;
53
54
56enum daos_media_type_t {
57 DAOS_MEDIA_SCM = 0,
58 DAOS_MEDIA_NVME,
59 DAOS_MEDIA_MAX
60};
61
63struct daos_space {
65 uint64_t s_total[DAOS_MEDIA_MAX];
67 uint64_t s_free[DAOS_MEDIA_MAX];
68};
69
71typedef struct {
73 daos_target_type_t ta_type;
75 daos_target_state_t ta_state;
79 struct daos_space ta_space;
81
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
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 };
121
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
167typedef 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;
187
191 uuid_t pci_uuid;
193 char pci_label[DAOS_PROP_LABEL_MAX_LEN+1];
194};
195
207
208#define DAOS_SYS_NAME_MAX_LEN 127
209
234int
235daos_pool_connect(const char *pool, const char *sys, unsigned int flags,
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,
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
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 };
549
551enum daos_pool_cont_filter_combine {
553 PCF_COMBINE_LOGICAL_AND = 0,
555 PCF_COMBINE_LOGICAL_OR,
556};
557
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__ */
struct daos_pool_cont_filter_part ** pcf_parts
Definition daos_pool.h:565
uint32_t pcf_combine_func
Definition daos_pool.h:561
daos_cont_info_t pci_cinfo
Definition daos_pool.h:202
void * pci_reserved[2]
Definition daos_pool.h:205
struct daos_pool_cont_info pci_id
Definition daos_pool.h:199
char pci_label[DAOS_PROP_LABEL_MAX_LEN+1]
Definition daos_pool.h:193
uint32_t pi_nnodes
Definition daos_pool.h:173
uint32_t pi_leader
Definition daos_pool.h:179
uint32_t pi_map_ver
Definition daos_pool.h:177
uint64_t pi_bits
Definition daos_pool.h:181
uint32_t pi_ndisabled
Definition daos_pool.h:175
uint32_t pi_ntargets
Definition daos_pool.h:171
struct daos_space ps_space
Definition daos_pool.h:85
uint64_t ps_free_max[DAOS_MEDIA_MAX]
Definition daos_pool.h:89
uint32_t ps_padding
Definition daos_pool.h:95
uint32_t ps_ntargets
Definition daos_pool.h:93
uint64_t ps_free_mean[DAOS_MEDIA_MAX]
Definition daos_pool.h:91
uint64_t ps_free_min[DAOS_MEDIA_MAX]
Definition daos_pool.h:87
uint64_t rs_toberb_obj_nr
Definition daos_pool.h:130
uint64_t s_total[DAOS_MEDIA_MAX]
Definition daos_pool.h:65
uint64_t s_free[DAOS_MEDIA_MAX]
Definition daos_pool.h:67
daos_target_type_t ta_type
Definition daos_pool.h:73
daos_target_perf_t ta_perf
Definition daos_pool.h:77
daos_target_state_t ta_state
Definition daos_pool.h:75