Class VolumePredicates
- java.lang.Object
 - 
- org.jclouds.openstack.cinder.v1.predicates.VolumePredicates
 
 
- 
public class VolumePredicates extends Object
Tests to see if volume has reached status. This class is most useful when paired with a RetryablePredicate as in the code below. This class can be used to block execution until the Volume status has reached a desired state. This is useful when your Volume needs to be 100% ready before you can continue with execution.
You can also use the static convenience methods as so.Volume volume = volumeApi.create(100); RetryablePredicate<String> awaitAvailable = RetryablePredicate.create( VolumePredicates.available(volumeApi), 600, 10, 10, TimeUnit.SECONDS); if (!awaitAvailable.apply(volume.getId())) { throw new TimeoutException("Timeout on volume: " + volume); }Volume volume = volumeApi.create(100); if (!VolumePredicates.awaitAvailable(volumeApi).apply(volume.getId())) { throw new TimeoutException("Timeout on volume: " + volume); } 
- 
- 
Constructor Summary
Constructors Constructor Description VolumePredicates() 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.google.common.base.Predicate<Volume>awaitAvailable(VolumeApi volumeApi)Wait until a Volume is Available.static com.google.common.base.Predicate<Volume>awaitDeleted(VolumeApi volumeApi)Wait until a Volume no longer exists.static com.google.common.base.Predicate<Volume>awaitInUse(VolumeApi volumeApi)Wait until a Volume is In Use.static com.google.common.base.Predicate<Volume>awaitStatus(VolumeApi volumeApi, Volume.Status status, long maxWaitInSec, long periodInSec) 
 - 
 
- 
- 
Method Detail
- 
awaitAvailable
public static com.google.common.base.Predicate<Volume> awaitAvailable(VolumeApi volumeApi)
Wait until a Volume is Available.- Parameters:
 volumeApi- The VolumeApi in the region where your Volume resides.- Returns:
 - RetryablePredicate That will check the status every 5 seconds for a maxiumum of 10 minutes.
 
 
- 
awaitInUse
public static com.google.common.base.Predicate<Volume> awaitInUse(VolumeApi volumeApi)
Wait until a Volume is In Use.- Parameters:
 volumeApi- The VolumeApi in the region where your Volume resides.- Returns:
 - RetryablePredicate That will check the status every 5 seconds for a maxiumum of 10 minutes.
 
 
- 
awaitDeleted
public static com.google.common.base.Predicate<Volume> awaitDeleted(VolumeApi volumeApi)
Wait until a Volume no longer exists.- Parameters:
 volumeApi- The VolumeApi in the region where your Volume resides.- Returns:
 - RetryablePredicate That will check the whether the Volume exists every 5 seconds for a maxiumum of 10 minutes.
 
 
- 
awaitStatus
public static com.google.common.base.Predicate<Volume> awaitStatus(VolumeApi volumeApi, Volume.Status status, long maxWaitInSec, long periodInSec)
 
 - 
 
 -