[dsc~source-code-repository:5] Beta 2b (!) - added apache content + payloads + a couple of bugfixes

  • From: RobertHolt@kenai.com
  • To: commits@dsc.kenai.com
  • Subject: [dsc~source-code-repository:5] Beta 2b (!) - added apache content + payloads + a couple of bugfixes
  • Date: Wed, 3 Jun 2009 08:57:32 +0000

Project:    dsc
Repository: source-code-repository
Revision:   5
Author:     RobertHolt
Date:       2009-06-03 08:57:31 UTC
Link:       
http://kenai.com/projects/dsc/sources/source-code-repository/revision/5

Log Message:
------------

Beta 2b (!) - added apache content + payloads + a couple of bugfixes

Modified Paths:
---------------
dsc/dsc-global
dsc/dsc_control_inc.sh
dsc/dsc-refresh
dsc/dsc-local
dsc/dsc-integrity
dsc/dsc_include.sh


Added Paths:
------------
dsc/apache


Diffs:
------
Index: dsc/dsc-integrity
===================================================================
--- dsc/dsc-integrity   (revision 4)
+++ dsc/dsc-integrity   (revision 5)
@@ -57,11 +57,11 @@
 # (and going into maintainance mode)
 # when there is a problem like the registry being temporarily unavailable
 #
-#sleep 2
+sleep 2
 
 regloop
 #zonehostloop
-#SMFKeepAlive
+SMFKeepAlive
 
 }
 
Index: dsc/dsc_include.sh
===================================================================
--- dsc/dsc_include.sh  (revision 4)
+++ dsc/dsc_include.sh  (revision 5)
@@ -24,7 +24,7 @@
 #######################
 #
 # dsc_include.sh
-# 2.0
+# 1.2
 #
 #######################
 
@@ -38,7 +38,7 @@
 #
 regpassword=dsc
 reguser=dsc
-reghost=10.2.0.100
+reghost=10.2.0.1
 regdb=dsc
 #
 #
@@ -54,26 +54,22 @@
 vnictop=899
 #
 # network interfaces (I should probably automate this ..)
+# networks 
 #
-MNIC=nxge0
-SNIC1=nxge2
-SNIC2=nxge2
-#
-# network interfaces (I should probably automate this ..)
-# networks
-#
-MGATEWAY=10.2.0.100
-GATEWAY=10.1.0.100
+MGATEWAY=10.2.0.1
+GATEWAY=10.1.0.1
 NETMASK=255.255.0.0
 #
 # Local IP of this box - we need to find a better way to do this in the 
future
 # this could be way better ..  -- edit the 10.2. bit if you're not using 
10.1 and 10.2 networks
 #
-IP=10.2.0.100
 #IP="$( ifconfig -a |grep 10.2.  | awk '{print $2}' | head -n 1 )"
+IP=10.2.0.1
 #
-
 #
+MNIC=e1000g0
+SNIC1=e1000g2
+#SNIC2=e1000g2
 #
 # where is MySQL 
 #
@@ -99,15 +95,10 @@
 oktordate="$(svcs | grep time | wc -l)"
 
 myplatform="$(prtdiag |head -n 1|awk '{ print  $(NF-3), $(NF-2), $(NF-1), 
$NF }')"
-increatelimit=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb -sN -e 
"select value from cpolicy where policy='increation'  limit 1")
+increatelimit=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb -sN -e 
"select value from cpolicy where policy='increation'  limit 1") 
 zonecount=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb -sN -e 
"select numberofzones from hpolicy where type='$myplatform'  limit 1")
 
-#
-# Max delay before update / restart of this node -- useful if you have a 
large cloud and you do not want all nodes to restart at the same time -- i.e. 
you want different machines to update / reload / restart over time.
-# 1800 == half an hour (60*60*30 seconds)
-
 MaxRDelay=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb -sN -e 
"select value from cpolicy where policy='UpdateDelay'  limit 1")
 
-
 VNICS=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb -sN -e "select 
value from cpolicy where policy='VnicsOn'  limit 1")
 
Index: dsc/dsc-local
===================================================================
--- dsc/dsc-local       (revision 4)
+++ dsc/dsc-local       (revision 5)
@@ -49,7 +49,7 @@
 #
 regpassword=dsc
 reguser=dsc
-reghost=10.2.0.100
+reghost=10.2.0.1
 VLANS=true
 regdb=dsc
 zonedir=/dsc/zones
Index: dsc/dsc-refresh
===================================================================
--- dsc/dsc-refresh     (revision 4)
+++ dsc/dsc-refresh     (revision 5)
@@ -61,7 +61,7 @@
 #
 sleep 2
 Bigloop
-#SMFKeepAlive
+SMFKeepAlive
 
 }
 
Index: dsc/dsc-global
===================================================================
--- dsc/dsc-global      (revision 4)
+++ dsc/dsc-global      (revision 5)
@@ -71,6 +71,7 @@
 
 dsc_start()    {
    
+DidICrash
 RegisterGZ
 CleanUpOldZones
 CreateReferenceZone
@@ -79,6 +80,45 @@
 
 }
 
