extras: add check for brick path existence

Adding a couple of checks to validate brick path(s)

Change-Id: I2d8538add21407d9457542373b528c2a02cd7eb6
BUG: 765572
Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com>
Reviewed-on: http://review.gluster.com/2514
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
This commit is contained in:
Rajesh Amaravathi 2011-12-26 14:39:24 +05:30 committed by Vijay Bellur
parent 22282b4fb8
commit 5303f98f67

View File

@ -16,24 +16,34 @@ remove_xattrs ()
main ()
{
if [ -z "$1" ]; then
echo "Please specify the brick path(s)";
echo "Usage: $0 <brick_path(s)>";
exit 1;
fi
export PATH;
which getfattr > /dev/null 2>&1;
if [ $? -ne 0 ]; then
echo "attr package missing";
exit 1;
exit 2;
fi
which setfattr > /dev/null 2>&1;
if [ $? -ne 0 ]; then
echo "attr package missing";
exit 1;
exit 2;
fi
for brick in "$@";
do
stat "$brick" > /dev/null 2>&1;
if [ $? -ne 0 ]; then
echo "brick: $brick does not exist";
exit 3;
fi
if [ ! -d "$brick" ]; then
echo "$brick: not a directory";
exit 4;
fi
echo "xattr clean-up in progress: $brick";
remove_xattrs "$brick";
echo "$brick ready to be used as a glusterfs brick";