Permalink
Browse files

enabled 'fakeregisteration' mode in euca_conf, added 'eucalyptus-clou…

…d' loader support into init scripts for cloud, walrus, sc
  • Loading branch information...
1 parent 5734cbd commit af7f9a937ab4b3ec939800254ccd9780c7b71411 root committed Aug 15, 2009
Showing with 91 additions and 87 deletions.
  1. +2 −0 tools/Makefile
  2. +26 −32 tools/euca_conf.in
  3. +9 −5 tools/eucalyptus-cloud.in
  4. +16 −21 tools/eucalyptus-sc.in
  5. +18 −14 tools/eucalyptus-walrus.in
  6. +20 −15 tools/eucalyptus.conf
View
@@ -24,6 +24,8 @@ install: deploy
@if test -e $(etcdir)/init.d/eucalyptus ; then \
mv $(etcdir)/init.d/eucalyptus $(etcdir)/init.d/eucalyptus.old ; fi
@$(INSTALL) -m 755 eucalyptus-cloud $(etcdir)/init.d
+ @$(INSTALL) -m 755 eucalyptus-walrus $(etcdir)/init.d
+ @$(INSTALL) -m 755 eucalyptus-sc $(etcdir)/init.d
@$(INSTALL) -m 755 eucalyptus-nc $(etcdir)/init.d
@$(INSTALL) -m 755 eucalyptus-cc $(etcdir)/init.d
@$(INSTALL) -m 644 httpd.conf $(etcdir)/eucalyptus
View
@@ -1,5 +1,6 @@
#!/bin/bash
#
+FAKEREG="yes"
FILE="@prefix@/etc/eucalyptus/eucalyptus.conf"
EUCALYPTUS=""
@@ -46,7 +47,7 @@ usage () {
echo " --deregister-cluster <name> remove cluster from EUCALYPTUS"
echo " --register-walrus <host> add walrus to EUCALYPTUS"
echo " --deregister-walrus <host> remove walrus to EUCALYPTUS"
- echo " --register-sc <host> add storage controller"
+ echo " --register-sc <name> <host> add storage controller"
echo " --deregister-sc <host> remove storage controller to EUCALYPTUS"
echo " --register-clc <host> point local walrus to CLC location"
echo " --sync used only with --register-* to sync keys"
@@ -134,15 +135,12 @@ sync_keys() {
if [ ${REMOTE} = "127.0.0.1" -o ${REMOTE} = localhost -o ${REMOTE} = "`hostname -s`" -o ${REMOTE} = "`hostname -f`" ]; then
# machine is localhost, not need for remote syncing
if [ -d "$SOURCEDIR" ]; then
- echo "FILES: $FILES"
for i in $FILES
do
- echo "FILE: $i"
if [ ! -e $i ]; then
echo "ERROR: cannot find cluster credentials."
exit 1
else
- echo "cp $i $DESTDIR"
if ! cp $i $DESTDIR ; then
echo "ERROR: cannot copy file (${i}) to destination (${DESTDIR})"
return 1
@@ -365,14 +363,15 @@ while [ $# -gt 0 ]; do
fi
if [ "$1" = "--deregister-sc" ]; then
SC_MODE="DEL"
- SC="$2"
+ SCNAME="$2"
shift; shift
continue
fi
if [ "$1" = "--register-sc" ]; then
SC_MODE="ADD"
- SC="$2"
- shift; shift
+ SCNAME="$2"
+ SCHOST="$3"
+ shift; shift; shift
continue
fi
if [ "$1" = "-addcluster" -o "$1" = "--register-cluster" ]; then
@@ -405,11 +404,6 @@ while [ $# -gt 0 ]; do
exit 1
done
-# some basic check
-#if [ "${FILE:0:1}" = "-" ]; then
-# usage
-# exit 1
-#fi
if [ -z "${FILE}" -o ! -f "${FILE}" ]; then
echo "$FILE is not a valid eucalyptus configuration file"
exit 1
@@ -698,19 +692,19 @@ createCloudURL () {
}
getSecretKey() {
- FIELD=`grep -i "CREATE .*TABLE USERS" ${DBDIR}/* | sed 's/,/\n/g' | awk '/[Uu][Ss][Ee][Rr]_[Ss][Ee][Cc][Rr][Ee][Tt][Kk][Ee][Yy]/ {print NR}'`
+ FIELD=`grep -i "CREATE .*TABLE AUTH_USERS" ${DBDIR}/*auth* | sed 's/,/\n/g' | awk '/[Uu][Ss][Ee][Rr]_[Ss][Ee][Cc][Rr][Ee][Tt][Kk][Ee][Yy]/ {print NR}'`
if [ "$FIELD" = "" ]; then
echo "ERROR: cannot locate entry in eucalyptus database, try logging in through the admin web interface"
export SKEY=""
return 1
fi
- SKEY=$(eval echo $(awk -v field=${FIELD} -F, '/INSERT INTO USERS.*admin/ {print $field}' ${DBDIR}/* | head -n 1))
+ SKEY=$(eval echo $(awk -v field=${FIELD} -F, '/INSERT INTO AUTH_USERS.*admin/ {print $field}' ${DBDIR}/*auth* | head -n 1))
return 0
}
checkLocalService() {
local SERVICE=""
-
+
if [ -z "$WGET" -o ! -x "$WGET" ]; then
echo "ERROR: wget is missing, cannot continue."
return 1
@@ -723,13 +717,13 @@ checkLocalService() {
elif [ "$SERVICE" = "CLC" ]; then
CMD="$WGET -T 10 -t 1 -O - -o /dev/null http://127.0.0.1:8773/services/|grep Eucalyptus > /dev/null"
elif [ "$SERVICE" = "CC" ]; then
- CMD="$WGET -T 10 -t 1 -O - -o /dev/null http://127.0.0.1:8443/axis2/services/|grep EucalyptusCC > /dev/null"
+ CMD="$WGET -T 10 -t 1 -O - -o /dev/null http://127.0.0.1:8774/axis2/services/ | grep EucalyptusCC > /dev/null"
fi
- if [ -n "${DRYRUN}" ]; then
- CMD="echo $CMD"
+ if [ -n "${FAKEREG}" ]; then
+ CMD="echo"
fi
- if ! $CMD ; then
+ if ! eval $CMD ; then
echo "ERROR: you need to be on the $SERVICE host and the $SERVICE needs to be running."
return 1
fi
@@ -738,7 +732,6 @@ checkLocalService() {
# adding a new cluster
if [ -n "$NEWCLUS" ]; then
-# DRYRUN="yes"
if ! checkLocalService "CLC" ; then
exit 1
fi
@@ -768,10 +761,10 @@ if [ -n "$NEWCLUS" ]; then
fi
CMD="wget -O - \"$URL\" 2>/dev/null | grep UP"
- if [ -n "${DRYRUN}" ]; then
- CMD="echo $CMD"
+ if [ -n "${FAKEREG}" ]; then
+ CMD="echo"
fi
- if ! $CMD ; then
+ if ! eval $CMD ; then
echo "ERROR: there is already a cluster registered with the system."
exit 1
fi
@@ -781,15 +774,15 @@ if [ -n "$NEWCLUS" ]; then
exit 1
fi
CMD="wget -O - \"$URL\" 2>/dev/null"
- if [ -n "${DRYRUN}" ]; then
- CMD="echo $CMD"
+ if [ -n "${FAKEREG}" ]; then
+ CMD="echo"
fi
- if ! $CMD ; then
+ if ! eval $CMD ; then
echo "ERROR: failed to register new cluster, please log in to the admin interface and check cluster status."
exit 1
fi
- if [ -n "${DRYRUN}" ]; then
+ if [ -n "${FAKEREG}" ]; then
mkdir -p $SOURCEDIR
openssl req -new -nodes -x509 -out $SOURCEDIR/cloud-cert.pem -keyout $SOURCEDIR/cloud-pk.pem -days 365 -subj "/C=US/ST=CA/L=City/CN=localhost/emailAddress=root@localhost"
openssl req -new -nodes -x509 -out $SOURCEDIR/cluster-cert.pem -keyout $SOURCEDIR/cluster-pk.pem -days 365 -subj "/C=US/ST=CA/L=City/CN=localhost/emailAddress=root@localhost"
@@ -815,27 +808,27 @@ fi
# walrus
if [ -n "$WALRUS" ]; then
- if ! checkLocalService "CLC"
+ if ! checkLocalService "CLC" ; then
exit 1
fi
if [ "$WALRUS_MODE" = "ADD" ]; then
# if ! sync_keys walrus_host files ; then
- echo "not implemented"
+ echo "Adding WALRUS host $WALRUS: not implemented"
elif [ "$WALRUS_MODE" = "DEL" ]; then
echo "not implemented"
fi
fi
# sc
-if [ -n "$SC" ]; then
- if ! checkLocalService "CLC"
+if [ -n "$SCHOST" ]; then
+ if ! checkLocalService "CLC" ; then
exit 1
fi
if [ "$SC_MODE" = "ADD" ]; then
# if ! sync_keys sc-host files-cert ; then
- echo "not implemented"
+ echo "Adding SC $SCHOST to cluster $SCNAME: not implemented"
elif [ "$SC_MODE" = "DEL" ]; then
echo "not implemented"
fi
@@ -880,6 +873,7 @@ if [ -n "$NODEMODE" ]; then
exit 1
fi
+ echo "$NODEMODE: $NODES: "
# CC needs to be running
if ! checkLocalService "CC" ; then
exit 1
View
@@ -24,8 +24,6 @@
export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
DESC="Eucalyptus cloud controller"
NAME=eucalyptus-cloud
-JAR_NAME="/usr/share/eucalyptus/eucalyptus-interface.jar"
-JAR_ALL_NAMES="/usr/share/eucalyptus/eucalyptus-interface.jar /usr/share/eucalyptus/eucalyptus-storagecontroller.jar /usr/share/eucalyptus/eucalyptus-storagemgr.jar"
ANT="`which ant 2> /dev/null`"
JAVA="`which java 2> /dev/null`"
EUCA_USER="eucalyptus"
@@ -54,6 +52,10 @@ if [ -z "$EUCALYPTUS" ] ; then
fi
fi
export EUCALYPTUS
+export EUCA_VERSION=`cat $EUCALYPTUS/etc/eucalyptus/eucalyptus-version`
+JAR_NAME="/usr/share/eucalyptus/eucalyptus-interface-${EUCA_VERSION}.jar"
+JAR_ALL_NAMES="/usr/share/eucalyptus/eucalyptus-interface-${EUCA_VERSION}.jar /usr/share/eucalyptus/eucalyptus-storagecontroller-${EUCA_VERSION}.jar /usr/share/eucalyptus/eucalyptus-storagemgr-${EUCA_VERSION}.jar"
+
# just a quick way to check if we have the package still installed: at
# times we can still have the init.d script
@@ -106,9 +108,10 @@ do_start() {
fi
cd $EUCALYPTUS/etc/eucalyptus
- (su -p $EUCA_USER -c "/bin/bash $ANT -f cloud.xml run" > $EUCALYPTUS/var/log/eucalyptus/cloud-output.log 2>&1) &
+# (su -p $EUCA_USER -c "/bin/bash $ANT -f cloud.xml run" > $EUCALYPTUS/var/log/eucalyptus/cloud-output.log 2>&1) &
+ $EUCALYPTUS/usr/sbin/eucalyptus-cloud -h $EUCALYPTUS -u $EUCA_USER --pidfile $EUCALYPTUS/var/run/eucalyptus/eucalyptus-cloud.pid -f -o $EUCALYPTUS/var/log/eucalyptus/cloud-output.log >/dev/null 2>&1
ret="$?"
- echo "$!" > $EUCALYPTUS/var/run/eucalyptus/eucalyptus-cloud.pid
+# echo "$!" > $EUCALYPTUS/var/run/eucalyptus/eucalyptus-cloud.pid
return $ret
}
@@ -131,7 +134,7 @@ do_status() {
do_stop() {
pidfile=$EUCALYPTUS/var/run/eucalyptus/eucalyptus-cloud.pid
-
+ echo $pidfile
# now kill the service
if [ -s "$pidfile" ]; then
pid=`cat $pidfile 2> /dev/null`
@@ -244,6 +247,7 @@ case "$1" in
# if we don't have the JAR file we are not running
if [ ! -e ${EUCALYPTUS}${JAR_NAME} ]; then
# service is not running
+ echo "service is not running ${EUCALYPTUS}${JAR_NAME}"
exit 0
fi
View
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Init script for the Eucalyptus storage controller services.
+# Init script for the Eucalyptus cloud manager services.
#
# chkconfig: 2345 99 05
# description: script for starting and stopping eucalyptus storage
@@ -9,7 +9,6 @@
### BEGIN INIT INFO
# Provides: eucalyptus-sc
# Required-Start: $remote_fs $syslog
-# Should-Start: eucalyptus-walrus
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@@ -23,10 +22,8 @@
# we need to source the current path in case of manual intallation
export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
-DESC="Eucalyptus storage controller"
-NAME=eucalyptus-storage
-JAR_NAME="/usr/share/eucalyptus/eucalyptus-storagecontroller.jar"
-JAR_ALL_NAMES="/usr/share/eucalyptus/eucalyptus-interface.jar /usr/share/eucalyptus/eucalyptus-storagecontroller.jar /usr/share/eucalyptus/eucalyptus-storagemgr.jar"
+DESC="Eucalyptus cloud controller"
+NAME=eucalyptus-cloud
ANT="`which ant 2> /dev/null`"
JAVA="`which java 2> /dev/null`"
EUCA_USER="eucalyptus"
@@ -55,6 +52,10 @@ if [ -z "$EUCALYPTUS" ] ; then
fi
fi
export EUCALYPTUS
+export EUCA_VERSION=`cat $EUCALYPTUS/etc/eucalyptus/eucalyptus-version`
+JAR_NAME="/usr/share/eucalyptus/eucalyptus-storagecontroller-${EUCA_VERSION}.jar"
+JAR_ALL_NAMES="/usr/share/eucalyptus/eucalyptus-interface-${EUCA_VERSION}.jar /usr/share/eucalyptus/eucalyptus-storagecontroller-${EUCA_VERSION}.jar /usr/share/eucalyptus/eucalyptus-storagemgr-${EUCA_VERSION}.jar"
+
# just a quick way to check if we have the package still installed: at
# times we can still have the init.d script
@@ -102,14 +103,15 @@ do_start() {
# basic checks
check_java
- if ! $EUCALYPTUS/usr/sbin/euca_conf -check sc ; then
+ if ! $EUCALYPTUS/usr/sbin/euca_conf -check cloud ; then
exit 1
fi
cd $EUCALYPTUS/etc/eucalyptus
- (su -p $EUCA_USER -c "/bin/bash $ANT -f cloud.xml run" > $EUCALYPTUS/var/log/eucalyptus/cloud-output.log 2>&1) &
+# (su -p $EUCA_USER -c "/bin/bash $ANT -f cloud.xml run" > $EUCALYPTUS/var/log/eucalyptus/cloud-output.log 2>&1) &
+ $EUCALYPTUS/usr/sbin/eucalyptus-cloud -h $EUCALYPTUS -u $EUCA_USER --pidfile $EUCALYPTUS/var/run/eucalyptus/eucalyptus-cloud.pid -f -o $EUCALYPTUS/var/log/eucalyptus/cloud-output.log >/dev/null 2>&1
ret="$?"
- echo "$!" > $EUCALYPTUS/var/run/eucalyptus/eucalyptus-cloud.pid
+# echo "$!" > $EUCALYPTUS/var/run/eucalyptus/eucalyptus-cloud.pid
return $ret
}
@@ -132,7 +134,7 @@ do_status() {
do_stop() {
pidfile=$EUCALYPTUS/var/run/eucalyptus/eucalyptus-cloud.pid
-
+ echo $pidfile
# now kill the service
if [ -s "$pidfile" ]; then
pid=`cat $pidfile 2> /dev/null`
@@ -142,7 +144,7 @@ do_stop() {
fi
# let's way few seconds than kill harder
- timeout=5
+ timeout=20
while [ $timeout -gt 0 ]; do
if ps $pid > /dev/null 2>&1 ; then
sleep 1
@@ -174,14 +176,6 @@ if [ -z "$EUCA_USER" ] ; then
EUCA_USER="root"
fi
-# let's see how many loop devices we have available
-LOOP_AVL="`/bin/ls /dev/loop* 2> /dev/null|wc -l`"
-if [ -z "$LOOP_AVL" -o "$LOOP_AVL" = "0" ]; then
- echo "Couldn't find loop devices (/dev/loop*): expect problems"
-elif [ $LOOP_AVL -lt 32 ]; then
- echo "You should have at least 32 loop devices"
-fi
-
# set the library path correctly
export LD_LIBRARY_PATH="$EUCALYPTUS/usr/lib/eucalyptus:$LD_LIBRARY_PATH"
@@ -198,7 +192,7 @@ case "$1" in
# let's check there is no previous cloud running
if do_status ; then
echo
- echo "another storage controller is already running!"
+ echo "another SC is already running!"
if [ "$VERBOSE" != no ]; then
if [ "$WE_HAVE_LSB" = "Y" ]; then
log_end_msg 1
@@ -253,6 +247,7 @@ case "$1" in
# if we don't have the JAR file we are not running
if [ ! -e ${EUCALYPTUS}${JAR_NAME} ]; then
# service is not running
+ echo "service is not running ${EUCALYPTUS}${JAR_NAME}"
exit 0
fi
@@ -305,7 +300,7 @@ case "$1" in
;;
status)
if do_status ; then
- echo "CLC is running"
+ echo "SC is running"
else
exit 3
fi
Oops, something went wrong.

0 comments on commit af7f9a9

Please sign in to comment.