diff options
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.h')
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.h | 94 |
1 files changed, 40 insertions, 54 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index 9bf19a67528..bf6ac295e26 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -32,38 +32,43 @@ brickid); \ } while (0) +#define GLUSTERD_ASSIGN_BRICKID_TO_TA_BRICKINFO(ta_brickinfo, volinfo, \ + brickid) \ + do { \ + sprintf(ta_brickinfo->brick_id, "%s-ta-%d", volinfo->volname, \ + brickid); \ + } while (0) + #define ALL_VOLUME_OPTION_CHECK(volname, get_opt, key, ret, op_errstr, label) \ do { \ gf_boolean_t _all = !strcmp("all", volname); \ + gf_boolean_t _key_all = !strcmp(key, "all"); \ gf_boolean_t _is_valid_opt = _gf_false; \ int32_t i = 0; \ \ - if (!get_opt && (!strcmp(key, "all") || \ - !strcmp(key, GLUSTERD_MAX_OP_VERSION_KEY))) { \ + if (!get_opt && \ + (_key_all || !strcmp(key, GLUSTERD_MAX_OP_VERSION_KEY))) { \ ret = -1; \ *op_errstr = gf_strdup("Not a valid option to set"); \ goto out; \ } \ - \ - for (i = 0; valid_all_vol_opts[i].option; i++) { \ - if (!strcmp(key, "all") || \ - !strcmp(key, valid_all_vol_opts[i].option)) { \ - _is_valid_opt = _gf_true; \ - break; \ + if (_key_all) { \ + _is_valid_opt = _gf_true; \ + } else { \ + for (i = 0; valid_all_vol_opts[i].option; i++) { \ + if (!strcmp(key, valid_all_vol_opts[i].option)) { \ + _is_valid_opt = _gf_true; \ + break; \ + } \ } \ } \ - \ if (_all && !_is_valid_opt) { \ ret = -1; \ - *op_errstr = gf_strdup( \ - "Not a valid option for all " \ - "volumes"); \ + *op_errstr = gf_strdup("Not a valid option for all volumes"); \ goto label; \ } else if (!_all && _is_valid_opt) { \ ret = -1; \ - *op_errstr = gf_strdup( \ - "Not a valid option for " \ - "single volume"); \ + *op_errstr = gf_strdup("Not a valid option for single volume"); \ goto label; \ } \ } while (0) @@ -145,9 +150,6 @@ glusterd_auth_set_password(glusterd_volinfo_t *volinfo, char *password); void glusterd_auth_cleanup(glusterd_volinfo_t *volinfo); -gf_boolean_t -glusterd_check_volume_exists(char *volname); - int32_t glusterd_brickprocess_new(glusterd_brick_proc_t **brickprocess); @@ -162,6 +164,9 @@ glusterd_brickinfo_new_from_brick(char *brick, glusterd_brickinfo_t **brickinfo, int32_t glusterd_volinfo_find(const char *volname, glusterd_volinfo_t **volinfo); +gf_boolean_t +glusterd_volume_exists(const char *volname); + int glusterd_volinfo_find_by_volume_id(uuid_t volume_id, glusterd_volinfo_t **volinfo); @@ -227,7 +232,8 @@ glusterd_volume_brickinfo_get_by_brick(char *brick, glusterd_volinfo_t *volinfo, gf_boolean_t construct_real_path); int32_t -glusterd_add_volumes_to_export_dict(dict_t **peer_data); +glusterd_add_volumes_to_export_dict(dict_t *peer_data, char **buf, + u_int *length); int32_t glusterd_compare_friend_data(dict_t *peer_data, int32_t *status, @@ -287,17 +293,6 @@ int glusterd_brick_stop(glusterd_volinfo_t *volinfo, glusterd_brickinfo_t *brickinfo, gf_boolean_t del_brick); -gf_boolean_t -glusterd_is_tier_daemon_running(glusterd_volinfo_t *volinfo); - -int32_t -glusterd_add_tierd_to_dict(glusterd_volinfo_t *volinfo, dict_t *dict, - int32_t count); - -int -glusterd_op_tier_status(dict_t *dict, char **op_errstr, dict_t *rsp_dict, - glusterd_op_t op); - int glusterd_is_defrag_on(glusterd_volinfo_t *volinfo); @@ -408,8 +403,10 @@ glusterd_brick_terminate(glusterd_volinfo_t *volinfo, glusterd_brickinfo_t *brickinfo, char *options, int option_cnt, char **op_errstr); +#ifdef BUILD_GNFS int glusterd_nfs_statedump(char *options, int option_cnt, char **op_errstr); +#endif int glusterd_client_statedump(char *volname, char *options, int option_cnt, @@ -444,11 +441,6 @@ glusterd_get_trusted_client_filepath(char *filepath, int glusterd_restart_rebalance(glusterd_conf_t *conf); -int32_t -glusterd_create_sub_tier_volinfo(glusterd_volinfo_t *volinfo, - glusterd_volinfo_t **dup_volinfo, - gf_boolean_t is_hot_tier, - const char *new_name); int glusterd_restart_rebalance_for_volume(glusterd_volinfo_t *volinfo); @@ -509,8 +501,6 @@ glusterd_volume_status_copy_to_op_ctx_dict(dict_t *aggr, dict_t *rsp_dict); int glusterd_volume_rebalance_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict); int -glusterd_volume_tier_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict); -int glusterd_volume_heal_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict); int glusterd_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict); @@ -619,12 +609,6 @@ gf_boolean_t gd_should_i_start_rebalance(glusterd_volinfo_t *volinfo); int -glusterd_is_tierd_enabled(glusterd_volinfo_t *volinfo); - -int -glusterd_is_tierd_supposed_to_be_enabled(glusterd_volinfo_t *volinfo); - -int glusterd_is_volume_quota_enabled(glusterd_volinfo_t *volinfo); int @@ -780,6 +764,10 @@ glusterd_volume_get_type_str(glusterd_volinfo_t *volinfo, char **vol_type_str); int glusterd_volume_get_status_str(glusterd_volinfo_t *volinfo, char *status_str); +void +glusterd_brick_get_status_str(glusterd_brickinfo_t *brickinfo, + char *status_str); + int glusterd_volume_get_transport_type_str(glusterd_volinfo_t *volinfo, char *transport_type_str); @@ -792,21 +780,10 @@ int glusterd_volume_get_rebalance_status_str(glusterd_volinfo_t *volinfo, char *rebal_status_str); -int -glusterd_volume_get_hot_tier_type_str(glusterd_volinfo_t *volinfo, - char **hot_tier_type_str); - -int -glusterd_volume_get_cold_tier_type_str(glusterd_volinfo_t *volinfo, - char **cold_tier_type_str); - void glusterd_list_add_order(struct cds_list_head *new, struct cds_list_head *head, int (*compare)(struct cds_list_head *, struct cds_list_head *)); -int -glusterd_disallow_op_for_tier(glusterd_volinfo_t *volinfo, glusterd_op_t op, - int cmd); struct rpc_clnt * glusterd_defrag_rpc_get(glusterd_defrag_info_t *defrag); @@ -876,4 +853,13 @@ glusterd_is_profile_on(glusterd_volinfo_t *volinfo); char * search_brick_path_from_proc(pid_t brick_pid, char *brickpath); + +int32_t +glusterd_add_shd_to_dict(glusterd_volinfo_t *volinfo, dict_t *dict, + int32_t count); +int32_t +glusterd_check_brick_order(dict_t *dict, char *err_str, int32_t type, + char **volname, char **bricks, int32_t *brick_count, + int32_t sub_count); + #endif |
