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
18#include <inttypes.h>
19#include <uuid/uuid.h>
20
21#include <daos_prop.h>
22
24typedef enum {
25 DAOS_TP_UNKNOWN,
27 DAOS_TP_HDD,
29 DAOS_TP_SSD,
31 DAOS_TP_PM,
33 DAOS_TP_VM,
34} daos_target_type_t;
35
37typedef enum {
38 DAOS_TS_UNKNOWN,
39 /* Not available */
40 DAOS_TS_DOWN_OUT,
41 /* Not available, may need rebuild */
42 DAOS_TS_DOWN,
43 /* Up */
44 DAOS_TS_UP,
45 /* Up and running */
46 DAOS_TS_UP_IN,
47 /* Intermediate state for pool map change */
48 DAOS_TS_NEW,
49 /* Being drained */
50 DAOS_TS_DRAIN,
51} daos_target_state_t;
52
54typedef struct {
56 int foo;
58
59
61enum daos_media_type_t {
62 DAOS_MEDIA_SCM = 0,
63 DAOS_MEDIA_NVME,
64 DAOS_MEDIA_MAX
65};
66
68struct daos_space {
70 uint64_t s_total[DAOS_MEDIA_MAX];
72 uint64_t s_free[DAOS_MEDIA_MAX];
73};
74
76typedef struct {
78 daos_target_type_t ta_type;
80 daos_target_state_t ta_state;
84 struct daos_space ta_space;
86
92 uint64_t ps_free_min[DAOS_MEDIA_MAX];
94 uint64_t ps_free_max[DAOS_MEDIA_MAX];
96 uint64_t ps_free_mean[DAOS_MEDIA_MAX];
98 uint32_t ps_ntargets;
100 uint32_t ps_padding;
101};
102
103enum daos_rebuild_state_t {
104 DRS_IN_PROGRESS = 0,
105 DRS_NOT_STARTED = 1,
106 DRS_COMPLETED = 2,
107};
108
112 uint32_t rs_version;
114 uint32_t rs_seconds;
116 int32_t rs_errno;
120 union {
121 int32_t rs_state;
122 int32_t rs_done;
123 };
126
137 uint64_t rs_obj_nr;
139 uint64_t rs_rec_nr;
140
142 uint64_t rs_size;
143};
144
156enum daos_pool_info_bit {
158 DPI_SPACE = 1ULL << 0,
160 DPI_REBUILD_STATUS = 1ULL << 1,
162 DPI_ENGINES_ENABLED = 1ULL << 2,
164 DPI_ENGINES_DISABLED = 1ULL << 3,
166 DPI_ALL = -1,
167};
168
172typedef struct {
174 uuid_t pi_uuid;
176 uint32_t pi_ntargets;
178 uint32_t pi_nnodes;
180 uint32_t pi_ndisabled;
182 uint32_t pi_map_ver;
184 uint32_t pi_leader;
186 uint64_t pi_bits;
188 struct daos_pool_space pi_space;
190 struct daos_rebuild_status pi_rebuild_st;
192
196 uuid_t pci_uuid;
198 char pci_label[DAOS_PROP_LABEL_MAX_LEN+1];
199};
200
212
237int
238daos_pool_connect(const char *pool, const char *sys, unsigned int flags,
240
255int
256daos_pool_disconnect(daos_handle_t poh, daos_event_t *ev);
257
258/*
259 * Handle API
260 */
261
282int
283daos_pool_local2global(daos_handle_t poh, d_iov_t *glob);
284
297int
298daos_pool_global2local(d_iov_t glob, daos_handle_t *poh);
299
338int
339daos_pool_query(daos_handle_t poh, d_rank_list_t **ranks, daos_pool_info_t *info,
340 daos_prop_t *pool_prop, daos_event_t *ev);
341
360int
361daos_pool_query_target(daos_handle_t poh, uint32_t tgt, d_rank_t rank,
363
381int
382daos_pool_list_attr(daos_handle_t poh, char *buffer, size_t *size,
383 daos_event_t *ev);
384
403int
404daos_pool_get_attr(daos_handle_t poh, int n, char const *const names[],
405 void *const buffers[], size_t sizes[], daos_event_t *ev);
406
419int
420daos_pool_set_attr(daos_handle_t poh, int n, char const *const names[],
421 void const *const values[], size_t const sizes[],
422 daos_event_t *ev);
423
442int
443daos_pool_del_attr(daos_handle_t poh, int n, char const *const names[],
444 daos_event_t *ev);
445
463int
464daos_pool_list_cont(daos_handle_t poh, daos_size_t *ncont,
465 struct daos_pool_cont_info *cbuf, daos_event_t *ev);
466
468enum daos_pool_cont_filter_func {
470 PCF_FUNC_EQ = 0,
472 PCF_FUNC_NE,
474 PCF_FUNC_LT,
476 PCF_FUNC_LE,
478 PCF_FUNC_GT,
480 PCF_FUNC_GE,
481 /* future: add more functions */
482 PCF_FUNC_MAX
483};
484
486static inline const char *
487daos_pool_cont_filter_func_str(enum daos_pool_cont_filter_func f)
488{
489 switch(f) {
490 case PCF_FUNC_EQ:
491 return "==";
492 case PCF_FUNC_NE:
493 return "!=";
494 case PCF_FUNC_LT:
495 return "<";
496 case PCF_FUNC_LE:
497 return "<=";
498 case PCF_FUNC_GT:
499 return ">";
500 case PCF_FUNC_GE:
501 return ">=";
502 default:
503 return "UNKNOWN";
504 }
505}
506
508enum daos_pool_cont_filter_key {
510 PCF_KEY_MD_OTIME = 0,
512 PCF_KEY_MD_MTIME,
514 PCF_KEY_NUM_SNAPSHOTS,
516 PCF_KEY_NUM_HANDLES,
517 PCF_KEY_MAX
518};
519
521static inline const char *
522daos_pool_cont_filter_key_str(enum daos_pool_cont_filter_key k)
523{
524 switch(k) {
525 case PCF_KEY_MD_OTIME:
526 return "md_open_time";
527 case PCF_KEY_MD_MTIME:
528 return "md_modify_time";
529 case PCF_KEY_NUM_SNAPSHOTS:
530 return "num_snapshots";
531 case PCF_KEY_NUM_HANDLES:
532 return "num_handles";
533 default:
534 return "UNKNOWN";
535 }
536}
537
541 uint32_t pcfp_func;
542
544 uint32_t pcfp_key;
545
547 union {
548 uint64_t pcfp_val64;
549 d_string_t pcfp_valstr;
550 };
552
554enum daos_pool_cont_filter_combine {
556 PCF_COMBINE_LOGICAL_AND = 0,
558 PCF_COMBINE_LOGICAL_OR,
559};
560
570
572#define DAOS_POOL_CONT_FILTER_MAX_NPARTS (8)
573
577int
578daos_pool_cont_filter_init(daos_pool_cont_filter_t *filt, uint32_t combine_func);
579
584int
585daos_pool_cont_filter_add(daos_pool_cont_filter_t *filt, daos_pool_cont_filter_part_t *part);
586
588void
589daos_pool_cont_filter_fini(daos_pool_cont_filter_t *filt);
590
613int
614daos_pool_filter_cont(daos_handle_t poh, daos_pool_cont_filter_t *filter,
615 daos_size_t *ncont, struct daos_pool_cont_info2 *cbuf, daos_event_t *ev);
616
632int
633daos_pool_get_perms(daos_prop_t *pool_prop, uid_t uid, gid_t *gids, size_t nr_gids,
634 uint64_t *perms);
635
636#if defined(__cplusplus)
637}
638#endif
639
640#endif /* __DAOS_POOL_H__ */
struct daos_pool_cont_filter_part ** pcf_parts
Definition daos_pool.h:568
uint32_t pcf_combine_func
Definition daos_pool.h:564
daos_cont_info_t pci_cinfo
Definition daos_pool.h:207
void * pci_reserved[2]
Definition daos_pool.h:210
struct daos_pool_cont_info pci_id
Definition daos_pool.h:204
char pci_label[DAOS_PROP_LABEL_MAX_LEN+1]
Definition daos_pool.h:198
uint32_t pi_nnodes
Definition daos_pool.h:178
uint32_t pi_leader
Definition daos_pool.h:184
uint32_t pi_map_ver
Definition daos_pool.h:182
uint64_t pi_bits
Definition daos_pool.h:186
uint32_t pi_ndisabled
Definition daos_pool.h:180
uint32_t pi_ntargets
Definition daos_pool.h:176
struct daos_space ps_space
Definition daos_pool.h:90
uint64_t ps_free_max[DAOS_MEDIA_MAX]
Definition daos_pool.h:94
uint32_t ps_padding
Definition daos_pool.h:100
uint32_t ps_ntargets
Definition daos_pool.h:98
uint64_t ps_free_mean[DAOS_MEDIA_MAX]
Definition daos_pool.h:96
uint64_t ps_free_min[DAOS_MEDIA_MAX]
Definition daos_pool.h:92
uint64_t rs_toberb_obj_nr
Definition daos_pool.h:135
uint64_t s_total[DAOS_MEDIA_MAX]
Definition daos_pool.h:70
uint64_t s_free[DAOS_MEDIA_MAX]
Definition daos_pool.h:72
daos_target_type_t ta_type
Definition daos_pool.h:78
daos_target_perf_t ta_perf
Definition daos_pool.h:82
daos_target_state_t ta_state
Definition daos_pool.h:80