summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2015-04-23 16:24:43 +0530
committerVijay Bellur <vbellur@redhat.com>2015-05-07 23:07:21 -0700
commit7c0c184be28e0cba08645c7106c6901b444651c9 (patch)
treeecb398a5d33813b5bfb4af3535f3877a195560b1 /xlators/mgmt/glusterd/src/glusterd-brick-ops.c
parent9ba8963999bca431ec14a25961a163810cfe1e5b (diff)
tiering: Do not allow some operations on tiered volume
Some operations like add-brick,remove-brick,rebalance, replace-brick are not supported on tiered volume. But there is no code level check for this. This patch will allow to do the same Change-Id: I12689f4e902cf0cceaf6f7f29c71057305024977 BUG: 1205624 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/10349 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-brick-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index f80b5a8078b..19ba5e5219e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -511,6 +511,14 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req)
goto brick_val;
}
+ ret = glusterd_disallow_op_for_tier (volinfo, GD_OP_ADD_BRICK, -1);
+ if (ret) {
+ snprintf (err_str, sizeof (err_str), "Add-brick operation is "
+ "not supported on a tiered volume %s", volname);
+ gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ goto out;
+ }
+
if (!stripe_count && !replica_count) {
if (volinfo->type == GF_CLUSTER_TYPE_NONE)
goto brick_val;
@@ -753,6 +761,7 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
int32_t replica_count = 0;
char *volname = 0;
xlator_t *this = NULL;
+ int cmd = -1;
GF_ASSERT (req);
this = THIS;
@@ -818,6 +827,22 @@ __glusterd_handle_remove_brick (rpcsvc_request_t *req)
goto out;
}
+ ret = dict_get_int32 (dict, "command", &cmd);
+ if (ret) {
+ snprintf (err_str, sizeof (err_str), "Unable to get cmd "
+ "ccommand");
+ gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ goto out;
+ }
+
+ ret = glusterd_disallow_op_for_tier (volinfo, GD_OP_REMOVE_BRICK, cmd);
+ if (ret) {
+ snprintf (err_str, sizeof (err_str),
+ "Removing brick from a Tier volume is not allowed");
+ gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ goto out;
+ }
+
ret = dict_get_int32 (dict, "replica-count", &replica_count);
if (!ret) {
gf_log (this->name, GF_LOG_INFO,