script for testing glusterd sanity

Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>

BUG: 1436 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1436
This commit is contained in:
Raghavendra Bhat 2010-10-28 07:02:44 +00:00 committed by Anand V. Avati
parent d654c29d20
commit 8ea6882c42
3 changed files with 98 additions and 4 deletions

View File

@ -20,6 +20,15 @@
# This script tests the basics gluster cli commands.
echo "Starting glusterd"
glusterd
if [ $? -ne 0 ]; then
echo "Could not start glusterd.Exiting"
exit;
else
echo "glusterd started"
fi
if [ ! -d "/exports" ]; then
mkdir /exports;
mkdir /exports/exp{1..10};
@ -59,20 +68,29 @@ sleep 1
echo "replacing brick......"
gluster volume replace-brick vol `hostname`:/exports/exp1 `hostname`:/exports/exp3 start
#sleep for 5 seconds
sleep 5
gluster volume replace-brick vol `hostname`:/exports/exp1 `hostname`:/exports/exp3 status
gluster volume replace-brick vol `hostname`:/exports/exp1 `hostname`:/exports/exp3 pause
gluster volume replace-brick vol `hostname`:/exports/exp1 `hostname`:/exports/exp3 status
gluster volume replace-brick vol `hostname`:/exports/exp1 `hostname`:/exports/exp3 start
#sleep for 5 seconds
sleep 5
gluster volume replace-brick vol `hostname`:/exports/exp1 `hostname`:/exports/exp3 status
gluster volume replace-brick vol `hostname`:/exports/exp1 `hostname`:/exports/exp3 commit
echo "replcing brick for abort operation"
gluster volume replace-brick vol `hostname`:/exports/exp3 `hostname`:/exports/exp1 start
#sleep for 5 seconds
sleep 5
gluster volume replace-brick vol `hostname`:/exports/exp3 `hostname`:/exports/exp1 status
gluster volume replace-brick vol `hostname`:/exports/exp3 `hostname`:/exports/exp1 pause
gluster volume replace-brick vol `hostname`:/exports/exp3 `hostname`:/exports/exp1 status
gluster volume replace-brick vol `hostname`:/exports/exp3 `hostname`:/exports/exp1 start
#sleep for 5 seconds
sleep 5
gluster volume replace-brick vol `hostname`:/exports/exp3 `hostname`:/exports/exp1 status
gluster volume replace-brick vol `hostname`:/exports/exp3 `hostname`:/exports/exp1 abort
@ -96,7 +114,7 @@ umount /mnt/client
df -h
echo "deleting distribute volume......"
gluster volume delete vol
gluster --mode=script volume delete vol
gluster volume info
sleep 1
@ -124,10 +142,14 @@ sleep 1
echo "replacing-brick....."
gluster volume replace-brick mirror `hostname`:/exports/exp1 `hostname`:/exports/exp5 start
#sleep for 5 seconds
sleep 5
gluster volume replace-brick mirror `hostname`:/exports/exp1 `hostname`:/exports/exp5 status
gluster volume replace-brick mirror `hostname`:/exports/exp1 `hostname`:/exports/exp5 pause
gluster volume replace-brick mirror `hostname`:/exports/exp1 `hostname`:/exports/exp5 status
gluster volume replace-brick mirror `hostname`:/exports/exp1 `hostname`:/exports/exp5 start
#sleep for 5 seconds
sleep 5
gluster volume replace-brick mirror `hostname`:/exports/exp1 `hostname`:/exports/exp5 status
gluster volume replace-brick mirror `hostname`:/exports/exp1 `hostname`:/exports/exp5 commit
gluster volume info
@ -135,12 +157,16 @@ sleep 1
df -h
sleep 1
echo "replacing vrick for abort operation"
echo "replacing brick for abort operation"
gluster volume replace-brick mirror `hostname`:/exports/exp5 `hostname`:/exports/exp1 start
#sleep for 5 seconds
sleep 5
gluster volume replace-brick mirror `hostname`:/exports/exp5 `hostname`:/exports/exp1 status
gluster volume replace-brick mirror `hostname`:/exports/exp5 `hostname`:/exports/exp1 pause
gluster volume replace-brick mirror `hostname`:/exports/exp5 `hostname`:/exports/exp1 status
gluster volume replace-brick mirror `hostname`:/exports/exp5 `hostname`:/exports/exp1 start
#sleep for 5 seconds
sleep 5
gluster volume replace-brick mirror `hostname`:/exports/exp5 `hostname`:/exports/exp1 status
gluster volume replace-brick mirror `hostname`:/exports/exp5 `hostname`:/exports/exp5 abort
@ -164,7 +190,7 @@ umount /mnt/client
df -h
echo "deleting replicate volume....."
gluster volume delete mirror
gluster --mode=script volume delete mirror
gluster volume info
sleep 1
@ -193,10 +219,14 @@ sleep 1
echo "replacing brick....."
gluster volume replace-brick str `hostname`:/exports/exp1 `hostname`:/exports/exp5 start
#sleep for 5 seconds
sleep 5
gluster volume replace-brick str `hostname`:/exports/exp1 `hostname`:/exports/exp5 status
gluster volume replace-brick str `hostname`:/exports/exp1 `hostname`:/exports/exp5 pause
gluster volume replace-brick str `hostname`:/exports/exp1 `hostname`:/exports/exp5 status
gluster volume replace-brick str `hostname`:/exports/exp1 `hostname`:/exports/exp5 start
#sleep for 5 seconds
sleep 5
gluster volume replace-brick str `hostname`:/exports/exp1 `hostname`:/exports/exp5 status
gluster volume replace-brick str `hostname`:/exports/exp1 `hostname`:/exports/exp5 commit
@ -207,10 +237,14 @@ sleep 1
echo "replacing brick for abort operation"
gluster volume replace-brick str `hostname`:/exports/exp5 `hostname`:/exports/exp1 start
#sleep for 5 seconds
sleep 5
gluster volume replace-brick str `hostname`:/exports/exp5 `hostname`:/exports/exp1 status
gluster volume replace-brick str `hostname`:/exports/exp5 `hostname`:/exports/exp1 pause
gluster volume replace-brick str `hostname`:/exports/exp5 `hostname`:/exports/exp1 status
gluster volume replace-brick str `hostname`:/exports/exp5 `hostname`:/exports/exp1 start
#sleep for 5 seconds
sleep 5
gluster volume replace-brick str `hostname`:/exports/exp5 `hostname`:/exports/exp1 status
gluster volume replace-brick str `hostname`:/exports/exp5 `hostname`:/exports/exp1 abort
@ -234,5 +268,6 @@ umount /mnt/client
df -h
echo "deleting stripe volume....."
gluster volume delete str
gluster --mode=script volume delete str
gluster volume info

31
extras/test/run.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
# Copyright (c) 2006-2010 Gluster, Inc. <http://www.gluster.com>
# This file is part of GlusterFS.
# GlusterFS is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation; either version 3 of the License,
# or (at your option) any later version.
# GlusterFS is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
# Running gluster sanity test which starts glusterd and runs gluster commands, and exit at the first failure.
$PWD/gluster_commands.sh
if [ $? -ne 0 ]; then
echo "sanity failed"
else
echo "sanity passed"
fi
# Stopping glusterd
$PWD/stop_glusterd.sh

28
extras/test/stop_glusterd.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
# Copyright (c) 2006-2010 Gluster, Inc. <http://www.gluster.com>
# This file is part of GlusterFS.
# GlusterFS is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation; either version 3 of the License,
# or (at your option) any later version.
# GlusterFS is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#This script stops the glusterd running on the machine. Helpful for gluster sanity script
killall -9 glusterd
if [ $? -ne 0 ]; then
echo "Error: Could not kill glusterd. Either glusterd is not running or kill it manually"
else
echo "Killed glusterd"
fi