CLOUDSTACK-2639: Add flag for booting complete

Don't execute any command before VR complete booting up process.
This commit is contained in:
Sheng Yang 2013-05-23 18:45:38 -07:00
parent 780b45e245
commit 07715b91af
3 changed files with 32 additions and 0 deletions

View File

@ -33,6 +33,9 @@ PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
# Fix haproxy directory issue
mkdir -p /var/lib/haproxy
# Clear boot up flag, it would be created by rc.local after boot up done
rm /var/cache/cloud/boot_up_done
[ -x /sbin/ifup ] || exit 0
. /lib/lsb/init-functions

View File

@ -13,3 +13,6 @@ do
logger -t cloud "Stopping $svc"
service $svc stop
done
date > /var/cache/cloud/boot_up_done
logger -t cloud "Boot up process done"

View File

@ -16,5 +16,31 @@
# specific language governing permissions and limitations
# under the License.
# As the last command send to router before any rules operation, wait until boot up done
__TIMEOUT=60
__FLAGFILE=/var/cache/cloud/boot_up_done
done=0
for i in `seq 1 $(($__TIMEOUT * 10))`
do
if [ -e $__FLAGFILE ]
then
done=1
break
fi
sleep 0.1
if [ $((i % 10)) -eq 0 ]
then
logger -t cloud "Waiting for VM boot up done for one second"
fi
done
if [ -z $done ]
then
# declare we failed booting process
echo "Waited 60 seconds but boot up haven't been completed"
exit
fi
echo -n `cat /etc/cloudstack-release`'&'
cat /var/cache/cloud/cloud-scripts-signature