diff options
author | Krutika Dhananjay <kdhananj@redhat.com> | 2013-07-28 18:36:20 +0530 |
---|---|---|
committer | Krutika Dhananjay <kdhananj@redhat.com> | 2013-07-31 13:27:44 +0530 |
commit | ac50060e6ce89b63dda179b2206b047dfac469fd (patch) | |
tree | 66930ec0cec6bec93220066fd022405b84b05f97 /xlators | |
parent | c9b16973fed6e7b51af38e473fa166df9e260d93 (diff) |
glusterd: Spawn quotad on every node
... and also trigger a reconfigure when the following quota sub-commands
are executed:
a. default-soft-limit,
b. hard-timeout,
c. soft-timeout, and
d. alert-time.
Also start/restart/stop quotad only when quota is enabled or disabled
on any volume.
Tests performed in a two node cluster:
a. Create and start a volume, enable quota on it and check if quotad is
spawned on both the nodes.
b. Execute all quota sub-commands on the volume except 'enable' and
'disable' and verify that the pid of quota daemon doesn't change.
c. Stop the volume and verify that quotad is stopped.
d. Start it again. Quotad must be started now.
e. Create, start and enable quota on a second volume, verify that the pid
of quotad changes on both the nodes (indicating a restart).
f. Disable quota on one of the volumes and verify that quotad's pid changes.
g. Disable quota on the second volume too and verify that quotad is stopped
on both the nodes.
h. Enable quota again on one of the volumes, and verify that quotad is started
on both the nodes.
i. Add a new node into this cluster and verify that quotad is spawned on
this node too.
Change-Id: Ie93ab69c685051e196c377cff15078a1cde17fca
BUG: 969461
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-quota.c | 41 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 26 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 10 |
3 files changed, 46 insertions, 31 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c index ec4a6eb8..307b16d8 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quota.c +++ b/xlators/mgmt/glusterd/src/glusterd-quota.c @@ -941,6 +941,36 @@ glusterd_set_quota_option (glusterd_volinfo_t *volinfo, dict_t *dict, return 0; } +static int +glusterd_quotad_op (int opcode) +{ + int ret = -1; + + switch (opcode) { + case GF_QUOTA_OPTION_TYPE_ENABLE: + case GF_QUOTA_OPTION_TYPE_DISABLE: + + if (glusterd_all_volumes_with_quota_stopped ()) + ret = glusterd_quotad_stop (); + else + ret = glusterd_check_generate_start_quotad (); + break; + + case GF_QUOTA_OPTION_TYPE_DEFAULT_SOFT_LIMIT: + case GF_QUOTA_OPTION_TYPE_HARD_TIMEOUT: + case GF_QUOTA_OPTION_TYPE_SOFT_TIMEOUT: + case GF_QUOTA_OPTION_TYPE_ALERT_TIME: + + ret = glusterd_reconfigure_quotad (); + break; + + default: + ret = 0; + break; + } + return ret; +} + int glusterd_op_quota (dict_t *dict, char **op_errstr, dict_t *rsp_dict) { @@ -1096,15 +1126,8 @@ out: if (rsp_dict && start_crawl == _gf_true) glusterd_quota_initiate_fs_crawl (priv, volname); - if (priv->op_version > GD_OP_VERSION_MIN && - is_origin_glusterd ()) { - if (type != GF_QUOTA_OPTION_TYPE_LIST) { - if (glusterd_all_volumes_with_quota_stopped ()) - ret = glusterd_quotad_stop (); - else - ret = glusterd_check_generate_start_quotad (); - } - } + if (priv->op_version > GD_OP_VERSION_MIN) + ret = glusterd_quotad_op (type); if (rsp_dict && *op_errstr) { ret = dict_set_dynstr (rsp_dict, "errstr", *op_errstr); diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 0958d527..023568f6 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -3821,25 +3821,23 @@ glusterd_nodesvcs_batch_op (glusterd_volinfo_t *volinfo, int (*nfs_op) (), if (ret) goto out; - if (volinfo && !glusterd_is_volume_replicate (volinfo)) - goto quotad_op; + if (volinfo && !glusterd_is_volume_replicate (volinfo)) { + ; //do nothing + } else { + ret = shd_op (); + if (ret) + goto out; + } - ret = shd_op (); - if (ret) + if (conf->op_version == GD_OP_VERSION_MIN) goto out; -quotad_op: - - if (conf->op_version == GD_OP_VERSION_MIN) + if (volinfo && !glusterd_is_volume_quota_enabled (volinfo)) goto out; - if (is_origin_glusterd ()) { - if (volinfo && !glusterd_is_volume_quota_enabled (volinfo)) - goto out; - ret = qd_op (); - if (ret) - goto out; - } + ret = qd_op (); + if (ret) + goto out; out: return ret; diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index 2907dcfe..126667f7 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -1859,16 +1859,10 @@ glusterd_op_statedump_volume (dict_t *dict, char **op_errstr) goto out; } else if (strstr (options, "quotad")) { - if (is_origin_glusterd()) { - ret = glusterd_quotad_statedump (options, option_cnt, - op_errstr); + ret = glusterd_quotad_statedump (options, option_cnt, + op_errstr); if (ret) goto out; - } else { - ret = 0; - goto out; - } - } else { list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) { |