diff options
| author | Krishnan Parthasarathi <kparthas@redhat.com> | 2012-07-31 11:31:16 +0530 | 
|---|---|---|
| committer | Anand Avati <avati@redhat.com> | 2012-08-02 13:38:53 -0700 | 
| commit | 1e4a2354b57a1eb173f31a15bf96b2e174fa34a5 (patch) | |
| tree | 7d47fb5dca27b8eab1b6073ccedc9b56425bf5a4 /xlators/mgmt/glusterd/src/glusterd-handler.c | |
| parent | 36827add0f55d674768ff9c90c5fbb636ae99054 (diff) | |
glusterd: Made volume set help/help-xml a non-cluster operation.
- Retained apparent redundant checks in stage, commit phase of set
  volume for the help options for backward compatibility
Change-Id: Iaefe3805d6b5eeeced2e7e4870830edf3e61dc87
BUG: 844696
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.com/3761
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c')
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 38 | 
1 files changed, 23 insertions, 15 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index ccec91f80df..8d24b08ab9c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -1014,6 +1014,8 @@ glusterd_handle_set_volume (rpcsvc_request_t *req)          char                            *key = NULL;          char                            *value = NULL;          char                            *volname = NULL; +        char                            *op_errstr = NULL; +        gf_boolean_t                    help = _gf_false;          GF_ASSERT (req); @@ -1047,22 +1049,25 @@ glusterd_handle_set_volume (rpcsvc_request_t *req)                  goto out;          } +        if (strcmp (volname, "help") == 0 || +            strcmp (volname, "help-xml") == 0) { +                ret = glusterd_volset_help (dict, &op_errstr); +                help = _gf_true; +                goto out; +        } +          ret = dict_get_str (dict, "key1", &key);          if (ret) { -                if (strcmp (volname, "help-xml") && strcmp (volname, "help")) { -                        gf_log ("", GF_LOG_WARNING, "Unable to get key, while " -                                "handling volume set for %s",volname); -                        goto out; -                } +                gf_log ("", GF_LOG_WARNING, "Unable to get key, while " +                        "handling volume set for %s",volname); +                goto out;          }          ret = dict_get_str (dict, "value1", &value);          if (ret) { -                if (strcmp (volname, "help-xml") && strcmp (volname, "help")) { -                        gf_log ("", GF_LOG_WARNING, "Unable to get value, while" -                                "handling volume set for %s",volname); -                        goto out; -                } +                gf_log ("", GF_LOG_WARNING, "Unable to get value, while" +                        "handling volume set for %s",volname); +                goto out;          } @@ -1071,17 +1076,20 @@ glusterd_handle_set_volume (rpcsvc_request_t *req)          ret = glusterd_op_begin (req, GD_OP_SET_VOLUME, dict);          gf_cmd_log ("volume set", "volume-name:%s: key:%s, value:%s %s",                      volname, key, value, (ret == 0)? "SUCCEDED" : "FAILED" ); -out: +out:          glusterd_friend_sm ();          glusterd_op_sm (); -        if (ret) { -                if (dict) -                        dict_unref (dict); +        if (help) +                ret = glusterd_op_send_cli_response (cli_op, ret, 0, req, dict, +                                                     (op_errstr)? op_errstr:""); +        else if (ret)                  ret = glusterd_op_send_cli_response (cli_op, ret, 0, req,                                                       NULL, "operation failed"); -        } +        if (op_errstr) +                GF_FREE (op_errstr); +          return ret;  }  | 
