You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2016/04/21 23:52:06 UTC

jclouds-labs git commit: [JCLOUDS-1092] AzureComputeServiceAdapter.resumeNode waits for the node to start

Repository: jclouds-labs
Updated Branches:
  refs/heads/master 44ddd688f -> 76f90fc98


[JCLOUDS-1092] AzureComputeServiceAdapter.resumeNode waits for the node to start


Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/76f90fc9
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/76f90fc9
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/76f90fc9

Branch: refs/heads/master
Commit: 76f90fc98f469bdbab72f03b32b8ef707fd8c472
Parents: 44ddd68
Author: Ladislav Thon <lt...@redhat.com>
Authored: Tue Apr 12 12:39:20 2016 +0200
Committer: Ignasi Barrera <na...@apache.org>
Committed: Thu Apr 21 23:44:51 2016 +0200

----------------------------------------------------------------------
 .../compute/AzureComputeServiceAdapter.java        | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/76f90fc9/azurecompute/src/main/java/org/jclouds/azurecompute/compute/AzureComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/AzureComputeServiceAdapter.java b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/AzureComputeServiceAdapter.java
index ec605ea..ecf6c0d 100644
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/compute/AzureComputeServiceAdapter.java
+++ b/azurecompute/src/main/java/org/jclouds/azurecompute/compute/AzureComputeServiceAdapter.java
@@ -381,6 +381,23 @@ public class AzureComputeServiceAdapter implements ComputeServiceAdapter<Deploym
       if (cloudService != null) {
          logger.debug("Resuming %s ...", id);
          trackRequest(api.getVirtualMachineApiForDeploymentInService(id, cloudService.name()).start(id));
+
+         // it happens sometimes that even though the trackRequest call above returns successfully,
+         // the node is still in the process of starting and this.getNode(id) returns null
+         //
+         // this is a temporary workaround for JCLOUDS-1092 and should be removed once the issue is resolved properly
+         if (!retry(new Predicate<String>() {
+            @Override
+            public boolean apply(final String id) {
+               return getNode(id) != null;
+            }
+         }, azureComputeConstants.operationTimeout(), 1, SECONDS).apply(id)) {
+            final String message = generateIllegalStateExceptionMessage(
+                    "waiting for node to resume", "", azureComputeConstants.operationTimeout());
+            logger.warn(message);
+            throw new IllegalStateException(message);
+         }
+
          logger.debug("Resumed %s", id);
       }
    }