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

| DAOS API (v2.1 - dev)

Loading...
Searching...
No Matches
daos_pool.h
1
10#ifndef __DAOS_POOL_H__
11#define __DAOS_POOL_H__
12
13#define daos_pool_connect daos_pool_connect2
14
15#if defined(__cplusplus)
16extern "C" {
17#endif
18
19#include <inttypes.h>
20#include <uuid/uuid.h>
21
22#include <daos_prop.h>
23
25typedef enum {
26 DAOS_TS_UNKNOWN,
27 /* Not available */
28 DAOS_TS_DOWN_OUT,
29 /* Not available, may need rebuild */
30 DAOS_TS_DOWN,
31 /* Up */
32 DAOS_TS_UP,
33 /* Up and running */
34 DAOS_TS_UP_IN,
35 /* Intermediate state for pool map change */
36 DAOS_TS_NEW,
37 /* Being drained */
38 DAOS_TS_DRAIN,
39} daos_target_state_t;
40
42 typedef struct {
44 int foo;
45} daos_target_perf_t;
46
47
49enum daos_media_type_t {
50 DAOS_MEDIA_SCM = 0,
51 DAOS_MEDIA_NVME,
52 DAOS_MEDIA_MAX
53};
54
56 struct daos_space {
58 uint64_t s_total[DAOS_MEDIA_MAX];
60 uint64_t s_free[DAOS_MEDIA_MAX];
61};
62
64 typedef struct {
66 uint32_t ta_padding;
68 daos_target_state_t ta_state;
70 daos_target_perf_t ta_perf;
72 struct daos_space ta_space;
73} daos_target_info_t;
74
76 struct daos_pool_space {
78 struct daos_space ps_space;
80 uint64_t ps_free_min[DAOS_MEDIA_MAX];
82 uint64_t ps_free_max[DAOS_MEDIA_MAX];
84 uint64_t ps_free_mean[DAOS_MEDIA_MAX];
86 uint32_t ps_ntargets;
88 uint32_t ps_padding;
89};
90
91enum daos_rebuild_state_t {
92 DRS_IN_PROGRESS = 0,
93 DRS_NOT_STARTED = 1,
94 DRS_COMPLETED = 2,
95};
96
98enum daos_rebuild_status_flag {
100 DAOS_RSF_DEGRADED = (1 << 0),
101};
102
104 struct daos_rebuild_status {
106 uint32_t rs_version;
108 uint32_t rs_seconds;
110 int32_t rs_errno;
114 union {
115 int32_t rs_state;
116 int32_t rs_done;
117 };
119 uint16_t rs_max_supported_layout_ver;
121 uint8_t rs_flags;
123 uint8_t rs_reserved_;
124
126 int32_t rs_fail_rank;
133 uint64_t rs_toberb_obj_nr;
135 uint64_t rs_obj_nr;
137 uint64_t rs_rec_nr;
138
140 uint64_t rs_size;
141};
142
154enum daos_pool_info_bit {
156 DPI_SPACE = 1ULL << 0,
158 DPI_REBUILD_STATUS = 1ULL << 1,
160 DPI_ENGINES_ENABLED = 1ULL << 2,
162 DPI_ENGINES_DISABLED = 1ULL << 3,
164 DPI_ENGINES_DEAD = 1ULL << 4,
166 DPI_REBUILD_MAX_LAYOUT_VER = 1ULL << 5,
168 DPI_SELF_HEAL_POLICY = 1ULL << 6,
170 DPI_ALL = -1,
171};
172
176 typedef struct {
178 uuid_t pi_uuid;
180 uint32_t pi_ntargets;
182 uint32_t pi_nnodes;
184 uint32_t pi_ndisabled;
186 uint32_t pi_map_ver;
188 uint32_t pi_leader;
190 uint64_t pi_bits;
192 struct daos_pool_space pi_space;
194 struct daos_rebuild_status pi_rebuild_st;
195} daos_pool_info_t;
196
198 struct daos_pool_cont_info {
200 uuid_t pci_uuid;
202 char pci_label[DAOS_PROP_LABEL_MAX_LEN+1];
203};
204
206 struct daos_pool_cont_info2 {
208 struct daos_pool_cont_info pci_id;
209
211 daos_cont_info_t pci_cinfo;
212
214 void *pci_reserved[2];
215};
216
241int
242daos_pool_connect(const char *pool, const char *sys, unsigned int flags,
243 daos_handle_t *poh, daos_pool_info_t *info, daos_event_t *ev);
244
259int
260daos_pool_disconnect(daos_handle_t poh, daos_event_t *ev);
261
262/*
263 * Handle API
264 */
265
286int
287daos_pool_local2global(daos_handle_t poh, d_iov_t *glob);
288
301int
302daos_pool_global2local(d_iov_t glob, daos_handle_t *poh);
303
342int
343daos_pool_query(daos_handle_t poh, d_rank_list_t **ranks, daos_pool_info_t *info,
344 daos_prop_t *pool_prop, daos_event_t *ev);
345
364int
365daos_pool_query_target(daos_handle_t poh, uint32_t tgt, d_rank_t rank,
366 daos_target_info_t *info, daos_event_t *ev);
367
385int
386daos_pool_list_attr(daos_handle_t poh, char *buffer, size_t *size,
387 daos_event_t *ev);
388
407int
408daos_pool_get_attr(daos_handle_t poh, int n, char const *const names[],
409 void *const buffers[], size_t sizes[], daos_event_t *ev);
410
423int
424daos_pool_set_attr(daos_handle_t poh, int n, char const *const names[],
425 void const *const values[], size_t const sizes[],
426 daos_event_t *ev);
427
446int
447daos_pool_del_attr(daos_handle_t poh, int n, char const *const names[],
448 daos_event_t *ev);
449
467int
468daos_pool_list_cont(daos_handle_t poh, daos_size_t *ncont,
469 struct daos_pool_cont_info *cbuf, daos_event_t *ev);
470
472enum daos_pool_cont_filter_func {
474 PCF_FUNC_EQ = 0,
476 PCF_FUNC_NE,
478 PCF_FUNC_LT,
480 PCF_FUNC_LE,
482 PCF_FUNC_GT,
484 PCF_FUNC_GE,
485 /* future: add more functions */
486 PCF_FUNC_MAX
487};
488
490static inline const char *
491daos_pool_cont_filter_func_str(enum daos_pool_cont_filter_func f)
492{
493 switch(f) {
494 case PCF_FUNC_EQ:
495 return "==";
496 case PCF_FUNC_NE:
497 return "!=";
498 case PCF_FUNC_LT:
499 return "<";
500 case PCF_FUNC_LE:
501 return "<=";
502 case PCF_FUNC_GT:
503 return ">";
504 case PCF_FUNC_GE:
505 return ">=";
506 default:
507 return "UNKNOWN";
508 }
509}
510
512enum daos_pool_cont_filter_key {
514 PCF_KEY_MD_OTIME = 0,
516 PCF_KEY_MD_MTIME,
518 PCF_KEY_NUM_SNAPSHOTS,
520 PCF_KEY_NUM_HANDLES,
521 PCF_KEY_MAX
522};
523
525static inline const char *
526daos_pool_cont_filter_key_str(enum daos_pool_cont_filter_key k)
527{
528 switch(k) {
529 case PCF_KEY_MD_OTIME:
530 return "md_open_time";
531 case PCF_KEY_MD_MTIME:
532 return "md_modify_time";
533 case PCF_KEY_NUM_SNAPSHOTS:
534 return "num_snapshots";
535 case PCF_KEY_NUM_HANDLES:
536 return "num_handles";
537 default:
538 return "UNKNOWN";
539 }
540}
541
543 typedef struct daos_pool_cont_filter_part {
545 uint32_t pcfp_func;
546
548 uint32_t pcfp_key;
549
551 union {
552 uint64_t pcfp_val64;
553 d_string_t pcfp_valstr;
554 };
555} daos_pool_cont_filter_part_t;
556
558enum daos_pool_cont_filter_combine {
560 PCF_COMBINE_LOGICAL_AND = 0,
562 PCF_COMBINE_LOGICAL_OR,
563};
564
566 typedef struct daos_pool_cont_filter {
568 uint32_t pcf_combine_func;
570 uint32_t pcf_nparts;
572 struct daos_pool_cont_filter_part **pcf_parts;
573} daos_pool_cont_filter_t;
574
576#define DAOS_POOL_CONT_FILTER_MAX_NPARTS (8)
577
581int
582daos_pool_cont_filter_init(daos_pool_cont_filter_t *filt, uint32_t combine_func);
583
588int
589daos_pool_cont_filter_add(daos_pool_cont_filter_t *filt, daos_pool_cont_filter_part_t *part);
590
592void
593daos_pool_cont_filter_fini(daos_pool_cont_filter_t *filt);
594
617int
618daos_pool_filter_cont(daos_handle_t poh, daos_pool_cont_filter_t *filter,
619 daos_size_t *ncont, struct daos_pool_cont_info2 *cbuf, daos_event_t *ev);
620
636int
637daos_pool_get_perms(daos_prop_t *pool_prop, uid_t uid, gid_t *gids, size_t nr_gids,
638 uint64_t *perms);
639
640#if defined(__cplusplus)
641}
642#endif
643
644#endif /* __DAOS_POOL_H__ */
daos_cont_info_t
Definition daos_types.h:131
daos_handle_t
Definition daos_types.h:76
daos_pool_cont_filter_part
Definition daos_pool.h:543
daos_pool_cont_filter_part::pcfp_key
uint32_t pcfp_key
Definition daos_pool.h:548
daos_pool_cont_filter_part::pcfp_func
uint32_t pcfp_func
Definition daos_pool.h:545
daos_pool_cont_filter
Definition daos_pool.h:566
daos_pool_cont_filter::pcf_nparts
uint32_t pcf_nparts
Definition daos_pool.h:570
daos_pool_cont_filter::pcf_parts
struct daos_pool_cont_filter_part ** pcf_parts
Definition daos_pool.h:572
daos_pool_cont_filter::pcf_combine_func
uint32_t pcf_combine_func
Definition daos_pool.h:568
daos_pool_cont_info2
Definition daos_pool.h:206
daos_pool_cont_info2::pci_cinfo
daos_cont_info_t pci_cinfo
Definition daos_pool.h:211
daos_pool_cont_info2::pci_reserved
void * pci_reserved[2]
Definition daos_pool.h:214
daos_pool_cont_info2::pci_id
struct daos_pool_cont_info pci_id
Definition daos_pool.h:208
daos_pool_cont_info
Definition daos_pool.h:198
daos_pool_cont_info::pci_label
char pci_label[DAOS_PROP_LABEL_MAX_LEN+1]
Definition daos_pool.h:202
daos_pool_cont_info::pci_uuid
uuid_t pci_uuid
Definition daos_pool.h:200
daos_pool_info_t
Definition daos_pool.h:176
daos_pool_info_t::pi_nnodes
uint32_t pi_nnodes
Definition daos_pool.h:182
daos_pool_info_t::pi_leader
uint32_t pi_leader
Definition daos_pool.h:188
daos_pool_info_t::pi_space
struct daos_pool_space pi_space
Definition daos_pool.h:192
daos_pool_info_t::pi_uuid
uuid_t pi_uuid
Definition daos_pool.h:178
daos_pool_info_t::pi_map_ver
uint32_t pi_map_ver
Definition daos_pool.h:186
daos_pool_info_t::pi_bits
uint64_t pi_bits
Definition daos_pool.h:190
daos_pool_info_t::pi_rebuild_st
struct daos_rebuild_status pi_rebuild_st
Definition daos_pool.h:194
daos_pool_info_t::pi_ndisabled
uint32_t pi_ndisabled
Definition daos_pool.h:184
daos_pool_info_t::pi_ntargets
uint32_t pi_ntargets
Definition daos_pool.h:180
daos_pool_space
Definition daos_pool.h:76
daos_pool_space::ps_space
struct daos_space ps_space
Definition daos_pool.h:78
daos_pool_space::ps_free_max
uint64_t ps_free_max[DAOS_MEDIA_MAX]
Definition daos_pool.h:82
daos_pool_space::ps_padding
uint32_t ps_padding
Definition daos_pool.h:88
daos_pool_space::ps_ntargets
uint32_t ps_ntargets
Definition daos_pool.h:86
daos_pool_space::ps_free_mean
uint64_t ps_free_mean[DAOS_MEDIA_MAX]
Definition daos_pool.h:84
daos_pool_space::ps_free_min
uint64_t ps_free_min[DAOS_MEDIA_MAX]
Definition daos_pool.h:80
daos_prop_t
Definition daos_prop.h:649
daos_rebuild_status
Definition daos_pool.h:104
daos_rebuild_status::rs_seconds
uint32_t rs_seconds
Definition daos_pool.h:108
daos_rebuild_status::rs_reserved_
uint8_t rs_reserved_
Definition daos_pool.h:123
daos_rebuild_status::rs_toberb_obj_nr
uint64_t rs_toberb_obj_nr
Definition daos_pool.h:133
daos_rebuild_status::rs_size
uint64_t rs_size
Definition daos_pool.h:140
daos_rebuild_status::rs_version
uint32_t rs_version
Definition daos_pool.h:106
daos_rebuild_status::rs_errno
int32_t rs_errno
Definition daos_pool.h:110
daos_rebuild_status::rs_flags
uint8_t rs_flags
Definition daos_pool.h:121
daos_rebuild_status::rs_rec_nr
uint64_t rs_rec_nr
Definition daos_pool.h:137
daos_rebuild_status::rs_obj_nr
uint64_t rs_obj_nr
Definition daos_pool.h:135
daos_rebuild_status::rs_max_supported_layout_ver
uint16_t rs_max_supported_layout_ver
Definition daos_pool.h:119
daos_rebuild_status::rs_fail_rank
int32_t rs_fail_rank
Definition daos_pool.h:126
daos_space
Definition daos_pool.h:56
daos_space::s_total
uint64_t s_total[DAOS_MEDIA_MAX]
Definition daos_pool.h:58
daos_space::s_free
uint64_t s_free[DAOS_MEDIA_MAX]
Definition daos_pool.h:60
daos_target_info_t
Definition daos_pool.h:64
daos_target_info_t::ta_perf
daos_target_perf_t ta_perf
Definition daos_pool.h:70
daos_target_info_t::ta_state
daos_target_state_t ta_state
Definition daos_pool.h:68
daos_target_info_t::ta_space
struct daos_space ta_space
Definition daos_pool.h:72
daos_target_info_t::ta_padding
uint32_t ta_padding
Definition daos_pool.h:66
daos_target_perf_t
Definition daos_pool.h:42
daos_target_perf_t::foo
int foo
Definition daos_pool.h:44