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_TP_UNKNOWN,
28 DAOS_TP_HDD,
30 DAOS_TP_SSD,
32 DAOS_TP_PM,
34 DAOS_TP_VM,
35} daos_target_type_t;
36
38typedef enum {
39 DAOS_TS_UNKNOWN,
40 /* Not available */
41 DAOS_TS_DOWN_OUT,
42 /* Not available, may need rebuild */
43 DAOS_TS_DOWN,
44 /* Up */
45 DAOS_TS_UP,
46 /* Up and running */
47 DAOS_TS_UP_IN,
48 /* Intermediate state for pool map change */
49 DAOS_TS_NEW,
50 /* Being drained */
51 DAOS_TS_DRAIN,
52} daos_target_state_t;
53
55 typedef struct {
57 int foo;
58} daos_target_perf_t;
59
60
62enum daos_media_type_t {
63 DAOS_MEDIA_SCM = 0,
64 DAOS_MEDIA_NVME,
65 DAOS_MEDIA_MAX
66};
67
69 struct daos_space {
71 uint64_t s_total[DAOS_MEDIA_MAX];
73 uint64_t s_free[DAOS_MEDIA_MAX];
74};
75
77 typedef struct {
79 daos_target_type_t ta_type;
81 daos_target_state_t ta_state;
83 daos_target_perf_t ta_perf;
85 struct daos_space ta_space;
86} daos_target_info_t;
87
89 struct daos_pool_space {
91 struct daos_space ps_space;
93 uint64_t ps_free_min[DAOS_MEDIA_MAX];
95 uint64_t ps_free_max[DAOS_MEDIA_MAX];
97 uint64_t ps_free_mean[DAOS_MEDIA_MAX];
99 uint32_t ps_ntargets;
101 uint32_t ps_padding;
102};
103
104enum daos_rebuild_state_t {
105 DRS_IN_PROGRESS = 0,
106 DRS_NOT_STARTED = 1,
107 DRS_COMPLETED = 2,
108};
109
111 struct daos_rebuild_status {
113 uint32_t rs_version;
115 uint32_t rs_seconds;
117 int32_t rs_errno;
121 union {
122 int32_t rs_state;
123 int32_t rs_done;
124 };
126 uint16_t rs_max_supported_layout_ver;
128 int16_t rs_padding16;
129
131 int32_t rs_fail_rank;
138 uint64_t rs_toberb_obj_nr;
140 uint64_t rs_obj_nr;
142 uint64_t rs_rec_nr;
143
145 uint64_t rs_size;
146};
147
159enum daos_pool_info_bit {
161 DPI_SPACE = 1ULL << 0,
163 DPI_REBUILD_STATUS = 1ULL << 1,
165 DPI_ENGINES_ENABLED = 1ULL << 2,
167 DPI_ENGINES_DISABLED = 1ULL << 3,
169 DPI_ENGINES_DEAD = 1ULL << 4,
171 DPI_REBUILD_MAX_LAYOUT_VER = 1ULL << 5,
173 DPI_ALL = -1,
174};
175
179 typedef struct {
181 uuid_t pi_uuid;
183 uint32_t pi_ntargets;
185 uint32_t pi_nnodes;
187 uint32_t pi_ndisabled;
189 uint32_t pi_map_ver;
191 uint32_t pi_leader;
193 uint64_t pi_bits;
195 struct daos_pool_space pi_space;
197 struct daos_rebuild_status pi_rebuild_st;
198} daos_pool_info_t;
199
201 struct daos_pool_cont_info {
203 uuid_t pci_uuid;
205 char pci_label[DAOS_PROP_LABEL_MAX_LEN+1];
206};
207
209 struct daos_pool_cont_info2 {
211 struct daos_pool_cont_info pci_id;
212
214 daos_cont_info_t pci_cinfo;
215
217 void *pci_reserved[2];
218};
219
244int
245daos_pool_connect(const char *pool, const char *sys, unsigned int flags,
246 daos_handle_t *poh, daos_pool_info_t *info, daos_event_t *ev);
247
262int
263daos_pool_disconnect(daos_handle_t poh, daos_event_t *ev);
264
265/*
266 * Handle API
267 */
268
289int
290daos_pool_local2global(daos_handle_t poh, d_iov_t *glob);
291
304int
305daos_pool_global2local(d_iov_t glob, daos_handle_t *poh);
306
345int
346daos_pool_query(daos_handle_t poh, d_rank_list_t **ranks, daos_pool_info_t *info,
347 daos_prop_t *pool_prop, daos_event_t *ev);
348
367int
368daos_pool_query_target(daos_handle_t poh, uint32_t tgt, d_rank_t rank,
369 daos_target_info_t *info, daos_event_t *ev);
370
388int
389daos_pool_list_attr(daos_handle_t poh, char *buffer, size_t *size,
390 daos_event_t *ev);
391
410int
411daos_pool_get_attr(daos_handle_t poh, int n, char const *const names[],
412 void *const buffers[], size_t sizes[], daos_event_t *ev);
413
426int
427daos_pool_set_attr(daos_handle_t poh, int n, char const *const names[],
428 void const *const values[], size_t const sizes[],
429 daos_event_t *ev);
430
449int
450daos_pool_del_attr(daos_handle_t poh, int n, char const *const names[],
451 daos_event_t *ev);
452
470int
471daos_pool_list_cont(daos_handle_t poh, daos_size_t *ncont,
472 struct daos_pool_cont_info *cbuf, daos_event_t *ev);
473
475enum daos_pool_cont_filter_func {
477 PCF_FUNC_EQ = 0,
479 PCF_FUNC_NE,
481 PCF_FUNC_LT,
483 PCF_FUNC_LE,
485 PCF_FUNC_GT,
487 PCF_FUNC_GE,
488 /* future: add more functions */
489 PCF_FUNC_MAX
490};
491
493static inline const char *
494daos_pool_cont_filter_func_str(enum daos_pool_cont_filter_func f)
495{
496 switch(f) {
497 case PCF_FUNC_EQ:
498 return "==";
499 case PCF_FUNC_NE:
500 return "!=";
501 case PCF_FUNC_LT:
502 return "<";
503 case PCF_FUNC_LE:
504 return "<=";
505 case PCF_FUNC_GT:
506 return ">";
507 case PCF_FUNC_GE:
508 return ">=";
509 default:
510 return "UNKNOWN";
511 }
512}
513
515enum daos_pool_cont_filter_key {
517 PCF_KEY_MD_OTIME = 0,
519 PCF_KEY_MD_MTIME,
521 PCF_KEY_NUM_SNAPSHOTS,
523 PCF_KEY_NUM_HANDLES,
524 PCF_KEY_MAX
525};
526
528static inline const char *
529daos_pool_cont_filter_key_str(enum daos_pool_cont_filter_key k)
530{
531 switch(k) {
532 case PCF_KEY_MD_OTIME:
533 return "md_open_time";
534 case PCF_KEY_MD_MTIME:
535 return "md_modify_time";
536 case PCF_KEY_NUM_SNAPSHOTS:
537 return "num_snapshots";
538 case PCF_KEY_NUM_HANDLES:
539 return "num_handles";
540 default:
541 return "UNKNOWN";
542 }
543}
544
546 typedef struct daos_pool_cont_filter_part {
548 uint32_t pcfp_func;
549
551 uint32_t pcfp_key;
552
554 union {
555 uint64_t pcfp_val64;
556 d_string_t pcfp_valstr;
557 };
558} daos_pool_cont_filter_part_t;
559
561enum daos_pool_cont_filter_combine {
563 PCF_COMBINE_LOGICAL_AND = 0,
565 PCF_COMBINE_LOGICAL_OR,
566};
567
569 typedef struct daos_pool_cont_filter {
571 uint32_t pcf_combine_func;
573 uint32_t pcf_nparts;
575 struct daos_pool_cont_filter_part **pcf_parts;
576} daos_pool_cont_filter_t;
577
579#define DAOS_POOL_CONT_FILTER_MAX_NPARTS (8)
580
584int
585daos_pool_cont_filter_init(daos_pool_cont_filter_t *filt, uint32_t combine_func);
586
591int
592daos_pool_cont_filter_add(daos_pool_cont_filter_t *filt, daos_pool_cont_filter_part_t *part);
593
595void
596daos_pool_cont_filter_fini(daos_pool_cont_filter_t *filt);
597
620int
621daos_pool_filter_cont(daos_handle_t poh, daos_pool_cont_filter_t *filter,
622 daos_size_t *ncont, struct daos_pool_cont_info2 *cbuf, daos_event_t *ev);
623
639int
640daos_pool_get_perms(daos_prop_t *pool_prop, uid_t uid, gid_t *gids, size_t nr_gids,
641 uint64_t *perms);
642
643#if defined(__cplusplus)
644}
645#endif
646
647#endif /* __DAOS_POOL_H__ */
daos_cont_info_t
Definition daos_types.h:130
daos_handle_t
Definition daos_types.h:75
daos_pool_cont_filter_part
Definition daos_pool.h:546
daos_pool_cont_filter_part::pcfp_key
uint32_t pcfp_key
Definition daos_pool.h:551
daos_pool_cont_filter_part::pcfp_func
uint32_t pcfp_func
Definition daos_pool.h:548
daos_pool_cont_filter
Definition daos_pool.h:569
daos_pool_cont_filter::pcf_nparts
uint32_t pcf_nparts
Definition daos_pool.h:573
daos_pool_cont_filter::pcf_parts
struct daos_pool_cont_filter_part ** pcf_parts
Definition daos_pool.h:575
daos_pool_cont_filter::pcf_combine_func
uint32_t pcf_combine_func
Definition daos_pool.h:571
daos_pool_cont_info2
Definition daos_pool.h:209
daos_pool_cont_info2::pci_cinfo
daos_cont_info_t pci_cinfo
Definition daos_pool.h:214
daos_pool_cont_info2::pci_reserved
void * pci_reserved[2]
Definition daos_pool.h:217
daos_pool_cont_info2::pci_id
struct daos_pool_cont_info pci_id
Definition daos_pool.h:211
daos_pool_cont_info
Definition daos_pool.h:201
daos_pool_cont_info::pci_label
char pci_label[DAOS_PROP_LABEL_MAX_LEN+1]
Definition daos_pool.h:205
daos_pool_cont_info::pci_uuid
uuid_t pci_uuid
Definition daos_pool.h:203
daos_pool_info_t
Definition daos_pool.h:179
daos_pool_info_t::pi_nnodes
uint32_t pi_nnodes
Definition daos_pool.h:185
daos_pool_info_t::pi_leader
uint32_t pi_leader
Definition daos_pool.h:191
daos_pool_info_t::pi_space
struct daos_pool_space pi_space
Definition daos_pool.h:195
daos_pool_info_t::pi_uuid
uuid_t pi_uuid
Definition daos_pool.h:181
daos_pool_info_t::pi_map_ver
uint32_t pi_map_ver
Definition daos_pool.h:189
daos_pool_info_t::pi_bits
uint64_t pi_bits
Definition daos_pool.h:193
daos_pool_info_t::pi_rebuild_st
struct daos_rebuild_status pi_rebuild_st
Definition daos_pool.h:197
daos_pool_info_t::pi_ndisabled
uint32_t pi_ndisabled
Definition daos_pool.h:187
daos_pool_info_t::pi_ntargets
uint32_t pi_ntargets
Definition daos_pool.h:183
daos_pool_space
Definition daos_pool.h:89
daos_pool_space::ps_space
struct daos_space ps_space
Definition daos_pool.h:91
daos_pool_space::ps_free_max
uint64_t ps_free_max[DAOS_MEDIA_MAX]
Definition daos_pool.h:95
daos_pool_space::ps_padding
uint32_t ps_padding
Definition daos_pool.h:101
daos_pool_space::ps_ntargets
uint32_t ps_ntargets
Definition daos_pool.h:99
daos_pool_space::ps_free_mean
uint64_t ps_free_mean[DAOS_MEDIA_MAX]
Definition daos_pool.h:97
daos_pool_space::ps_free_min
uint64_t ps_free_min[DAOS_MEDIA_MAX]
Definition daos_pool.h:93
daos_prop_t
Definition daos_prop.h:646
daos_rebuild_status
Definition daos_pool.h:111
daos_rebuild_status::rs_seconds
uint32_t rs_seconds
Definition daos_pool.h:115
daos_rebuild_status::rs_toberb_obj_nr
uint64_t rs_toberb_obj_nr
Definition daos_pool.h:138
daos_rebuild_status::rs_size
uint64_t rs_size
Definition daos_pool.h:145
daos_rebuild_status::rs_version
uint32_t rs_version
Definition daos_pool.h:113
daos_rebuild_status::rs_errno
int32_t rs_errno
Definition daos_pool.h:117
daos_rebuild_status::rs_rec_nr
uint64_t rs_rec_nr
Definition daos_pool.h:142
daos_rebuild_status::rs_obj_nr
uint64_t rs_obj_nr
Definition daos_pool.h:140
daos_rebuild_status::rs_max_supported_layout_ver
uint16_t rs_max_supported_layout_ver
Definition daos_pool.h:126
daos_rebuild_status::rs_padding16
int16_t rs_padding16
Definition daos_pool.h:128
daos_rebuild_status::rs_fail_rank
int32_t rs_fail_rank
Definition daos_pool.h:131
daos_space
Definition daos_pool.h:69
daos_space::s_total
uint64_t s_total[DAOS_MEDIA_MAX]
Definition daos_pool.h:71
daos_space::s_free
uint64_t s_free[DAOS_MEDIA_MAX]
Definition daos_pool.h:73
daos_target_info_t
Definition daos_pool.h:77
daos_target_info_t::ta_type
daos_target_type_t ta_type
Definition daos_pool.h:79
daos_target_info_t::ta_perf
daos_target_perf_t ta_perf
Definition daos_pool.h:83
daos_target_info_t::ta_state
daos_target_state_t ta_state
Definition daos_pool.h:81
daos_target_info_t::ta_space
struct daos_space ta_space
Definition daos_pool.h:85
daos_target_perf_t
Definition daos_pool.h:55
daos_target_perf_t::foo
int foo
Definition daos_pool.h:57