summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorHarshavardhana <harsha@harshavardhana.net>2014-07-20 14:59:42 -0700
committerKrishnan Parthasarathi <kparthas@redhat.com>2014-07-24 21:08:53 -0700
commit88eb28678c3a16264b5baa57af0d16778ea2c9e6 (patch)
treea5e045f7a0cb112aaa5f1e0afb30806fb404131f /xlators/mgmt
parent54cfb7dab45105e5f9a123503c4f524b99c633ce (diff)
glusterd: Avoid spurious WARNING 'op_ctx modification failed'
This patch fixes by wrapping this whole scenario and skips op_ctx modification for necessary commands. Change-Id: I3ecec19caefdc699d9a2dabfb456a89758ae4aa4 BUG: 1066529 Signed-off-by: Harshavardhana <harsha@harshavardhana.net> Reviewed-on: http://review.gluster.org/8337 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')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 52ab039b9ec..9694a8454ef 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -3827,6 +3827,39 @@ out:
}
+/* This function is used to verify if op_ctx indeed
+ requires modification. This is necessary since the
+ dictionary for certain commands might not have the
+ necessary keys required for the op_ctx modification
+ to succeed.
+
+ Special Cases:
+ - volume status all
+ - volume status
+
+ Regular Cases:
+ - volume status <volname> <brick>
+ - volume status <volname> mem
+ - volume status <volname> clients
+ - volume status <volname> inode
+ - volume status <volname> fd
+ - volume status <volname> callpool
+ - volume status <volname> tasks
+*/
+
+static gf_boolean_t
+glusterd_is_volume_status_modify_op_ctx (uint32_t cmd)
+{
+ if ((cmd & GF_CLI_STATUS_MASK) == GF_CLI_STATUS_NONE) {
+ if (cmd & GF_CLI_STATUS_BRICK)
+ return _gf_false;
+ if (cmd & GF_CLI_STATUS_ALL)
+ return _gf_false;
+ return _gf_true;
+ }
+ return _gf_false;
+}
+
/* This function is used to modify the op_ctx dict before sending it back
* to cli. This is useful in situations like changing the peer uuids to
* hostnames etc.
@@ -3864,8 +3897,8 @@ glusterd_op_modify_op_ctx (glusterd_op_t op, void *ctx)
"Failed to get status cmd");
goto out;
}
- if (!(cmd & GF_CLI_STATUS_NFS || cmd & GF_CLI_STATUS_SHD ||
- (cmd & GF_CLI_STATUS_MASK) == GF_CLI_STATUS_NONE)) {
+
+ if (!glusterd_is_volume_status_modify_op_ctx (cmd)) {
gf_log (this->name, GF_LOG_DEBUG,
"op_ctx modification not required for status "
"operation being performed");