diff options
author | Kaushal M <kaushal@redhat.com> | 2012-04-02 13:00:47 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-04-02 02:41:18 -0700 |
commit | e51f690d7c5eda400316ba97ab2f4ce448b51e7d (patch) | |
tree | d02b569563fb8a171b621f8c7a9e0eccc5e67557 | |
parent | 0f3b55be4376c1c59131d999469d3b3c6aaddd87 (diff) |
glusterd: Include port in nfs status
Change-Id: I679e491e801b694e8a0f93dd87cf540441dae927
BUG: 806877
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.com/3060
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
-rw-r--r-- | libglusterfs/src/common-utils.h | 5 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 11 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 18 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.h | 3 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs3.h | 1 |
5 files changed, 30 insertions, 8 deletions
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index 33551779974..3aa0143d2ed 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -81,6 +81,11 @@ void trap (void); !strcmp (fs_name, "ext3") || \ !strcmp (fs_name, "ext4")) +/* Defining this here as it is needed by glusterd for setting + * nfs port in volume status. + */ +#define GF_NFS3_PORT 38467 + enum _gf_boolean { _gf_false = 0, diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index d548b95a8b6..80553b4376d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -1450,14 +1450,15 @@ glusterd_op_status_volume (dict_t *dict, char **op_errstr, vol_opts = volinfo->dict; if ((cmd & GF_CLI_STATUS_NFS) != 0) { - ret = glusterd_add_node_to_dict ("nfs", rsp_dict, 0); + ret = glusterd_add_node_to_dict ("nfs", rsp_dict, 0, vol_opts); if (ret) goto out; other_count++; node_count++; } else if ((cmd & GF_CLI_STATUS_SHD) != 0) { - ret = glusterd_add_node_to_dict ("glustershd", rsp_dict, 0); + ret = glusterd_add_node_to_dict ("glustershd", rsp_dict, 0, + vol_opts); if (ret) goto out; other_count++; @@ -1513,7 +1514,8 @@ glusterd_op_status_volume (dict_t *dict, char **op_errstr, if (!nfs_disabled) { ret = glusterd_add_node_to_dict ("nfs", rsp_dict, - other_index); + other_index, + vol_opts); if (ret) goto out; other_index++; @@ -1528,7 +1530,8 @@ glusterd_op_status_volume (dict_t *dict, char **op_errstr, && shd_enabled) { ret = glusterd_add_node_to_dict ("glustershd", rsp_dict, - other_index); + other_index, + vol_opts); if (ret) goto out; other_count++; diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index fc5a83e4564..37899d4be46 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -2958,13 +2958,15 @@ glusterd_shd_stop () } int -glusterd_add_node_to_dict (char *server, dict_t *dict, int count) +glusterd_add_node_to_dict (char *server, dict_t *dict, int count, + dict_t *vol_opts) { int ret = -1; glusterd_conf_t *priv = THIS->private; char pidfile[PATH_MAX] = {0,}; gf_boolean_t running = _gf_false; int pid = -1; + int port = 0; char key[1024] = {0,}; glusterd_get_nodesvc_pidfile (server, priv->workdir, pidfile, @@ -2996,7 +2998,19 @@ glusterd_add_node_to_dict (char *server, dict_t *dict, int count) memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "brick%d.port", count); - ret = dict_set_int32 (dict, key, 0); + /* Port is available only for the NFS server. + * Self-heal daemon doesn't provide any port for access + * by entities other than gluster. + */ + if (!strcmp (server, "nfs")) { + if (dict_get (vol_opts, "nfs.port")) { + ret = dict_get_int32 (vol_opts, "nfs.port", &port); + if (ret) + goto out; + } else + port = GF_NFS3_PORT; + } + ret = dict_set_int32 (dict, key, port); if (ret) goto out; diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index 9cea974c179..5491c7a0068 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -420,7 +420,8 @@ glusterd_add_bricks_hname_path_to_dict (dict_t *dict, glusterd_volinfo_t *volinfo); int -glusterd_add_node_to_dict (char *server, dict_t *dict, int count); +glusterd_add_node_to_dict (char *server, dict_t *dict, int count, + dict_t *vol_opts); char * glusterd_uuid_to_hostname (uuid_t uuid); diff --git a/xlators/nfs/server/src/nfs3.h b/xlators/nfs/server/src/nfs3.h index 4a595e5ef22..e6b9edee5ca 100644 --- a/xlators/nfs/server/src/nfs3.h +++ b/xlators/nfs/server/src/nfs3.h @@ -39,7 +39,6 @@ #include <sys/statvfs.h> #define GF_NFS3 GF_NFS"-nfsv3" -#define GF_NFS3_PORT 38467 #define GF_NFS3_DEFAULT_MEMFACTOR 15 #define GF_NFS3_IOBPOOL_MULT GF_NFS_CONCURRENT_OPS_MULT |