summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli/src/cli-cmd-volume.c33
-rw-r--r--cli/src/cli-rpc-ops.c15
-rw-r--r--cli/src/cli-xml-output.c66
-rw-r--r--cli/src/cli.h3
-rwxr-xr-xtests/bugs/error-gen/bug-767095.t2
-rw-r--r--tests/bugs/glusterd/bug-1111041.t2
-rwxr-xr-xtests/bugs/glusterfs-server/bug-861542.t2
-rw-r--r--tests/volume.rc6
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c57
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c16
10 files changed, 167 insertions, 35 deletions
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index 6875563..848dffe 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -1778,10 +1778,15 @@ void
cli_print_detailed_status (cli_volume_status_t *status)
{
cli_out ("%-20s : %-20s", "Brick", status->brick);
- if (status->online)
- cli_out ("%-20s : %-20d", "Port", status->port);
- else
- cli_out ("%-20s : %-20s", "Port", "N/A");
+
+ if (status->online) {
+ cli_out ("%-20s : %-20d", "TCP Port", status->port);
+ cli_out ("%-20s : %-20d", "RDMA Port", status->rdma_port);
+ } else {
+ cli_out ("%-20s : %-20s", "TCP Port", "N/A");
+ cli_out ("%-20s : %-20s", "RDMA Port", "N/A");
+ }
+
cli_out ("%-20s : %-20c", "Online", (status->online) ? 'Y' : 'N');
cli_out ("%-20s : %-20s", "Pid", status->pid_str);
@@ -1842,7 +1847,7 @@ cli_print_brick_status (cli_volume_status_t *status)
int fieldlen = CLI_VOL_STATUS_BRICK_LEN;
int bricklen = 0;
char *p = NULL;
- int num_tabs = 0;
+ int num_spaces = 0;
p = status->brick;
bricklen = strlen (p);
@@ -1852,25 +1857,27 @@ cli_print_brick_status (cli_volume_status_t *status)
p += fieldlen;
bricklen -= fieldlen;
} else {
- num_tabs = (fieldlen - bricklen) / CLI_TAB_LENGTH + 1;
+ num_spaces = (fieldlen - bricklen) + 1;
printf ("%s", p);
- while (num_tabs-- != 0)
- printf ("\t");
- if (status->port) {
+ while (num_spaces-- != 0)
+ printf (" ");
+ if (status->port || status->rdma_port) {
if (status->online)
- cli_out ("%d\t%c\t%s",
+ cli_out ("%-10d%-11d%-8c%-5s",
status->port,
+ status->rdma_port,
status->online?'Y':'N',
status->pid_str);
else
- cli_out ("%s\t%c\t%s",
+ cli_out ("%-10s%-11s%-8c%-5s",
+ "N/A",
"N/A",
status->online?'Y':'N',
status->pid_str);
}
else
- cli_out ("%s\t%c\t%s",
- "N/A", status->online?'Y':'N',
+ cli_out ("%-10s%-11s%-8c%-5s",
+ "N/A", "N/A", status->online?'Y':'N',
status->pid_str);
bricklen = 0;
}
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index bd133d0..0238a8f 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -6722,12 +6722,15 @@ gf_cli_status_cbk (struct rpc_req *req, struct iovec *iov,
cli_out ("Status of volume: %s", volname);
if ((cmd & GF_CLI_STATUS_DETAIL) == 0) {
- cli_out ("Gluster process\t\t\t\t\t\tPort\tOnline\tPid");
+ cli_out ("%-*s %s %s %s %s", CLI_VOL_STATUS_BRICK_LEN,
+ "Gluster process", "TCP Port", "RDMA Port",
+ "Online", "Pid");
cli_print_line (CLI_BRICK_STATUS_LINE_LEN);
}
for (i = 0; i <= index_max; i++) {
+ status.rdma_port = 0;
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "brick%d.hostname", i);
@@ -6751,9 +6754,15 @@ gf_cli_status_cbk (struct rpc_req *req, struct iovec *iov,
!strcmp (hostname, "Snapshot Daemon"))
snprintf (status.brick, PATH_MAX + 255, "%s on %s",
hostname, path);
- else
+ else {
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "brick%d.rdma_port", i);
+ ret = dict_get_int32 (dict, key, &(status.rdma_port));
+ if (ret)
+ continue;
snprintf (status.brick, PATH_MAX + 255, "Brick %s:%s",
hostname, path);
+ }
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "brick%d.port", i);
@@ -6786,10 +6795,10 @@ gf_cli_status_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
cli_print_line (CLI_BRICK_STATUS_LINE_LEN);
cli_print_detailed_status (&status);
-
} else {
cli_print_brick_status (&status);
}
+
}
cli_out (" ");
diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c
index b4c72ea..b5cbbf6 100644
--- a/cli/src/cli-xml-output.c
+++ b/cli/src/cli-xml-output.c
@@ -234,14 +234,15 @@ cli_xml_output_vol_status_common (xmlTextWriterPtr writer, dict_t *dict,
int brick_index, int *online,
gf_boolean_t *node_present)
{
- int ret = -1;
- char *hostname = NULL;
- char *path = NULL;
- char *uuid = NULL;
- int port = 0;
- int status = 0;
- int pid = 0;
- char key[1024] = {0,};
+ int ret = -1;
+ char *hostname = NULL;
+ char *path = NULL;
+ char *uuid = NULL;
+ int port = 0;
+ int rdma_port = 0;
+ int status = 0;
+ int pid = 0;
+ char key[1024] = {0,};
snprintf (key, sizeof (key), "brick%d.hostname", brick_index);
ret = dict_get_str (dict, key, &hostname);
@@ -294,19 +295,62 @@ cli_xml_output_vol_status_common (xmlTextWriterPtr writer, dict_t *dict,
if (ret)
goto out;
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "brick%d.rdma_port", brick_index);
+ ret = dict_get_int32 (dict, key, &rdma_port);
+
/* If the process is either offline or doesn't provide a port (shd)
* port = "N/A"
* else print the port number of the process.
*/
+ /*
+ * Tag 'port' can be removed once console management is started
+ * to support new tag ports.
+ */
+
if (*online == 1 && port != 0)
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *)"port",
+ "%d", port);
+ else
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *)"port",
+ "%s", "N/A");
+
+ ret = xmlTextWriterStartElement (writer, (xmlChar *)"ports");
+ if (*online == 1 && (port != 0 || rdma_port != 0)) {
+
+ if (port) {
ret = xmlTextWriterWriteFormatElement (writer,
- (xmlChar *)"port",
+ (xmlChar *)"tcp",
"%d", port);
- else
+ } else {
ret = xmlTextWriterWriteFormatElement (writer,
- (xmlChar *)"port",
+ (xmlChar *)"tcp",
"%s", "N/A");
+ }
+
+ if (rdma_port) {
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *)"rdma",
+ "%d", rdma_port);
+ } else {
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *)"rdma",
+ "%s", "N/A");
+ }
+
+ } else {
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *)"tcp",
+ "%s", "N/A");
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *)"rdma",
+ "%s", "N/A");
+ }
+
+ ret = xmlTextWriterEndElement (writer);
XML_RET_CHECK_AND_GOTO (ret, out);
memset (key, 0, sizeof (key));
diff --git a/cli/src/cli.h b/cli/src/cli.h
index 89aedc5..bdf366b 100644
--- a/cli/src/cli.h
+++ b/cli/src/cli.h
@@ -33,7 +33,7 @@
#define CLI_DEFAULT_CMD_TIMEOUT 120
#define CLI_TEN_MINUTES_TIMEOUT 600 //Longer timeout for volume top
#define DEFAULT_CLI_LOG_FILE_DIRECTORY DATADIR "/log/glusterfs"
-#define CLI_VOL_STATUS_BRICK_LEN 55
+#define CLI_VOL_STATUS_BRICK_LEN 43
#define CLI_TAB_LENGTH 8
#define CLI_BRICK_STATUS_LINE_LEN 78
@@ -150,6 +150,7 @@ struct cli_local {
struct cli_volume_status {
int port;
+ int rdma_port;
int online;
uint64_t block_size;
uint64_t total_inodes;
diff --git a/tests/bugs/error-gen/bug-767095.t b/tests/bugs/error-gen/bug-767095.t
index 34c3b18..4649a78 100755
--- a/tests/bugs/error-gen/bug-767095.t
+++ b/tests/bugs/error-gen/bug-767095.t
@@ -31,7 +31,7 @@ TEST $CLI volume set $V0 server.statedump-path $dump_dir;
TEST $CLI volume start $V0;
EXPECT 'Started' volinfo_field $V0 'Status';
-TEST PID=`gluster --xml volume status patchy | grep -A 5 patchy1 | grep '<pid>' | cut -d '>' -f 2 | cut -d '<' -f 1`
+TEST PID=`gluster --xml volume status patchy | grep -A 8 patchy1 | grep '<pid>' | cut -d '>' -f 2 | cut -d '<' -f 1`
TEST kill -USR1 $PID;
sleep 2;
for file_name in $(ls $dump_dir)
diff --git a/tests/bugs/glusterd/bug-1111041.t b/tests/bugs/glusterd/bug-1111041.t
index 9e72c50..caaece0 100644
--- a/tests/bugs/glusterd/bug-1111041.t
+++ b/tests/bugs/glusterd/bug-1111041.t
@@ -29,7 +29,7 @@ SNAPD_PID=$(ps auxww | grep snapd | grep -v grep | awk '{print $2}');
TEST [ $SNAPD_PID -gt 0 ];
-SNAPD_PID2=$($CLI volume status $V0 | grep "Snapshot Daemon" | awk {'print $7'});
+SNAPD_PID2=$($CLI volume status $V0 | grep "Snapshot Daemon" | awk {'print $8'});
TEST [ $SNAPD_PID -eq $SNAPD_PID2 ]
diff --git a/tests/bugs/glusterfs-server/bug-861542.t b/tests/bugs/glusterfs-server/bug-861542.t
index ab57296..d335932 100755
--- a/tests/bugs/glusterfs-server/bug-861542.t
+++ b/tests/bugs/glusterfs-server/bug-861542.t
@@ -20,7 +20,7 @@ function port_field()
if [ $opt -eq '0' ]; then
$CLI volume status $vol | grep "brick0" | awk '{print $3}';
else
- $CLI volume status $vol detail | grep "^Port " | awk '{print $3}';
+ $CLI volume status $vol detail | grep "^TCP Port " | awk '{print $4}';
fi
}
diff --git a/tests/volume.rc b/tests/volume.rc
index 7e88108..887a9ca 100644
--- a/tests/volume.rc
+++ b/tests/volume.rc
@@ -175,15 +175,15 @@ function afr_child_up_status_in_nfs {
}
function nfs_up_status {
- gluster volume status | grep "NFS Server" | awk '{print $6}'
+ gluster volume status | grep "NFS Server" | awk '{print $7}'
}
function glustershd_up_status {
- gluster volume status | grep "Self-heal Daemon" | awk '{print $6}'
+ gluster volume status | grep "Self-heal Daemon" | awk '{print $7}'
}
function quotad_up_status {
- gluster volume status | grep "Quota Daemon" | awk '{print $6}'
+ gluster volume status | grep "Quota Daemon" | awk '{print $7}'
}
function get_brick_pid {
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 9352b9a..93585e3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -3752,6 +3752,42 @@ glusterd_is_volume_status_modify_op_ctx (uint32_t cmd)
return _gf_false;
}
+int
+glusterd_op_modify_port_key (dict_t *op_ctx, int brick_index_max)
+{
+ char *port = NULL;
+ int i = 0;
+ int ret = -1;
+ char key[1024] = {0};
+ char old_key[1024] = {0};
+
+ for (i = 0; i <= brick_index_max; i++) {
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "brick%d.rdma_port", i);
+ ret = dict_get_str (op_ctx, key, &port);
+
+ if (ret) {
+
+ memset (old_key, 0, sizeof (old_key));
+ snprintf (old_key, sizeof (old_key),
+ "brick%d.port", i);
+ ret = dict_get_str (op_ctx, old_key, &port);
+ if (ret)
+ goto out;
+
+ ret = dict_set_str (op_ctx, key, port);
+ if (ret)
+ goto out;
+ ret = dict_set_str (op_ctx, old_key, "\0");
+ if (ret)
+ goto out;
+ }
+ }
+out:
+ return ret;
+}
+
/* 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.
@@ -3766,9 +3802,13 @@ glusterd_op_modify_op_ctx (glusterd_op_t op, void *ctx)
int count = 0;
uint32_t cmd = GF_CLI_STATUS_NONE;
xlator_t *this = NULL;
+ glusterd_conf_t *conf = NULL;
+ char *volname = NULL;
+ glusterd_volinfo_t *volinfo = NULL;
this = THIS;
GF_ASSERT (this);
+ conf = this->private;
if (ctx)
op_ctx = ctx;
@@ -3814,6 +3854,23 @@ glusterd_op_modify_op_ctx (glusterd_op_t op, void *ctx)
count = brick_index_max + other_count + 1;
+ /*
+ * a glusterd lesser than version 3.7 will be sending the
+ * rdma port in older key. Changing that value from here
+ * to support backward compatibility
+ */
+ ret = dict_get_str (op_ctx, "volname", &volname);
+ if (ret)
+ goto out;
+
+ glusterd_volinfo_find (volname, &volinfo);
+ if (conf->op_version < GD_OP_VERSION_3_7_0 &&
+ volinfo->transport_type == GF_TRANSPORT_RDMA) {
+ ret = glusterd_op_modify_port_key (op_ctx,
+ brick_index_max);
+ if (ret)
+ goto out;
+ }
/* add 'brick%d.peerid' into op_ctx with value of 'brick%d.path'.
nfs/sshd like services have this additional uuid */
{
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 9ff7bf2..5d28dc2 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -6112,10 +6112,24 @@ glusterd_add_brick_to_dict (glusterd_volinfo_t *volinfo,
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.port", base_key);
- ret = dict_set_int32 (dict, key, brickinfo->port);
+ ret = dict_set_int32 (dict, key, (volinfo->transport_type ==
+ GF_TRANSPORT_RDMA) ? 0 : brickinfo->port);
if (ret)
goto out;
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "%s.rdma_port", base_key);
+ if (volinfo->transport_type == GF_TRANSPORT_RDMA) {
+ ret = dict_set_int32 (dict, key, brickinfo->port);
+ } else if (volinfo->transport_type == GF_TRANSPORT_BOTH_TCP_RDMA) {
+ ret = dict_set_int32 (dict, key, brickinfo->rdma_port);
+ } else
+ ret = dict_set_int32 (dict, key, 0);
+
+ if (ret)
+ goto out;
+
+
GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo, brickinfo, priv);
brick_online = gf_is_service_running (pidfile, &pid);