CLOUDSTACK-2639: Add flag for booting complete Don't execute any command before VR complete booting up process.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/07715b91 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/07715b91 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/07715b91 Branch: refs/heads/rbd-snap-clone Commit: 07715b91afd44c1ebc0a6977923a0de0f5c1b1ee Parents: 780b45e Author: Sheng Yang <[email protected]> Authored: Thu May 23 18:45:38 2013 -0700 Committer: Sheng Yang <[email protected]> Committed: Thu May 23 18:46:43 2013 -0700 ---------------------------------------------------------------------- .../debian/config/etc/init.d/cloud-early-config | 3 ++ patches/systemvm/debian/config/etc/rc.local | 3 ++ .../config/opt/cloud/bin/get_template_version.sh | 26 +++++++++++++++ 3 files changed, 32 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/07715b91/patches/systemvm/debian/config/etc/init.d/cloud-early-config ---------------------------------------------------------------------- diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-early-config b/patches/systemvm/debian/config/etc/init.d/cloud-early-config index d918670..ca3b970 100755 --- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config +++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config @@ -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 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/07715b91/patches/systemvm/debian/config/etc/rc.local ---------------------------------------------------------------------- diff --git a/patches/systemvm/debian/config/etc/rc.local b/patches/systemvm/debian/config/etc/rc.local index cb434a2..6119497 100755 --- a/patches/systemvm/debian/config/etc/rc.local +++ b/patches/systemvm/debian/config/etc/rc.local @@ -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" http://git-wip-us.apache.org/repos/asf/cloudstack/blob/07715b91/patches/systemvm/debian/config/opt/cloud/bin/get_template_version.sh ---------------------------------------------------------------------- diff --git a/patches/systemvm/debian/config/opt/cloud/bin/get_template_version.sh b/patches/systemvm/debian/config/opt/cloud/bin/get_template_version.sh index 298bc38..233ec98 100755 --- a/patches/systemvm/debian/config/opt/cloud/bin/get_template_version.sh +++ b/patches/systemvm/debian/config/opt/cloud/bin/get_template_version.sh @@ -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
