DAOS API (v2.0)
Loading...
Searching...
No Matches
daos_pool.h
1
9#ifndef __DAOS_POOL_H__
10#define __DAOS_POOL_H__
11
12#if defined(__cplusplus)
13extern "C" {
14#endif
15
17typedef enum {
18 DAOS_TP_UNKNOWN,
20 DAOS_TP_HDD,
22 DAOS_TP_SSD,
24 DAOS_TP_PM,
26 DAOS_TP_VM,
27} daos_target_type_t;
28
30typedef enum {
31 DAOS_TS_UNKNOWN,
32 /* Not available */
33 DAOS_TS_DOWN_OUT,
34 /* Not available, may need rebuild */
35 DAOS_TS_DOWN,
36 /* Up */
37 DAOS_TS_UP,
38 /* Up and running */
39 DAOS_TS_UP_IN,
40 /* Intermediate state for pool map change */
41 DAOS_TS_NEW,
42 /* Being drained */
43 DAOS_TS_DRAIN,
44} daos_target_state_t;
45
47typedef struct {
49 int foo;
51
52enum {
53 DAOS_MEDIA_SCM = 0,
54 DAOS_MEDIA_NVME,
55 DAOS_MEDIA_MAX
56};
57
59struct daos_space {
60 /* Total space in bytes */
61 uint64_t s_total[DAOS_MEDIA_MAX];
62 /* Free space in bytes */
63 uint64_t s_free[DAOS_MEDIA_MAX];
64};
65
67typedef struct {
68 daos_target_type_t ta_type;
69 daos_target_state_t ta_state;
70 daos_target_perf_t ta_perf;
71 struct daos_space ta_space;
73
76 /* Aggregated space for all live targets */
77 struct daos_space ps_space;
78 /* Min target free space in bytes */
79 uint64_t ps_free_min[DAOS_MEDIA_MAX];
80 /* Max target free space in bytes */
81 uint64_t ps_free_max[DAOS_MEDIA_MAX];
82 /* Average target free space in bytes */
83 uint64_t ps_free_mean[DAOS_MEDIA_MAX];
84 /* Target(VOS) count */
85 uint32_t ps_ntargets;
86 uint32_t ps_padding;
87};
88
91 uint32_t rs_version;
93 uint32_t rs_seconds;
95 int32_t rs_errno;
99 int32_t rs_done;
100
101 /* padding of rebuild status */
102 int32_t rs_padding32;
103
104 /* Failure on which rank */
105 int32_t rs_fail_rank;
113 uint64_t rs_obj_nr;
115 uint64_t rs_rec_nr;
116
118 uint64_t rs_size;
119};
120
127enum daos_pool_info_bit {
129 DPI_SPACE = 1ULL << 0,
131 DPI_REBUILD_STATUS = 1ULL << 1,
133 DPI_ALL = -1,
134};
135
139typedef struct {
141 uuid_t pi_uuid;
143 uint32_t pi_ntargets;
145 uint32_t pi_nnodes;
147 uint32_t pi_ndisabled;
149 uint32_t pi_map_ver;
151 uint32_t pi_leader;
153 uint64_t pi_bits;
155 struct daos_pool_space pi_space;
157 struct daos_rebuild_status pi_rebuild_st;
159
162 uuid_t pci_uuid;
163 char pci_label[DAOS_PROP_LABEL_MAX_LEN+1];
164};
165
166#define DAOS_SYS_NAME_MAX_LEN 127
167
192int
193daos_pool_connect(const char *pool, const char *sys, unsigned int flags,
195
210int
211daos_pool_disconnect(daos_handle_t poh, daos_event_t *ev);
212
213/*
214 * Handle API
215 */
216
237int
238daos_pool_local2global(daos_handle_t poh, d_iov_t *glob);
239
252int
253daos_pool_global2local(d_iov_t glob, daos_handle_t *poh);
254
288int
289daos_pool_query(daos_handle_t poh, d_rank_list_t *tgts, daos_pool_info_t *info,
290 daos_prop_t *pool_prop, daos_event_t *ev);
291
310int
311daos_pool_query_target(daos_handle_t poh, uint32_t tgt, d_rank_t rank,
313
331int
332daos_pool_list_attr(daos_handle_t poh, char *buffer, size_t *size,
333 daos_event_t *ev);
334
353int
354daos_pool_get_attr(daos_handle_t poh, int n, char const *const names[],
355 void *const buffers[], size_t sizes[], daos_event_t *ev);
356
369int
370daos_pool_set_attr(daos_handle_t poh, int n, char const *const names[],
371 void const *const values[], size_t const sizes[],
372 daos_event_t *ev);
373
392int
393daos_pool_del_attr(daos_handle_t poh, int n, char const *const names[],
394 daos_event_t *ev);
395
413int
414daos_pool_list_cont(daos_handle_t poh, daos_size_t *ncont,
415 struct daos_pool_cont_info *cbuf, daos_event_t *ev);
416
421int
422daos_pool_connect2(const char *pool, const char *sys, unsigned int flags,
424
425
426#if defined(__cplusplus)
427}
428#define daos_pool_connect daos_pool_connect_cpp
429static inline int
430daos_pool_connect_cpp(const char *pool, const char *sys, unsigned int flags, daos_handle_t *poh,
432{
433 return daos_pool_connect2(pool, sys, flags, poh, info, ev);
434}
435
436static inline int
437daos_pool_connect_cpp(const uuid_t pool, const char *sys, unsigned int flags, daos_handle_t *poh,
439{
440 char str[37];
441
442 uuid_unparse(pool, str);
443 return daos_pool_connect2(str, sys, flags, poh, info, ev);
444}
445#else
450#define daos_pool_connect(po, ...) \
451 ({ \
452 int _ret; \
453 char _str[37]; \
454 const char *__str = NULL; \
455 if (d_is_string(po)) { \
456 __str = (const char *)(po); \
457 } else if (d_is_uuid(po)) { \
458 uuid_unparse((unsigned char *)(po), _str); \
459 __str = _str; \
460 } \
461 _ret = daos_pool_connect2(__str, __VA_ARGS__); \
462 _ret; \
463 })
464#endif
465
466#endif /* __DAOS_POOL_H__ */
uint32_t pi_nnodes
Definition daos_pool.h:145
uint32_t pi_leader
Definition daos_pool.h:151
uint32_t pi_map_ver
Definition daos_pool.h:149
uint64_t pi_bits
Definition daos_pool.h:153
uint32_t pi_ndisabled
Definition daos_pool.h:147
uint32_t pi_ntargets
Definition daos_pool.h:143
uint32_t rs_seconds
Definition daos_pool.h:93
uint64_t rs_toberb_obj_nr
Definition daos_pool.h:111
uint32_t rs_version
Definition daos_pool.h:91