+DidICrash() {
+
+# Can I see the registry - if no shut down - dsc-control will try to reawake 
me.
+#
+# Is this zonehost flagged as suspect in the suspect table 
+# clean up the old zones without updating the service and IP tables (they 
will
+# self mend through dsc-integrity)
+# then start again from scratch - this time talking to the db :)
+#
+
+declare -i regalive
+regalive="$(ping $reghost 2 | wc -l)"
+
+#if [ "$regalive" -gt "1" ]; then
+#echo "can't see registry! "
+#
+# so I'm going to disable the service and exit 
+# -- dsc-control will try to bring it back to life every 60 seconds 
+#
+#sleep 20
+echo "disabling dsc-global and exiting  "
+#svcadm disable dsc-global
+#exit
+#fi

+SUSPECT=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb -sN -e 
"SELECT ip FROM suspect WHERE ip LIKE '$IP' LIMIT 1 ")
+
+if [  "$SUSPECT" !=  "" ]; then
+# destroy any existing zones without updating the registry
+DELETE=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb -sN -e 
"DELETE FROM suspect WHERE ip LIKE '$IP' ")
+
+echo "Looks like I crashed or left the network in the past -- destroying 
zones and cleaning up without updating the Registry .... will then restart 
...."
+# destroy all the guest zones
+
+DestroyTheGuestZones   
+fi  
+}
+
+
 RegisterGZ() {
 
 echo Starting ....
@@ -114,11 +154,9 @@
 #
 ZONETHERE="$(zoneadm list -p | grep z$z:)"
 if [  "$ZONETHERE" !=  "" -a "$ZLIP" != "" -a "$PAYLOAD" != "" ]; then
-        INCREATION=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb 
-sN -e "SELECT increation FROM sinstance W
-HERE GZipaddr LIKE '$IP' AND IPaddress LIKE '$ZLIP' LIMIT 1 ")
+        INCREATION=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb 
-sN -e "SELECT increation FROM sinstance WHERE GZipaddr LIKE '$IP' AND 
IPaddress LIKE '$ZLIP' LIMIT 1 ")
         if [  "$INCREATION" =  "yes" ]; then
-        RES=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb -sN -e 
"UPDATE service SET increation = service.i
-ncreation -1 WHERE location = '$PAYLOAD' AND  arch LIKE '$larch' ")
+        RES=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb -sN -e 
"UPDATE service SET increation = service.increation -1 WHERE location = 
'$PAYLOAD' AND  arch LIKE '$larch' ")
         else
         RES=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb -sN -e 
"UPDATE service SET currentinstances = ser
 vice.currentinstances -1 WHERE location = '$PAYLOAD' AND  arch LIKE '$larch' 
")
@@ -773,12 +811,45 @@
 kill -9 $gsleep
    
 
+# stop and destroy all those zones
 
+DestroyTheGuestZones   
+
    
+#
+# If I am the last person to stop make sure the Registry looks ok / is ok
+#
+hcount=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb -sN -e 
"select COUNT(*) from hinstance")
+echo $hcount
+if [  "$hcount" = "1" ]; then
+#make sure the db tables are clean
+clean=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb -sN -e "update 
service set currentinstances=0, increation=0 ")
+clean=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb -sN -e 
"truncate sinstance ")
+fi
+#echo $clean
+
+
+# DELETE globalhost IP entry from register
+RES=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb -sN -e "DELETE 
FROM hinstance where globalip = '$IP' ") 
+# UPDATE (remove) entries held for IPs for local zones in registry
+RES=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb -sN -e "UPDATE 
ipaddr  SET inuse=0, iphost='', zonename='' WHERE iphost = '$IP' ")
+
+echo "DELETED host instance entry and release zone IPaddr's in register"

+   
+echo "all done"
+   
+}
+
+DestroyTheGuestZones() {
+
+allzcount="$(zoneadm list -vc | wc -l )"
+gzcount=$[allzcount-3]
+
 # stop and destroy all those zones
-   
+  
    cd $zonedir
-   for z in `seq 1 $zonecount`;  do
+   for z in `seq 1 $gzcount`;  do
       zoneadm -z z$z halt &> /dev/null
    sleep 2
 if [  "$VNICS" == "true" ]; then
@@ -796,37 +867,15 @@
       zoneadm -z z$z uninstall -F &> /dev/null
       zonecfg -z z$z delete -F &> /dev/null
 #if [ ! -d $zonedir/$z ]; then
-#      rm -rf $zonedir/$z
+#       rm -rf $zonedir/$z
 #fi
 done
    echo "Stopped old zones"
-   
-  
-#
-# If I am the last person to stop make sure the Registry looks ok / is ok
-#
-hcount=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb -sN -e 
"select COUNT(*) from hinstance")
-echo $hcount
-if [  "$hcount" = "1" ]; then
-#make sure the db tables are clean
-clean=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb -sN -e "update 
service set currentinstances=0, increation=0 ")
-fi
-#echo $clean
 
+}
 
-# DELETE globalhost IP entry from register
-RES=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb -sN -e "DELETE 
FROM hinstance where globalip = '$IP' ") 
-# UPDATE (remove) entries held for IPs for local zones in registry
-RES=$($MYSQL -h$reghost -u$reguser -p$regpassword -D $regdb -sN -e "...



[dsc~source-code-repository:5] Beta 2b (!) - added apache content + payloads + a couple of bugfixes

RobertHolt 06/03/2009
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close