use of org.openstack4j.model.storage.block.Volume.Status in project cloudbreak by hortonworks.
the class OpenStackAttachedDiskResourceBuilder method checkStatus.
@Override
protected boolean checkStatus(OpenStackContext context, AuthenticatedContext auth, CloudResource resource) {
CloudContext cloudContext = auth.getCloudContext();
OSClient<?> osClient = createOSClient(auth);
Volume osVolume = osClient.blockStorage().volumes().get(resource.getReference());
if (osVolume != null && context.isBuild()) {
Status volumeStatus = osVolume.getStatus();
if (Status.ERROR == volumeStatus || Status.ERROR_DELETING == volumeStatus || Status.ERROR_RESTORING == osVolume.getStatus()) {
throw new OpenStackResourceException("Volume in failed state", resource.getType(), resource.getName(), cloudContext.getId(), volumeStatus.name());
}
return volumeStatus == Status.AVAILABLE;
} else {
return osVolume == null && !context.isBuild();
}
}
Aggregations