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_ENGINES_DEAD = 1ULL << 4,
168 DPI_ALL = -1,
169};
170
174typedef struct {
176 uuid_t pi_uuid;
178 uint32_t pi_ntargets;
180 uint32_t pi_nnodes;
182 uint32_t pi_ndisabled;
184 uint32_t pi_map_ver;
186 uint32_t pi_leader;
188 uint64_t pi_bits;
190 struct daos_pool_space pi_space;
192 struct daos_rebuild_status pi_rebuild_st;
194
198 uuid_t pci_uuid;
200 char pci_label[DAOS_PROP_LABEL_MAX_LEN+1];
201};
202
214
239int
240daos_pool_connect(const char *pool, const char *sys, unsigned int flags,
242
257int
258daos_pool_disconnect(daos_handle_t poh, daos_event_t *ev);
259
260/*
261 * Handle API
262 */
263
284int
285daos_pool_local2global(daos_handle_t poh, d_iov_t *glob);
286
299int
300daos_pool_global2local(d_iov_t glob, daos_handle_t *poh);
301
340int
341daos_pool_query(daos_handle_t poh, d_rank_list_t **ranks, daos_pool_info_t *info,
342 daos_prop_t *pool_prop, daos_event_t *ev);
343
362int
363daos_pool_query_target(daos_handle_t poh, uint32_t tgt, d_rank_t rank,
365
383int
384daos_pool_list_attr(daos_handle_t poh, char *buffer, size_t *size,
385 daos_event_t *ev);
386
405int
406daos_pool_get_attr(daos_handle_t poh, int n, char const *const names[],
407 void *const buffers[], size_t sizes[], daos_event_t *ev);
408
421int
422daos_pool_set_attr(daos_handle_t poh, int n, char const *const names[],
423 void const *const values[], size_t const sizes[],
424 daos_event_t *ev);
425
444int
445daos_pool_del_attr(daos_handle_t poh, int n, char const *const names[],
446 daos_event_t *ev);
447
465int
466daos_pool_list_cont(daos_handle_t poh, daos_size_t *ncont,
467 struct daos_pool_cont_info *cbuf, daos_event_t *ev);
468
470enum daos_pool_cont_filter_func {
472 PCF_FUNC_EQ = 0,
474 PCF_FUNC_NE,
476 PCF_FUNC_LT,
478 PCF_FUNC_LE,
480 PCF_FUNC_GT,
482 PCF_FUNC_GE,
483 /* future: add more functions */
484 PCF_FUNC_MAX
485};
486
488static inline const char *
489daos_pool_cont_filter_func_str(enum daos_pool_cont_filter_func f)
490{
491 switch(f) {
492 case PCF_FUNC_EQ:
493 return "==";
494 case PCF_FUNC_NE:
495 return "!=";
496 case PCF_FUNC_LT:
497 return "<";
498 case PCF_FUNC_LE:
499 return "<=";
500 case PCF_FUNC_GT:
501 return ">";
502 case PCF_FUNC_GE:
503 return ">=";
504 default:
505 return "UNKNOWN";
506 }
507}
508
510enum daos_pool_cont_filter_key {
512 PCF_KEY_MD_OTIME = 0,
514 PCF_KEY_MD_MTIME,
516 PCF_KEY_NUM_SNAPSHOTS,
518 PCF_KEY_NUM_HANDLES,
519 PCF_KEY_MAX
520};
521
523static inline const char *
524daos_pool_cont_filter_key_str(enum daos_pool_cont_filter_key k)
525{
526 switch(k) {
527 case PCF_KEY_MD_OTIME:
528 return "md_open_time";
529 case PCF_KEY_MD_MTIME:
530 return "md_modify_time";
531 case PCF_KEY_NUM_SNAPSHOTS:
532 return "num_snapshots";
533 case PCF_KEY_NUM_HANDLES:
534 return "num_handles";
535 default:
536 return "UNKNOWN";
537 }
538}
539
543 uint32_t pcfp_func;
544
546 uint32_t pcfp_key;
547
549 union {
550 uint64_t pcfp_val64;
551 d_string_t pcfp_valstr;
552 };
554
556enum daos_pool_cont_filter_combine {
558 PCF_COMBINE_LOGICAL_AND = 0,
560 PCF_COMBINE_LOGICAL_OR,
561};
562
572
574#define DAOS_POOL_CONT_FILTER_MAX_NPARTS (8)
575
579int
580daos_pool_cont_filter_init(daos_pool_cont_filter_t *filt, uint32_t combine_func);
581
586int
587daos_pool_cont_filter_add(daos_pool_cont_filter_t *filt, daos_pool_cont_filter_part_t *part);
588
590void
591daos_pool_cont_filter_fini(daos_pool_cont_filter_t *filt);
592
615int
616daos_pool_filter_cont(daos_handle_t poh, daos_pool_cont_filter_t *filter,
617 daos_size_t *ncont, struct daos_pool_cont_info2 *cbuf, daos_event_t *ev);
618
634int
635daos_pool_get_perms(daos_prop_t *pool_prop, uid_t uid, gid_t *gids, size_t nr_gids,
636 uint64_t *perms);
637
638#if defined(__cplusplus)
639}
640#endif
641
642#endif /* __DAOS_POOL_H__ */
struct daos_pool_cont_filter_part ** pcf_parts
Definition daos_pool.h:570
uint32_t pcf_combine_func
Definition daos_pool.h:566
daos_cont_info_t pci_cinfo
Definition daos_pool.h:209
void * pci_reserved[2]
Definition daos_pool.h:212
struct daos_pool_cont_info pci_id
Definition daos_pool.h:206
char pci_label[DAOS_PROP_LABEL_MAX_LEN+1]
Definition daos_pool.h:200
uint32_t pi_nnodes
Definition daos_pool.h:180
uint32_t pi_leader
Definition daos_pool.h:186
uint32_t pi_map_ver
Definition daos_pool.h:184
uint64_t pi_bits
Definition daos_pool.h:188
uint32_t pi_ndisabled
Definition daos_pool.h:182
uint32_t pi_ntargets
Definition daos_pool.h:178
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