diff options
author | Kaushal M <kaushal@redhat.com> | 2014-05-12 11:22:36 +0530 |
---|---|---|
committer | Krishnan Parthasarathi <kparthas@redhat.com> | 2014-05-14 03:14:33 -0700 |
commit | bfde478cedda8267134ee3807c8db5e042115eae (patch) | |
tree | 580fde93def7ad60bfb29017b5bd91ad67db9729 /xlators/mgmt/glusterd/src/glusterd-op-sm.c | |
parent | 5c65850c99829668ac199a49a0760443db74b581 (diff) |
glusterd: Allow setting volume options by default based on op-version
A new function glusterd_enable_default_options is introduced, which will
set some volume options on a volume based on op-version. This function
is called near the end of the volume create and will allow some options
to be enabled based on op-version on newly created volumes. This will
also be called during volume reset, to reset the options to their
default values if they had changed.
Change-Id: I91057d9e42409b17a884728b43ae3721328d4831
BUG: 1096616
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/7734
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index edafb5469ae..8b9ddf32259 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -1509,9 +1509,17 @@ glusterd_options_reset (glusterd_volinfo_t *volinfo, char *key, GF_ASSERT (volinfo->dict); GF_ASSERT (key); - if (!strncmp(key, "all", 3)) + if (!strncmp(key, "all", 3)) { dict_foreach (volinfo->dict, _delete_reconfig_opt, is_force); - else { + ret = glusterd_enable_default_options (volinfo, NULL); + if (ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_FAIL_DEFAULT_OPT_SET, "Failed to set " + "default options on reset for volume %s", + volinfo->volname); + goto out; + } + } else { value = dict_get (volinfo->dict, key); if (!value) { gf_log (this->name, GF_LOG_DEBUG, @@ -1519,6 +1527,14 @@ glusterd_options_reset (glusterd_volinfo_t *volinfo, char *key, goto out; } _delete_reconfig_opt (volinfo->dict, key, value, is_force); + ret = glusterd_enable_default_options (volinfo, key); + if (ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_FAIL_DEFAULT_OPT_SET, "Failed to set " + "default value for option '%s' on reset for " + "volume %s", key, volinfo->volname); + goto out; + } } gd_update_volume_op_versions (volinfo); |