diff options
author | Kaushal M <kaushal@redhat.com> | 2013-07-24 18:34:38 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-08-02 02:28:46 -0700 |
commit | 3af61d6758bc41e7c461d9d54f0caf872870329c (patch) | |
tree | cad20969f32590404caad71fc6a31fefb8ac5244 /xlators/mgmt/glusterd | |
parent | 36b102645ab66d141dcc831e67caa78966d45419 (diff) |
glusterd: Use volume op-versions during volgen
Instead of using the cluster op-version, volume op-version is used to
enable open-behind during volgen. For doing this, the volume op-versions
are updated before regenerating the volfiles.
Change-Id: I675bb549bf7c7c0279030dca698fb530781addc6
BUG: 990830
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/5385
Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 9 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 4 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 17 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 3 |
4 files changed, 14 insertions, 19 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 1774b133b93..ca31bf0dcc7 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -1160,8 +1160,9 @@ glusterd_options_reset (glusterd_volinfo_t *volinfo, char *key, _delete_reconfig_opt (volinfo->dict, key, value, is_force); } - ret = glusterd_create_volfiles_and_notify_services (volinfo); + gd_update_volume_op_versions (volinfo); + ret = glusterd_create_volfiles_and_notify_services (volinfo); if (ret) { gf_log (this->name, GF_LOG_ERROR, "Unable to create volfile for" " 'volume reset'"); @@ -1337,8 +1338,6 @@ glusterd_op_reset_volume (dict_t *dict, char **op_errstr) key); } - gd_update_volume_op_versions (volinfo); - out: GF_FREE (key_fixed); if (quorum_action) @@ -1643,6 +1642,7 @@ glusterd_op_set_volume (dict_t *dict) } if (!global_opt) { + gd_update_volume_op_versions (volinfo); ret = glusterd_create_volfiles_and_notify_services (volinfo); if (ret) { gf_log (this->name, GF_LOG_ERROR, @@ -1664,11 +1664,11 @@ glusterd_op_set_volume (dict_t *dict) goto out; } } - gd_update_volume_op_versions (volinfo); } else { list_for_each_entry (voliter, &priv->volumes, vol_list) { volinfo = voliter; + gd_update_volume_op_versions (volinfo); ret = glusterd_create_volfiles_and_notify_services (volinfo); if (ret) { gf_log (this->name, GF_LOG_ERROR, @@ -1691,7 +1691,6 @@ glusterd_op_set_volume (dict_t *dict) goto out; } } - gd_update_volume_op_versions (volinfo); } } diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 2b5128062ad..bde5b9b525a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -2901,13 +2901,13 @@ glusterd_import_friend_volume (dict_t *vols, size_t count) (void) glusterd_start_bricks (new_volinfo); } + gd_update_volume_op_versions (new_volinfo); + ret = glusterd_store_volinfo (new_volinfo, GLUSTERD_VOLINFO_VER_AC_NONE); ret = glusterd_create_volfiles_and_notify_services (new_volinfo); if (ret) goto out; - gd_update_volume_op_versions (new_volinfo); - list_add_tail (&new_volinfo->vol_list, &priv->volumes); out: gf_log ("", GF_LOG_DEBUG, "Returning with ret: %d", ret); diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 127e4c4631d..d849f31b1e4 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -1696,16 +1696,11 @@ static int perfxl_option_handler (volgen_graph_t *graph, struct volopt_map_entry *vme, void *param) { - char *volname = NULL; gf_boolean_t enabled = _gf_false; - xlator_t *this = NULL; - glusterd_conf_t *conf = NULL; - - this = THIS; - GF_ASSERT (this); - conf = this->private; + glusterd_volinfo_t *volinfo = NULL; - volname = param; + GF_ASSERT (param); + volinfo = param; if (strcmp (vme->option, "!perf") != 0) return 0; @@ -1718,10 +1713,10 @@ perfxl_option_handler (volgen_graph_t *graph, struct volopt_map_entry *vme, /* Check op-version before adding the 'open-behind' xlator in the graph */ if (!strcmp (vme->key, "performance.open-behind") && - (vme->op_version > conf->op_version)) + (vme->op_version > volinfo->client_op_version)) return 0; - if (volgen_graph_add (graph, vme->voltype, volname)) + if (volgen_graph_add (graph, vme->voltype, volinfo->volname)) return 0; else return -1; @@ -2472,7 +2467,7 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, default for a volume */ tmp_data = dict_get (set_dict, "nfs-volume-file"); if (!tmp_data) - ret = volgen_graph_set_options_generic (graph, set_dict, volname, + ret = volgen_graph_set_options_generic (graph, set_dict, volinfo, &perfxl_option_handler); else ret = volgen_graph_set_options_generic (graph, set_dict, volname, diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index 17b3f6182f7..7cac938c13c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -1652,6 +1652,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) i++; } + gd_update_volume_op_versions (volinfo); + ret = glusterd_store_volinfo (volinfo, GLUSTERD_VOLINFO_VER_AC_INCREMENT); if (ret) { glusterd_store_delete_volume (volinfo); @@ -1669,7 +1671,6 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) list_add_tail (&volinfo->vol_list, &priv->volumes); vol_added = _gf_true; - gd_update_volume_op_versions (volinfo); out: GF_FREE(free_ptr); if (!vol_added && volinfo) |