vcloud related workaround where deploy task transitions to poweron

This commit is contained in:
Adrian Cole 2010-03-12 16:25:26 -08:00
parent c16b50be76
commit 2bddd8e70f
1 changed files with 15 additions and 3 deletions

View File

@ -31,6 +31,7 @@ import javax.inject.Singleton;
import org.jclouds.compute.domain.NodeState;
import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.http.HttpResponseException;
import org.jclouds.logging.Logger;
import org.jclouds.vcloud.VCloudClient;
import org.jclouds.vcloud.domain.Task;
@ -91,10 +92,21 @@ public class BaseVCloudComputeClient implements VCloudComputeClient {
logger.debug("<< deployed vApp(%s)", vAppResponse.getId());
logger.debug(">> powering vApp(%s)", vAppResponse.getId());
try {
task = client.powerOnVApp(vAppResponse.getId());
if (!taskTester.apply(task.getId())) {
throw new TaskException("powerOn", vAppResponse, task);
}
} catch (HttpResponseException e) {
if (e.getResponse().getStatusCode() == 400
&& client.getVApp(vAppResponse.getId()).getStatus() == VAppStatus.ON) {
// TODO temporary hack because some vcloud implementations automatically transition to
// powerOn from deploy
} else {
throw e;
}
}
logger.debug("<< on vApp(%s)", vAppResponse.getId());
Map<String, String> response = parseResponse(vAppResponse);