regressions for beta-7

This commit is contained in:
Adrian Cole 2010-09-19 19:12:44 -07:00
parent 1b113808d4
commit 1981b15837
17 changed files with 115 additions and 50 deletions

View File

@ -127,6 +127,14 @@
<name>test.initializer</name> <name>test.initializer</name>
<value>${test.initializer}</value> <value>${test.initializer}</value>
</property> </property>
<property>
<name>jclouds.blobstore.httpstream.url</name>
<value>${jclouds.blobstore.httpstream.url}</value>
</property>
<property>
<name>jclouds.blobstore.httpstream.md5</name>
<value>${jclouds.blobstore.httpstream.md5}</value>
</property>
</systemProperties> </systemProperties>
</configuration> </configuration>
</execution> </execution>

View File

@ -43,12 +43,13 @@ import org.jclouds.aws.ec2.domain.KeyPair;
import org.jclouds.aws.ec2.domain.PlacementGroup; import org.jclouds.aws.ec2.domain.PlacementGroup;
import org.jclouds.aws.ec2.domain.PlacementGroup.State; import org.jclouds.aws.ec2.domain.PlacementGroup.State;
import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.TemplateBuilder; import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.internal.BaseComputeService; import org.jclouds.compute.internal.BaseComputeService;
import org.jclouds.compute.options.TemplateOptions; import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
import org.jclouds.compute.strategy.DestroyNodeStrategy; import org.jclouds.compute.strategy.DestroyNodeStrategy;
import org.jclouds.compute.strategy.GetNodeMetadataStrategy; import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
import org.jclouds.compute.strategy.ListNodesStrategy; import org.jclouds.compute.strategy.ListNodesStrategy;
@ -81,14 +82,14 @@ public class EC2ComputeService extends BaseComputeService {
DestroyNodeStrategy destroyNodeStrategy, Provider<TemplateBuilder> templateBuilderProvider, DestroyNodeStrategy destroyNodeStrategy, Provider<TemplateBuilder> templateBuilderProvider,
Provider<TemplateOptions> templateOptionsProvider, Provider<TemplateOptions> templateOptionsProvider,
@Named("NODE_RUNNING") Predicate<NodeMetadata> nodeRunning, @Named("NODE_RUNNING") Predicate<NodeMetadata> nodeRunning,
@Named("NODE_TERMINATED") Predicate<NodeMetadata> nodeTerminated, ComputeUtils utils, @Named("NODE_TERMINATED") Predicate<NodeMetadata> nodeTerminated, ComputeUtils utils, Timeouts timeouts,
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor, EC2Client ec2Client, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor, EC2Client ec2Client,
Map<RegionAndName, KeyPair> credentialsMap, @Named("SECURITY") Map<RegionAndName, String> securityGroupMap, Map<RegionAndName, KeyPair> credentialsMap, @Named("SECURITY") Map<RegionAndName, String> securityGroupMap,
@Named("PLACEMENT") Map<RegionAndName, String> placementGroupMap, @Named("PLACEMENT") Map<RegionAndName, String> placementGroupMap,
@Named("DELETED") Predicate<PlacementGroup> placementGroupDeleted) { @Named("DELETED") Predicate<PlacementGroup> placementGroupDeleted) {
super(context, images, sizes, locations, listNodesStrategy, getNodeMetadataStrategy, runNodesAndAddToSetStrategy, super(context, images, sizes, locations, listNodesStrategy, getNodeMetadataStrategy, runNodesAndAddToSetStrategy,
rebootNodeStrategy, destroyNodeStrategy, templateBuilderProvider, templateOptionsProvider, nodeRunning, rebootNodeStrategy, destroyNodeStrategy, templateBuilderProvider, templateOptionsProvider, nodeRunning,
nodeTerminated, utils, executor); nodeTerminated, utils, timeouts, executor);
this.ec2Client = ec2Client; this.ec2Client = ec2Client;
this.credentialsMap = credentialsMap; this.credentialsMap = credentialsMap;
this.securityGroupMap = securityGroupMap; this.securityGroupMap = securityGroupMap;

View File

@ -271,6 +271,14 @@
<name>test.initializer</name> <name>test.initializer</name>
<value>${test.initializer}</value> <value>${test.initializer}</value>
</property> </property>
<property>
<name>jclouds.blobstore.httpstream.url</name>
<value>${jclouds.blobstore.httpstream.url}</value>
</property>
<property>
<name>jclouds.blobstore.httpstream.md5</name>
<value>${jclouds.blobstore.httpstream.md5}</value>
</property>
</systemProperties> </systemProperties>
</configuration> </configuration>
</execution> </execution>

View File

@ -140,6 +140,14 @@
<name>test.initializer</name> <name>test.initializer</name>
<value>${test.initializer}</value> <value>${test.initializer}</value>
</property> </property>
<property>
<name>jclouds.blobstore.httpstream.url</name>
<value>${jclouds.blobstore.httpstream.url}</value>
</property>
<property>
<name>jclouds.blobstore.httpstream.md5</name>
<value>${jclouds.blobstore.httpstream.md5}</value>
</property>
</systemProperties> </systemProperties>
</configuration> </configuration>
</execution> </execution>

View File

@ -73,7 +73,7 @@ public class AzureBlobClientLiveTest {
private String containerPrefix = System.getProperty("user.name") + "-azureblob"; private String containerPrefix = System.getProperty("user.name") + "-azureblob";
private BlobStoreContext context; private BlobStoreContext context;
protected String provider = "azurequeue"; protected String provider = "azureblob";
protected String identity; protected String identity;
protected String credential; protected String credential;
protected String endpoint; protected String endpoint;

View File

@ -127,7 +127,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
public Void apply(Blob from) { public Void apply(Blob from) {
try { try {
assertEquals(CryptoStreams.md5(from.getPayload()), oneHundredOneConstitutionsMD5); assertEquals(CryptoStreams.md5(from.getPayload()), oneHundredOneConstitutionsMD5);
checkContentDispostion(from, expectedContentDisposition); checkContentDisposition(from, expectedContentDisposition);
} catch (IOException e) { } catch (IOException e) {
Throwables.propagate(e); Throwables.propagate(e);
} }
@ -156,16 +156,6 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
context.getBlobStore().putBlob(containerName, sourceObject); context.getBlobStore().putBlob(containerName, sourceObject);
} }
/**
* Methods for checking Content-Disposition. In this way, in implementations that do not support
* the new field, it is easy to override with empty, and allow the rest of the test to work.
*
* @param blob
* @param expected
*/
protected void checkContentDispostion(Blob blob, String expected) {
assertEquals(blob.getPayload().getContentMetadata().getContentDisposition(), expected);
}
@Test(groups = { "integration", "live" }) @Test(groups = { "integration", "live" })
public void testGetIfModifiedSince() throws InterruptedException { public void testGetIfModifiedSince() throws InterruptedException {

View File

@ -30,6 +30,8 @@ import java.util.Set;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -45,15 +47,16 @@ import org.jclouds.compute.RunNodesException;
import org.jclouds.compute.RunScriptOnNodesException; import org.jclouds.compute.RunScriptOnNodesException;
import org.jclouds.compute.callables.RunScriptOnNode; import org.jclouds.compute.callables.RunScriptOnNode;
import org.jclouds.compute.domain.ComputeMetadata; import org.jclouds.compute.domain.ComputeMetadata;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.Template;
import org.jclouds.compute.domain.TemplateBuilder; import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.options.RunScriptOptions; import org.jclouds.compute.options.RunScriptOptions;
import org.jclouds.compute.options.TemplateOptions; import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.compute.predicates.NodePredicates; import org.jclouds.compute.predicates.NodePredicates;
import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
import org.jclouds.compute.strategy.DestroyNodeStrategy; import org.jclouds.compute.strategy.DestroyNodeStrategy;
import org.jclouds.compute.strategy.GetNodeMetadataStrategy; import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
import org.jclouds.compute.strategy.ListNodesStrategy; import org.jclouds.compute.strategy.ListNodesStrategy;
@ -63,6 +66,7 @@ import org.jclouds.compute.util.ComputeUtils;
import org.jclouds.domain.Location; import org.jclouds.domain.Location;
import org.jclouds.io.Payload; import org.jclouds.io.Payload;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.ssh.ExecResponse; import org.jclouds.ssh.ExecResponse;
import org.jclouds.ssh.SshClient; import org.jclouds.ssh.SshClient;
@ -100,6 +104,7 @@ public class BaseComputeService implements ComputeService {
protected final Predicate<NodeMetadata> nodeRunning; protected final Predicate<NodeMetadata> nodeRunning;
protected final Predicate<NodeMetadata> nodeTerminated; protected final Predicate<NodeMetadata> nodeTerminated;
protected final ComputeUtils utils; protected final ComputeUtils utils;
protected final Timeouts timeouts;
protected final ExecutorService executor; protected final ExecutorService executor;
@Inject @Inject
@ -110,7 +115,7 @@ public class BaseComputeService implements ComputeService {
DestroyNodeStrategy destroyNodeStrategy, Provider<TemplateBuilder> templateBuilderProvider, DestroyNodeStrategy destroyNodeStrategy, Provider<TemplateBuilder> templateBuilderProvider,
Provider<TemplateOptions> templateOptionsProvider, Provider<TemplateOptions> templateOptionsProvider,
@Named("NODE_RUNNING") Predicate<NodeMetadata> nodeRunning, @Named("NODE_RUNNING") Predicate<NodeMetadata> nodeRunning,
@Named("NODE_TERMINATED") Predicate<NodeMetadata> nodeTerminated, ComputeUtils utils, @Named("NODE_TERMINATED") Predicate<NodeMetadata> nodeTerminated, ComputeUtils utils, Timeouts timeouts,
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) { @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
this.context = checkNotNull(context, "context"); this.context = checkNotNull(context, "context");
this.images = checkNotNull(images, "images"); this.images = checkNotNull(images, "images");
@ -126,6 +131,7 @@ public class BaseComputeService implements ComputeService {
this.nodeRunning = checkNotNull(nodeRunning, "nodeRunning"); this.nodeRunning = checkNotNull(nodeRunning, "nodeRunning");
this.nodeTerminated = checkNotNull(nodeTerminated, "nodeTerminated"); this.nodeTerminated = checkNotNull(nodeTerminated, "nodeTerminated");
this.utils = checkNotNull(utils, "utils"); this.utils = checkNotNull(utils, "utils");
this.timeouts = checkNotNull(timeouts, "timeouts");
this.executor = checkNotNull(executor, "executor"); this.executor = checkNotNull(executor, "executor");
} }
@ -145,9 +151,9 @@ public class BaseComputeService implements ComputeService {
throws RunNodesException { throws RunNodesException {
checkArgument(tag.indexOf('-') == -1, "tag cannot contain hyphens"); checkArgument(tag.indexOf('-') == -1, "tag cannot contain hyphens");
checkNotNull(template.getLocation(), "location"); checkNotNull(template.getLocation(), "location");
logger.debug(">> running %d node%s tag(%s) location(%s) image(%s) hardwareProfile(%s) options(%s)", count, count > 1 ? "s" logger.debug(">> running %d node%s tag(%s) location(%s) image(%s) hardwareProfile(%s) options(%s)", count,
: "", tag, template.getLocation().getId(), template.getImage().getId(), template.getHardware().getId(), count > 1 ? "s" : "", tag, template.getLocation().getId(), template.getImage().getId(), template
template.getOptions()); .getHardware().getId(), template.getOptions());
Set<NodeMetadata> nodes = Sets.newHashSet(); Set<NodeMetadata> nodes = Sets.newHashSet();
Map<NodeMetadata, Exception> badNodes = Maps.newLinkedHashMap(); Map<NodeMetadata, Exception> badNodes = Maps.newLinkedHashMap();
Map<?, Future<Void>> responses = runNodesAndAddToSetStrategy.execute(tag, count, template, nodes, badNodes); Map<?, Future<Void>> responses = runNodesAndAddToSetStrategy.execute(tag, count, template, nodes, badNodes);
@ -179,11 +185,27 @@ public class BaseComputeService implements ComputeService {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void destroyNode(String id) { public void destroyNode(final String id) {
checkNotNull(id, "id"); checkNotNull(id, "id");
logger.debug(">> destroying node(%s)", id); logger.debug(">> destroying node(%s)", id);
NodeMetadata node = destroyNodeStrategy.execute(id); final AtomicReference<NodeMetadata> node = new AtomicReference<NodeMetadata>();
boolean successful = node == null ? true : nodeTerminated.apply(node); RetryablePredicate<String> tester = new RetryablePredicate<String>(new Predicate<String>() {
@Override
public boolean apply(String input) {
try {
NodeMetadata md = destroyNodeStrategy.execute(id);
if (md != null)
node.set(md);
return true;
} catch (IllegalStateException e) {
logger.warn("<< illegal state destroying node(%s)", id);
return false;
}
}
}, timeouts.nodeRunning, 1000, TimeUnit.MILLISECONDS);
boolean successful = tester.apply(id) && (node.get() == null || nodeTerminated.apply(node.get()));
logger.debug("<< destroyed node(%s) success(%s)", id, successful); logger.debug("<< destroyed node(%s) success(%s)", id, successful);
} }

View File

@ -43,7 +43,7 @@ public interface ComputeServiceConstants {
public static final String PROPERTY_BLACKLIST_NODES = "jclouds.compute.blacklist.nodes"; public static final String PROPERTY_BLACKLIST_NODES = "jclouds.compute.blacklist.nodes";
@Singleton @Singleton
static class Timeouts { public static class Timeouts {
@Inject(optional = true) @Inject(optional = true)
@Named(PROPERTY_TIMEOUT_NODE_TERMINATED) @Named(PROPERTY_TIMEOUT_NODE_TERMINATED)
public long nodeTerminated = 30 * 1000; public long nodeTerminated = 30 * 1000;

View File

@ -170,9 +170,8 @@ public abstract class BaseComputeServiceLiveTest {
protected void setupCredentials() { protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity"); identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = System.getProperty("test." + provider + ".credential"); credential = System.getProperty("test." + provider + ".credential");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint"); endpoint = System.getProperty("test." + provider + ".endpoint");
apiversion = checkNotNull(System.getProperty("test." + provider + ".apiversion"), "test." + provider apiversion = System.getProperty("test." + provider + ".apiversion");
+ ".apiversion");
} }
protected Properties setupProperties() { protected Properties setupProperties() {

View File

@ -45,6 +45,7 @@ import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import com.google.inject.ProvisionException;
/** /**
* Generates RESTful clients from appropriately annotated interfaces. * Generates RESTful clients from appropriately annotated interfaces.
@ -56,7 +57,7 @@ public class SyncProxy implements InvocationHandler {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <T> T proxy(Class<T> clazz, SyncProxy proxy) throws IllegalArgumentException, SecurityException, public static <T> T proxy(Class<T> clazz, SyncProxy proxy) throws IllegalArgumentException, SecurityException,
NoSuchMethodException { NoSuchMethodException {
return (T) Proxy.newProxyInstance(clazz.getClassLoader(), new Class<?>[] { clazz }, proxy); return (T) Proxy.newProxyInstance(clazz.getClassLoader(), new Class<?>[] { clazz }, proxy);
} }
@ -71,8 +72,8 @@ public class SyncProxy implements InvocationHandler {
@Inject @Inject
public SyncProxy(Class<?> declaring, Object async, public SyncProxy(Class<?> declaring, Object async,
@Named("sync") ConcurrentMap<ClassMethodArgs, Object> delegateMap, Map<Class<?>, Class<?>> sync2Async) @Named("sync") ConcurrentMap<ClassMethodArgs, Object> delegateMap, Map<Class<?>, Class<?>> sync2Async)
throws SecurityException, NoSuchMethodException { throws SecurityException, NoSuchMethodException {
this.delegateMap = delegateMap; this.delegateMap = delegateMap;
this.delegate = async; this.delegate = async;
this.declaring = declaring; this.declaring = declaring;
@ -91,7 +92,7 @@ public class SyncProxy implements InvocationHandler {
Method delegatedMethod = delegate.getClass().getMethod(method.getName(), method.getParameterTypes()); Method delegatedMethod = delegate.getClass().getMethod(method.getName(), method.getParameterTypes());
if (!Arrays.equals(delegatedMethod.getExceptionTypes(), method.getExceptionTypes())) if (!Arrays.equals(delegatedMethod.getExceptionTypes(), method.getExceptionTypes()))
throw new IllegalArgumentException(String.format( throw new IllegalArgumentException(String.format(
"method %s has different typed exceptions than delegated method %s", method, delegatedMethod)); "method %s has different typed exceptions than delegated method %s", method, delegatedMethod));
if (delegatedMethod.getReturnType().isAssignableFrom(ListenableFuture.class)) { if (delegatedMethod.getReturnType().isAssignableFrom(ListenableFuture.class)) {
if (method.isAnnotationPresent(Timeout.class)) { if (method.isAnnotationPresent(Timeout.class)) {
Timeout methodTimeout = method.getAnnotation(Timeout.class); Timeout methodTimeout = method.getAnnotation(Timeout.class);
@ -123,7 +124,7 @@ public class SyncProxy implements InvocationHandler {
} else if (method.isAnnotationPresent(Delegate.class)) { } else if (method.isAnnotationPresent(Delegate.class)) {
Class<?> asyncClass = sync2Async.get(method.getReturnType()); Class<?> asyncClass = sync2Async.get(method.getReturnType());
checkState(asyncClass != null, "please configure corresponding async class for " + method.getReturnType() checkState(asyncClass != null, "please configure corresponding async class for " + method.getReturnType()
+ " in your RestClientModule"); + " in your RestClientModule");
Object returnVal = delegateMap.get(new ClassMethodArgs(asyncClass, method, args)); Object returnVal = delegateMap.get(new ClassMethodArgs(asyncClass, method, args));
return returnVal; return returnVal;
} else if (syncMethodMap.containsKey(method)) { } else if (syncMethodMap.containsKey(method)) {
@ -131,7 +132,9 @@ public class SyncProxy implements InvocationHandler {
} else { } else {
try { try {
return ((ListenableFuture<?>) methodMap.get(method).invoke(delegate, args)).get(timeoutMap.get(method), return ((ListenableFuture<?>) methodMap.get(method).invoke(delegate, args)).get(timeoutMap.get(method),
TimeUnit.NANOSECONDS); TimeUnit.NANOSECONDS);
} catch (ProvisionException e) {
throw throwTypedExceptionOrCause(method.getExceptionTypes(), e);
} catch (ExecutionException e) { } catch (ExecutionException e) {
throw throwTypedExceptionOrCause(method.getExceptionTypes(), e); throw throwTypedExceptionOrCause(method.getExceptionTypes(), e);
} catch (Exception e) { } catch (Exception e) {

View File

@ -40,8 +40,10 @@ import org.jclouds.http.HttpResponse;
import org.jclouds.http.TransformingHttpCommand; import org.jclouds.http.TransformingHttpCommand;
import org.jclouds.internal.ClassMethodArgs; import org.jclouds.internal.ClassMethodArgs;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import org.jclouds.rest.AuthorizationException;
import org.jclouds.rest.InvocationContext; import org.jclouds.rest.InvocationContext;
import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.Delegate;
import org.jclouds.util.Utils;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.Futures;
@ -117,6 +119,9 @@ public class AsyncRestClientProxy<T> implements InvocationHandler {
((InvocationContext) exceptionParser).setContext((GeneratedHttpRequest<T>) request); ((InvocationContext) exceptionParser).setContext((GeneratedHttpRequest<T>) request);
} }
} catch (RuntimeException e) { } catch (RuntimeException e) {
AuthorizationException aex = Utils.getFirstThrowableOfType(e, AuthorizationException.class);
if (aex != null)
e = aex;
if (exceptionParser != null) { if (exceptionParser != null) {
try { try {
return Futures.immediateFuture(exceptionParser.apply(e)); return Futures.immediateFuture(exceptionParser.apply(e));

View File

@ -158,6 +158,14 @@
<name>test.initializer</name> <name>test.initializer</name>
<value>${test.initializer}</value> <value>${test.initializer}</value>
</property> </property>
<property>
<name>jclouds.blobstore.httpstream.url</name>
<value>${jclouds.blobstore.httpstream.url}</value>
</property>
<property>
<name>jclouds.blobstore.httpstream.md5</name>
<value>${jclouds.blobstore.httpstream.md5}</value>
</property>
</systemProperties> </systemProperties>
</configuration> </configuration>
</execution> </execution>

View File

@ -71,8 +71,10 @@ public class ParseCloudServersErrorFromHttpResponse implements HttpErrorHandler
break; break;
case 409: case 409:
exception = new IllegalStateException(content); exception = new IllegalStateException(content);
break;
default: default:
exception = new HttpResponseException(command, response, content); exception = new HttpResponseException(command, response, content);
break;
} }
} finally { } finally {
releasePayload(response); releasePayload(response);

View File

@ -73,7 +73,7 @@ public class RackspaceAuthenticationLiveTest {
authentication.authenticate("foo", "bar").get(10, TimeUnit.SECONDS); authentication.authenticate("foo", "bar").get(10, TimeUnit.SECONDS);
} }
protected String provider = "rackspace"; protected String provider = "cloudservers";
protected String identity; protected String identity;
protected String credential; protected String credential;
protected String endpoint; protected String endpoint;

View File

@ -47,6 +47,10 @@ public interface VCloudError {
* A conflict was detected between sections of an OVF descriptor. * A conflict was detected between sections of an OVF descriptor.
*/ */
CONFLICT, CONFLICT,
/**
* The entity is busy
*/
BUSY_ENTITY,
/** /**
* An attempt to instantiate a vAppTemplate or use a vAppTemplate or a Vm in a composition did * An attempt to instantiate a vAppTemplate or use a vAppTemplate or a Vm in a composition did
* not include an AllEULAsAccepted element with a value of true. * not include an AllEULAsAccepted element with a value of true.

View File

@ -41,6 +41,7 @@ import org.jclouds.util.Utils;
import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.VCloudMediaType;
import org.jclouds.vcloud.VCloudResponseException; import org.jclouds.vcloud.VCloudResponseException;
import org.jclouds.vcloud.domain.VCloudError; import org.jclouds.vcloud.domain.VCloudError;
import org.jclouds.vcloud.domain.VCloudError.MinorCode;
import org.jclouds.vcloud.util.VCloudUtils; import org.jclouds.vcloud.util.VCloudUtils;
/** /**
@ -87,7 +88,12 @@ public class ParseVCloudErrorFromHttpResponse implements HttpErrorHandler {
switch (response.getStatusCode()) { switch (response.getStatusCode()) {
case 400: case 400:
exception = new IllegalArgumentException(message, exception); if (error != null && error.getMinorErrorCode() != null
&& error.getMinorErrorCode() == MinorCode.BUSY_ENTITY)
exception = new IllegalStateException(message, exception);
else
exception = new IllegalArgumentException(message, exception);
break;
case 401: case 401:
case 403: case 403:
exception = new AuthorizationException(command.getRequest(), message); exception = new AuthorizationException(command.getRequest(), message);

View File

@ -30,12 +30,13 @@ import javax.inject.Singleton;
import org.jclouds.Constants; import org.jclouds.Constants;
import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.TemplateBuilder; import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.internal.BaseComputeService; import org.jclouds.compute.internal.BaseComputeService;
import org.jclouds.compute.options.TemplateOptions; import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
import org.jclouds.compute.strategy.DestroyNodeStrategy; import org.jclouds.compute.strategy.DestroyNodeStrategy;
import org.jclouds.compute.strategy.GetNodeMetadataStrategy; import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
import org.jclouds.compute.strategy.ListNodesStrategy; import org.jclouds.compute.strategy.ListNodesStrategy;
@ -61,23 +62,24 @@ public class TerremarkVCloudComputeService extends BaseComputeService {
@Inject @Inject
protected TerremarkVCloudComputeService(ComputeServiceContext context, Supplier<Set<? extends Image>> images, protected TerremarkVCloudComputeService(ComputeServiceContext context, Supplier<Set<? extends Image>> images,
Supplier<Set<? extends Hardware>> sizes, Supplier<Set<? extends Location>> locations, Supplier<Set<? extends Hardware>> sizes, Supplier<Set<? extends Location>> locations,
ListNodesStrategy listNodesStrategy, GetNodeMetadataStrategy getNodeMetadataStrategy, ListNodesStrategy listNodesStrategy, GetNodeMetadataStrategy getNodeMetadataStrategy,
RunNodesAndAddToSetStrategy runNodesAndAddToSetStrategy, RebootNodeStrategy rebootNodeStrategy, RunNodesAndAddToSetStrategy runNodesAndAddToSetStrategy, RebootNodeStrategy rebootNodeStrategy,
DestroyNodeStrategy destroyNodeStrategy, Provider<TemplateBuilder> templateBuilderProvider, DestroyNodeStrategy destroyNodeStrategy, Provider<TemplateBuilder> templateBuilderProvider,
Provider<TemplateOptions> templateOptionsProvider, @Named("NODE_RUNNING") Predicate<NodeMetadata> nodeRunning, Provider<TemplateOptions> templateOptionsProvider,
@Named("NODE_TERMINATED") Predicate<NodeMetadata> nodeTerminated, ComputeUtils utils, @Named("NODE_RUNNING") Predicate<NodeMetadata> nodeRunning,
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor, CleanupOrphanKeys cleanupOrphanKeys, @Named("NODE_TERMINATED") Predicate<NodeMetadata> nodeTerminated, ComputeUtils utils, Timeouts timeouts,
ConcurrentMap<OrgAndName, KeyPairCredentials> credentialsMap, NodeMetadataToOrgAndName nodeToOrgAndName) { @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor, CleanupOrphanKeys cleanupOrphanKeys,
ConcurrentMap<OrgAndName, KeyPairCredentials> credentialsMap, NodeMetadataToOrgAndName nodeToOrgAndName) {
super(context, images, sizes, locations, listNodesStrategy, getNodeMetadataStrategy, runNodesAndAddToSetStrategy, super(context, images, sizes, locations, listNodesStrategy, getNodeMetadataStrategy, runNodesAndAddToSetStrategy,
rebootNodeStrategy, destroyNodeStrategy, templateBuilderProvider, templateOptionsProvider, nodeRunning, rebootNodeStrategy, destroyNodeStrategy, templateBuilderProvider, templateOptionsProvider, nodeRunning,
nodeTerminated, utils, executor); nodeTerminated, utils, timeouts, executor);
this.cleanupOrphanKeys = cleanupOrphanKeys; this.cleanupOrphanKeys = cleanupOrphanKeys;
} }
/** /**
* like {@link BaseComputeService#destroyNodesMatching} except that this will * like {@link BaseComputeService#destroyNodesMatching} except that this will clean implicit
* clean implicit keypairs. * keypairs.
*/ */
@Override @Override
public Set<? extends NodeMetadata> destroyNodesMatching(Predicate<NodeMetadata> filter) { public Set<? extends NodeMetadata> destroyNodesMatching(Predicate<NodeMetadata> filter) {
@ -87,8 +89,7 @@ public class TerremarkVCloudComputeService extends BaseComputeService {
} }
/** /**
* returns template options, except of type * returns template options, except of type {@link TerremarkVCloudTemplateOptions}.
* {@link TerremarkVCloudTemplateOptions}.
*/ */
@Override @Override
public TerremarkVCloudTemplateOptions templateOptions() { public TerremarkVCloudTemplateOptions templateOptions() {