cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [2/4] git commit: updated refs/heads/master to e7638c0
Date Wed, 21 Oct 2015 21:16:20 GMT
CLOUDSTACK-8933 - Replace infinite loop by a for loop

   - The loop will also sleep in between iterations, waiting for a couple of seconds and being
multiplied by factor 2 per iteration


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/698171d2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/698171d2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/698171d2

Branch: refs/heads/master
Commit: 698171d210affcface5c38a88ca39fe8b4fc42a0
Parents: ac68f2a
Author: Wilder Rodrigues <wrodrigues@schubergphilis.com>
Authored: Wed Oct 21 09:58:35 2015 +0200
Committer: Wilder Rodrigues <wrodrigues@schubergphilis.com>
Committed: Wed Oct 21 11:10:37 2015 +0200

----------------------------------------------------------------------
 .../debian/config/etc/init.d/cloud-early-config | 38 +++++++++++---------
 1 file changed, 22 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/698171d2/systemvm/patches/debian/config/etc/init.d/cloud-early-config
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/etc/init.d/cloud-early-config b/systemvm/patches/debian/config/etc/init.d/cloud-early-config
index d25366e..6fbedff 100755
--- a/systemvm/patches/debian/config/etc/init.d/cloud-early-config
+++ b/systemvm/patches/debian/config/etc/init.d/cloud-early-config
@@ -117,25 +117,31 @@ get_boot_params() {
           if [ ! -e /dev/vport0p1 ]; then
             log_it "/dev/vport0p1 not loaded, perhaps guest kernel is too old." &&
exit 2
           fi
-	  while [ -z "$cmd" ]; do         
-            while read line; do
-              if [[ $line == cmdline:* ]]; then
-                cmd=${line//cmdline:/}
+
+	      local factor=2
+	      local progress=1
+		  for i in {1..5}
+		  do
+	        while read line; do
+	          if [[ $line == cmdline:* ]]; then
+	            cmd=${line//cmdline:/}
                 echo $cmd > /var/cache/cloud/cmdline
-              elif [[ $line == pubkey:* ]]; then
-                pubkey=${line//pubkey:/}
-                echo $pubkey > /var/cache/cloud/authorized_keys
-                echo $pubkey > /root/.ssh/authorized_keys
+	          elif [[ $line == pubkey:* ]]; then
+	            pubkey=${line//pubkey:/}
+	            echo $pubkey > /var/cache/cloud/authorized_keys
+	            echo $pubkey > /root/.ssh/authorized_keys
               fi
-            done < /dev/vport0p1
-            # In case of reboot we do not send the boot args again.
-            # so need not wait for them, as the boot args are already set at startup
-            if [ -s /var/cache/cloud/cmdline  ]
-            then
-                log_it "found a non empty cmdline file continuing"
-                break;
+	        done < /dev/vport0p1
+	        # In case of reboot we do not send the boot args again.
+	        # So, no need to wait for them, as the boot args are already set at startup
+	        if [ -s /var/cache/cloud/cmdline  ]
+	        then
+              log_it "Found a non empty cmdline file. Will now exit the loop and proceed
with configuration."
+              break;
             fi
-	 done
+            sleep ${progress}s
+            progress=$[ progress * factor ]
+		  done
           chmod go-rwx /root/.ssh/authorized_keys
           ;;
      vmware)


Mime
View raw message