summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2013-07-28 18:36:20 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2013-08-12 00:48:14 +0530
commitb7efa85c380573f4af9df45c7a5866cd21704923 (patch)
tree2cdeb53ed52bb060948f4ea15e5973a7e0affd90
parent6ffe8ce9ad07d742015c3fefc98ee05ee7818ad6 (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>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-quota.c41
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c26
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c10
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 4a2b9454..5f02cc5b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -3825,25 +3825,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 1b860df2..e6d12f04 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -1860,16 +1860,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) {