diff options
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-store.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-store.c | 211 |
1 files changed, 1 insertions, 210 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index b573b6610fb..038355dcf32 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -845,62 +845,6 @@ out: return ret; } -int32_t -glusterd_volume_write_tier_details(int fd, glusterd_volinfo_t *volinfo) -{ - int32_t ret = -1; - char buf[PATH_MAX] = ""; - - if (volinfo->type != GF_CLUSTER_TYPE_TIER) { - ret = 0; - goto out; - } - - snprintf(buf, sizeof(buf), "%d", volinfo->tier_info.cold_brick_count); - ret = gf_store_save_value(fd, GLUSTERD_STORE_KEY_COLD_COUNT, buf); - if (ret) - goto out; - - snprintf(buf, sizeof(buf), "%d", volinfo->tier_info.cold_replica_count); - ret = gf_store_save_value(fd, GLUSTERD_STORE_KEY_COLD_REPLICA_COUNT, buf); - if (ret) - goto out; - - snprintf(buf, sizeof(buf), "%d", volinfo->tier_info.cold_disperse_count); - ret = gf_store_save_value(fd, GLUSTERD_STORE_KEY_COLD_DISPERSE_COUNT, buf); - if (ret) - goto out; - - snprintf(buf, sizeof(buf), "%d", volinfo->tier_info.cold_redundancy_count); - ret = gf_store_save_value(fd, GLUSTERD_STORE_KEY_COLD_REDUNDANCY_COUNT, - buf); - if (ret) - goto out; - - snprintf(buf, sizeof(buf), "%d", volinfo->tier_info.hot_brick_count); - ret = gf_store_save_value(fd, GLUSTERD_STORE_KEY_HOT_COUNT, buf); - if (ret) - goto out; - - snprintf(buf, sizeof(buf), "%d", volinfo->tier_info.hot_replica_count); - ret = gf_store_save_value(fd, GLUSTERD_STORE_KEY_HOT_REPLICA_COUNT, buf); - if (ret) - goto out; - - snprintf(buf, sizeof(buf), "%d", volinfo->tier_info.hot_type); - ret = gf_store_save_value(fd, GLUSTERD_STORE_KEY_HOT_TYPE, buf); - if (ret) - goto out; - - snprintf(buf, sizeof(buf), "%d", volinfo->tier_info.cold_type); - ret = gf_store_save_value(fd, GLUSTERD_STORE_KEY_COLD_TYPE, buf); - if (ret) - goto out; - -out: - return ret; -} - static int32_t glusterd_volume_exclude_options_write(int fd, glusterd_volinfo_t *volinfo) { @@ -1017,23 +961,11 @@ glusterd_volume_exclude_options_write(int fd, glusterd_volinfo_t *volinfo) } total_len += ret; } - if (conf->op_version >= GD_OP_VERSION_3_10_0) { - ret = snprintf(buf + total_len, sizeof(buf) - total_len, "%s=%d\n", - GF_TIER_ENABLED, volinfo->is_tier_enabled); - if (ret < 0 || ret >= sizeof(buf) - total_len) { - ret = -1; - goto out; - } - } ret = gf_store_save_items(fd, buf); if (ret) goto out; - ret = glusterd_volume_write_tier_details(fd, volinfo); - if (ret) - goto out; - ret = glusterd_volume_write_snap_details(fd, volinfo); out: @@ -1387,83 +1319,6 @@ _gd_store_rebalance_dict(dict_t *dict, char *key, data_t *value, void *data) } int32_t -glusterd_store_state_tier_write(int fd, glusterd_volinfo_t *volinfo) -{ - int ret = -1; - char buf[PATH_MAX] = { - 0, - }; - - GF_VALIDATE_OR_GOTO(THIS->name, (fd > 0), out); - GF_VALIDATE_OR_GOTO(THIS->name, volinfo, out); - - /*tier counter values are stored here. so that after restart - * of glusterd tier resumes at the state is was brought down - */ - - if (volinfo->tier.defrag_cmd == GF_DEFRAG_CMD_STATUS) { - ret = 0; - goto out; - } - - snprintf(buf, sizeof(buf), "%d", volinfo->tier.defrag_status); - ret = gf_store_save_value(fd, GLUSTERD_STORE_KEY_VOL_TIER_STATUS, buf); - if (ret) - goto out; - - snprintf(buf, sizeof(buf), "%d", volinfo->tier.op); - ret = gf_store_save_value(fd, GLUSTERD_STORE_KEY_TIER_DETACH_OP, buf); - if (ret) - goto out; - - snprintf(buf, sizeof(buf), "%" PRIu64, volinfo->tier.rebalance_files); - ret = gf_store_save_value(fd, GLUSTERD_STORE_KEY_VOL_MIGRATED_FILES, buf); - if (ret) - goto out; - - snprintf(buf, sizeof(buf), "%" PRIu64, volinfo->tier.rebalance_data); - ret = gf_store_save_value(fd, GLUSTERD_STORE_KEY_VOL_MIGRATED_SIZE, buf); - if (ret) - goto out; - - snprintf(buf, sizeof(buf), "%" PRIu64, volinfo->tier.lookedup_files); - ret = gf_store_save_value(fd, GLUSTERD_STORE_KEY_VOL_MIGRATIONS_SCANNED, - buf); - if (ret) - goto out; - - snprintf(buf, sizeof(buf), "%" PRIu64, volinfo->tier.rebalance_failures); - ret = gf_store_save_value(fd, GLUSTERD_STORE_KEY_VOL_MIGRATIONS_FAILURES, - buf); - if (ret) - goto out; - - snprintf(buf, sizeof(buf), "%" PRIu64, volinfo->tier.skipped_files); - ret = gf_store_save_value(fd, GLUSTERD_STORE_KEY_VOL_MIGRATIONS_SKIPPED, - buf); - if (ret) - goto out; - - snprintf(buf, sizeof(buf), "%f", volinfo->tier.rebalance_time); - ret = gf_store_save_value(fd, GLUSTERD_STORE_KEY_VOL_MIGRATION_RUN_TIME, - buf); - if (ret) - goto out; - - gf_uuid_unparse(volinfo->tier.rebalance_id, buf); - ret = gf_store_save_value(fd, GF_TIER_TID_KEY, buf); - if (ret) - goto out; - - if (volinfo->tier.dict) { - dict_foreach(volinfo->tier.dict, _gd_store_rebalance_dict, &fd); - } -out: - gf_msg_debug(THIS->name, 0, "Returning %d", ret); - return ret; -} - -static int32_t glusterd_store_node_state_write(int fd, glusterd_volinfo_t *volinfo) { int ret = -1; @@ -1537,12 +1392,6 @@ glusterd_store_perform_node_state_store(glusterd_volinfo_t *volinfo) if (ret) goto out; - if (volinfo->type == GF_CLUSTER_TYPE_TIER) { - ret = glusterd_store_state_tier_write(fd, volinfo); - if (ret) - goto out; - } - ret = gf_store_rename_tmppath(volinfo->node_state_shandle); if (ret) goto out; @@ -2972,36 +2821,6 @@ glusterd_store_retrieve_node_state(glusterd_volinfo_t *volinfo) } else if (!strncmp(key, GLUSTERD_STORE_KEY_VOL_DEFRAG_RUN_TIME, SLEN(GLUSTERD_STORE_KEY_VOL_DEFRAG_RUN_TIME))) { volinfo->rebal.rebalance_time = atoi(value); - - /* if none of the above keys match then its related to tier - * so we get the values and store it on volinfo->tier - */ - } else if (!strncmp(key, GLUSTERD_STORE_KEY_VOL_TIER_STATUS, - SLEN(GLUSTERD_STORE_KEY_VOL_TIER_STATUS))) { - volinfo->tier.defrag_status = atoi(value); - } else if (!strncmp(key, GF_TIER_TID_KEY, SLEN(GF_TIER_TID_KEY))) { - gf_uuid_parse(value, volinfo->tier.rebalance_id); - } else if (!strncmp(key, GLUSTERD_STORE_KEY_TIER_DETACH_OP, - SLEN(GLUSTERD_STORE_KEY_TIER_DETACH_OP))) { - volinfo->tier.op = atoi(value); - } else if (!strncmp(key, GLUSTERD_STORE_KEY_VOL_MIGRATED_FILES, - SLEN(GLUSTERD_STORE_KEY_VOL_MIGRATED_FILES))) { - volinfo->tier.rebalance_files = atoi(value); - } else if (!strncmp(key, GLUSTERD_STORE_KEY_VOL_MIGRATED_SIZE, - SLEN(GLUSTERD_STORE_KEY_VOL_MIGRATED_SIZE))) { - volinfo->tier.rebalance_data = atoi(value); - } else if (!strncmp(key, GLUSTERD_STORE_KEY_VOL_MIGRATIONS_SCANNED, - SLEN(GLUSTERD_STORE_KEY_VOL_MIGRATIONS_SCANNED))) { - volinfo->tier.lookedup_files = atoi(value); - } else if (!strncmp(key, GLUSTERD_STORE_KEY_VOL_MIGRATIONS_FAILURES, - SLEN(GLUSTERD_STORE_KEY_VOL_MIGRATIONS_FAILURES))) { - volinfo->tier.rebalance_failures = atoi(value); - } else if (!strncmp(key, GLUSTERD_STORE_KEY_VOL_MIGRATIONS_SKIPPED, - SLEN(GLUSTERD_STORE_KEY_VOL_MIGRATIONS_SKIPPED))) { - volinfo->tier.skipped_files = atoi(value); - } else if (!strncmp(key, GLUSTERD_STORE_KEY_VOL_MIGRATION_RUN_TIME, - SLEN(GLUSTERD_STORE_KEY_VOL_MIGRATION_RUN_TIME))) { - volinfo->tier.rebalance_time = atoi(value); } else { if (!tmp_dict) { tmp_dict = dict_new(); @@ -3035,10 +2854,7 @@ glusterd_store_retrieve_node_state(glusterd_volinfo_t *volinfo) ret = gf_store_iter_get_next(iter, &key, &value, &op_errno); } if (tmp_dict) { - if (volinfo->type == GF_CLUSTER_TYPE_TIER) - volinfo->tier.dict = dict_ref(tmp_dict); - else - volinfo->rebal.dict = dict_ref(tmp_dict); + volinfo->rebal.dict = dict_ref(tmp_dict); } if (op_errno != GD_STORE_EOF) { @@ -3060,8 +2876,6 @@ out: if (ret) { if (volinfo->rebal.dict) dict_unref(volinfo->rebal.dict); - else if (volinfo->tier.dict) - dict_unref(volinfo->tier.dict); } if (tmp_dict) dict_unref(tmp_dict); @@ -3220,28 +3034,6 @@ glusterd_store_update_volinfo(glusterd_volinfo_t *volinfo) "parent_volname truncated: %s", volinfo->parent_volname); goto out; } - } else if (!strncmp(key, GF_TIER_ENABLED, SLEN(GF_TIER_ENABLED))) { - volinfo->is_tier_enabled = atoi(value); - } else if (!strncmp(key, GLUSTERD_STORE_KEY_COLD_COUNT, strlen(key))) { - volinfo->tier_info.cold_brick_count = atoi(value); - } else if (!strncmp(key, GLUSTERD_STORE_KEY_COLD_REPLICA_COUNT, - strlen(key))) { - volinfo->tier_info.cold_replica_count = atoi(value); - } else if (!strncmp(key, GLUSTERD_STORE_KEY_COLD_DISPERSE_COUNT, - strlen(key))) { - volinfo->tier_info.cold_disperse_count = atoi(value); - } else if (!strncmp(key, GLUSTERD_STORE_KEY_COLD_REDUNDANCY_COUNT, - strlen(key))) { - volinfo->tier_info.cold_redundancy_count = atoi(value); - } else if (!strncmp(key, GLUSTERD_STORE_KEY_HOT_COUNT, strlen(key))) { - volinfo->tier_info.hot_brick_count = atoi(value); - } else if (!strncmp(key, GLUSTERD_STORE_KEY_HOT_REPLICA_COUNT, - strlen(key))) { - volinfo->tier_info.hot_replica_count = atoi(value); - } else if (!strncmp(key, GLUSTERD_STORE_KEY_HOT_TYPE, strlen(key))) { - volinfo->tier_info.hot_type = atoi(value); - } else if (!strncmp(key, GLUSTERD_STORE_KEY_COLD_TYPE, strlen(key))) { - volinfo->tier_info.cold_type = atoi(value); } else if (!strncmp(key, GLUSTERD_STORE_KEY_VOL_QUOTA_VERSION, SLEN(GLUSTERD_STORE_KEY_VOL_QUOTA_VERSION))) { volinfo->quota_xattr_version = atoi(value); @@ -3317,7 +3109,6 @@ glusterd_store_update_volinfo(glusterd_volinfo_t *volinfo) GF_ASSERT(volinfo->redundancy_count > 0); break; - case GF_CLUSTER_TYPE_TIER: case GF_CLUSTER_TYPE_STRIPE: case GF_CLUSTER_TYPE_STRIPE_REPLICATE: gf_msg(this->name, GF_LOG_CRITICAL, ENOTSUP, |