From f53cf50ba2667a9bcf92227a1023625bda398c59 Mon Sep 17 00:00:00 2001 From: Kaushal M Date: Wed, 2 Mar 2016 15:19:30 +0530 Subject: glusterd: Always copy old brick ports when importing Backport of ecf6243 from master. When an updated volinfo is imported in, the brick ports from the old volinfo should be always copied. Earlier, this was being done only if the old volinfo was stopped and new volinfo was started. This could lead to brick ports chaging when the following sequence of steps happened. - A volume is stopped - GlusterD is stopped on a peer - The stopped volume is started - The stopped GlusterD is started This sequence would lead to bricks on the peer with re-started GlusterD to get new ports, which could break firewall rules and could prevent client access. This sequence could be hit when enabling management encryption in a Gluster trusted storage pool. Change-Id: I808ad478038d12ed2b19752511bdd7aa6f663bfc BUG: 1316391 Reviewed-originally-on: http://review.gluster.org/13578 Signed-off-by: Kaushal M Reviewed-on: http://review.gluster.org/13664 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Atin Mukherjee --- .../glusterd/1313628-import-brick-ports-always.t | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 tests/bugs/glusterd/1313628-import-brick-ports-always.t (limited to 'tests/bugs/glusterd') diff --git a/tests/bugs/glusterd/1313628-import-brick-ports-always.t b/tests/bugs/glusterd/1313628-import-brick-ports-always.t new file mode 100755 index 00000000000..d04c4293466 --- /dev/null +++ b/tests/bugs/glusterd/1313628-import-brick-ports-always.t @@ -0,0 +1,47 @@ +#!/bin/bash +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../cluster.rc + +## Check that brick ports are always copied on import +## -------------------------------------------------- +## This test checks that the brick ports are copied on import by checking that +## they don't change when the following happens, +## - Stop a volume +## - Stop glusterd +## - Start the stopped volume +## - Start the stopped glusterd + +function get_brick_port() { + local VOL=$1 + local BRICK=$2 + $CLI2 volume status $VOL $BRICK --xml | sed -ne 's/.*\([0-9]*\)<\/port>/\1/p' +} + + +cleanup + +TEST launch_cluster 2 +TEST $CLI1 peer probe $H2 +EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count + +# Create and start volume so that brick port assignment happens +TEST $CLI1 volume create $V0 $H1:$B1/$V0 $H2:$B2/$V0 +TEST $CLI1 volume start $V0 + +# Save port for 2nd brick +BPORT_ORIG=$(get_brick_port $V0 $H2:$B2/$V0) + +# Stop volume, stop 2nd glusterd, start volume, start 2nd glusterd +TEST $CLI1 volume stop $V0 +TEST kill_glusterd 2 + +TEST $CLI1 volume start $V0 +TEST start_glusterd 2 +EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count + +# Get new port and compare with old one +EXPECT_WITHIN $PROCESS_UP_TIMEOUT $BPORT_ORIG get_brick_port $V0 $H2:$B2/$V0 + +$CLI1 volume stop $V0 + +cleanup -- cgit