You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ud...@apache.org on 2014/06/05 07:38:03 UTC

git commit: waiting 5 seconds till volumes actually get attached.

Repository: stratos
Updated Branches:
  refs/heads/master 50e2d29f5 -> 4339b62ab


waiting 5 seconds till volumes actually get attached.

Eventhough the status of the volume became IN USE, the volume may not be attached actually. Then there is a possibility that next device may attach to the device for previous volumes's device.


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/4339b62a
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/4339b62a
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/4339b62a

Branch: refs/heads/master
Commit: 4339b62abcdc94001b4c3e72dc8f06ac1c454526
Parents: 50e2d29
Author: Udara Liyanage <ud...@wso2.com>
Authored: Thu Jun 5 10:46:13 2014 +0530
Committer: Udara Liyanage <ud...@wso2.com>
Committed: Thu Jun 5 11:07:34 2014 +0530

----------------------------------------------------------------------
 .../cloud/controller/iaases/OpenstackNovaIaas.java     | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/4339b62a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/OpenstackNovaIaas.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/OpenstackNovaIaas.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/OpenstackNovaIaas.java
index b4f9c92..b4b31d5 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/OpenstackNovaIaas.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/OpenstackNovaIaas.java
@@ -578,8 +578,8 @@ public class OpenstackNovaIaas extends Iaas {
 	}
 
     private boolean waitForStatus(String volumeId, Volume.Status expectedStatus, int timeoutInMins) throws TimeoutException {
-        long timeout = 1000 * 60 * timeoutInMins;//5mins
-        long t0 = System.currentTimeMillis() + timeout;
+        long timeout = 1000 * 60 * timeoutInMins;
+        long timout = System.currentTimeMillis() + timeout;
 
         IaasProvider iaasInfo = getIaasProvider();
         String region = ComputeServiceBuilderUtil.extractRegion(iaasInfo);
@@ -600,7 +600,7 @@ public class OpenstackNovaIaas extends Iaas {
                 }
                 Thread.sleep(1000);
                 volumeStatus = this.getVolumeStatus(volumeApi, volumeId);
-                if (System.currentTimeMillis()> t0) {
+                if (System.currentTimeMillis()> timout) {
                     throw new TimeoutException();
                 }
             } catch (InterruptedException e) {
@@ -668,6 +668,13 @@ public class OpenstackNovaIaas extends Iaas {
                 log.error("[Volume ID] " + volumeId + "did not become IN_USE within expected timeout");
             }
         }
+        try {
+            // waiting 5seconds till volumes are actually attached.
+            Thread.sleep(5000);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+
         if (attachment == null) {
 			log.fatal(String.format("Volume [id]: %s attachment for instance [id]: %s was unsuccessful. [region] : %s of Iaas : %s", volumeId, instanceId, region, iaasInfo));
 			return null;