From 812ff6ca9fcd3e629e49d4328905f33eee8ca3f5 Mon Sep 17 00:00:00 2001 From: Qiaowei Ren Date: Thu, 4 Jan 2018 13:43:33 +0800 Subject: initial code repo This patch creates initial code repo. For ceph, luminous stable release will be used for base code, and next changes and optimization for ceph will be added to it. For opensds, currently any changes can be upstreamed into original opensds repo (https://github.com/opensds/opensds), and so stor4nfv will directly clone opensds code to deploy stor4nfv environment. And the scripts for deployment based on ceph and opensds will be put into 'ci' directory. Change-Id: I46a32218884c75dda2936337604ff03c554648e4 Signed-off-by: Qiaowei Ren --- src/ceph/mirroring/test-mirrors.sh | 69 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100755 src/ceph/mirroring/test-mirrors.sh (limited to 'src/ceph/mirroring/test-mirrors.sh') diff --git a/src/ceph/mirroring/test-mirrors.sh b/src/ceph/mirroring/test-mirrors.sh new file mode 100755 index 0000000..4b6392b --- /dev/null +++ b/src/ceph/mirroring/test-mirrors.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# +# Simple script which performs a HTTP and rsync check on +# all Ceph mirrors over IPv4 and IPv6 to see if they are online +# +# Requires IPv4, IPv6, rsync and curl +# +# Example usage: +# - ./test-mirrors.sh eu.ceph.com,de.ceph.com,hk.ceph.com +# - cat MIRRORS |cut -d ':' -f 1|xargs -n 1 ./test-mirrors.sh +# + +function print_usage { + echo "Usage: $0 mirror1,mirror2,mirror3,mirror4,etc" +} + +function test_http { + HOST=$1 + + echo -n "$HOST HTTP IPv4: " + curl -s -I -4 -o /dev/null http://$HOST + if [ "$?" -ne 0 ]; then + echo "FAIL" + else + echo "OK" + fi + + echo -n "$HOST HTTP IPv6: " + curl -s -I -6 -o /dev/null http://$HOST + if [ "$?" -ne 0 ]; then + echo "FAIL" + else + echo "OK" + fi +} + +function test_rsync { + HOST=$1 + + echo -n "$HOST RSYNC IPv4: " + rsync -4 -avrqn ${HOST}::ceph /tmp 2>/dev/null + if [ "$?" -ne 0 ]; then + echo "FAIL" + else + echo "OK" + fi + + echo -n "$HOST RSYNC IPv6: " + rsync -6 -avrqn ${HOST}::ceph /tmp 2>/dev/null + if [ "$?" -ne 0 ]; then + echo "FAIL" + else + echo "OK" + fi +} + +MIRRORS=$1 + +if [ -z "$MIRRORS" ]; then + print_usage + exit 1 +fi + +IFS=', ' read -r -a array <<< "$MIRRORS" + +for MIRROR in "${array[@]}"; do + test_http $MIRROR + test_rsync $MIRROR +done -- cgit 1.2.3-korg