This repository has been archived by the owner on Jul 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #630 from markdryan/master
Single VM: Enable Ceph and script refactor
- Loading branch information
Showing
5 changed files
with
150 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
#!/bin/bash | ||
|
||
if [ -z "$HOSTS_FILE_BACKUP" ]; then | ||
echo "HOSTS_FILE_BACKUP" is not set. | ||
echo "Please run" | ||
echo "" | ||
echo ". ~/local/demo.sh" | ||
exit 1 | ||
if [ ! -z $1 ]; then | ||
hosts_file_backup=$1 | ||
else | ||
. ~/local/demo.sh | ||
hosts_file_backup=$HOSTS_FILE_BACKUP | ||
fi | ||
|
||
ciao_gobin="$GOPATH"/bin | ||
sudo killall ciao-scheduler | ||
sudo killall ciao-controller | ||
sudo killall ciao-launcher | ||
sleep 2 | ||
sudo "$ciao_gobin"/ciao-launcher --hard-reset | ||
sudo "$ciao_gobin"/ciao-launcher --alsologtostderr -v 3 --hard-reset | ||
sudo ip link del eth10 | ||
sudo pkill -F /tmp/dnsmasq.macvlan0.pid | ||
sudo mv $HOSTS_FILE_BACKUP /etc/hosts | ||
sudo mv $hosts_file_backup /etc/hosts | ||
sudo docker rm -f ceph-demo | ||
sudo rm /etc/ceph/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
#!/bin/bash | ||
|
||
ciao_bin="$HOME/local" | ||
ciao_gobin="$GOPATH"/bin | ||
|
||
# Read cluster env variables | ||
|
||
. $ciao_bin/demo.sh | ||
|
||
"$ciao_gobin"/ciao-cli workload list | ||
|
||
if [ $? -ne 0 ] | ||
then | ||
echo "FATAL ERROR: Unable to list workloads" | ||
cleanup | ||
exit 1 | ||
fi | ||
|
||
"$ciao_gobin"/ciao-cli instance add --workload=e35ed972-c46c-4aad-a1e7-ef103ae079a2 --instances=2 | ||
|
||
if [ $? -ne 0 ] | ||
then | ||
echo "FATAL ERROR: Unable to launch VMs" | ||
cleanup | ||
exit 1 | ||
fi | ||
|
||
"$ciao_gobin"/ciao-cli instance list | ||
|
||
if [ $? -ne 0 ] | ||
then | ||
echo "FATAL ERROR: Unable to list instances" | ||
cleanup | ||
exit 1 | ||
fi | ||
|
||
"$ciao_gobin"/ciao-cli instance add --workload=ab68111c-03a6-11e6-87de-001320fb6e31 --instances=2 | ||
|
||
if [ $? -ne 0 ] | ||
then | ||
echo "FATAL ERROR: Unable to launch containers" | ||
cleanup | ||
exit 1 | ||
fi | ||
|
||
sleep 5 | ||
|
||
"$ciao_gobin"/ciao-cli instance list | ||
if [ $? -ne 0 ] | ||
then | ||
echo "FATAL ERROR: Unable to list instances" | ||
cleanup | ||
exit 1 | ||
fi | ||
|
||
|
||
#Check SSH connectivity | ||
"$ciao_gobin"/ciao-cli instance list | ||
|
||
#The VM takes time to boot as you are running on two | ||
#layers of virtualization. Hence wait a bit | ||
retry=0 | ||
until [ $retry -ge 6 ] | ||
do | ||
ssh_ip=$("$ciao_gobin"/ciao-cli instance list --workload=e35ed972-c46c-4aad-a1e7-ef103ae079a2 --detail | grep "SSH IP:" | sed 's/^.*SSH IP: //' | head -1) | ||
|
||
if [ "$ssh_ip" == "" ] | ||
then | ||
echo "Waiting for instance to boot" | ||
let retry=retry+1 | ||
sleep 30 | ||
continue | ||
fi | ||
|
||
ssh_check=$(head -1 < /dev/tcp/"$ssh_ip"/33002) | ||
echo "$ssh_check" | ||
|
||
echo "Attempting to ssh to: $ssh_ip" | ||
|
||
if [[ "$ssh_check" == *SSH-2.0-OpenSSH* ]] | ||
then | ||
echo "SSH connectivity verified" | ||
break | ||
else | ||
let retry=retry+1 | ||
echo "Retrying ssh connection $retry" | ||
fi | ||
sleep 30 | ||
done | ||
|
||
if [ $retry -ge 6 ] | ||
then | ||
echo "Unable check ssh connectivity into VM" | ||
cleanup | ||
fi | ||
|
||
#Check docker networking | ||
echo "Checking Docker Networking" | ||
sleep 30 | ||
docker_id=$(sudo docker ps -q | head -1) | ||
sudo docker logs "$docker_id" | ||
|
||
|
||
#Now delete all instances | ||
"$ciao_gobin"/ciao-cli instance delete --all | ||
|
||
if [ $? -ne 0 ] | ||
then | ||
echo "FATAL ERROR: Unable to delete instances" | ||
exit 1 | ||
fi | ||
|
||
"$ciao_gobin"/ciao-cli instance list | ||
"$ciao_gobin"/ciao-cli instance delete --all |