> + return getWorkingInstance(zone, UUID.randomUUID().toString(), "1", 1);
> + }
> +
> + private Instance awaitAvailable(Instance instance, InstanceApi iapi) {
> + for (int n = 0; n < 40; n = n + 1) {
> + Instance updatedInstance = iapi.get(instance.getId());
> + if (updatedInstance.getStatus() == Instance.Status.ACTIVE)
> + return updatedInstance;
> + if (updatedInstance.getStatus() == Instance.Status.UNRECOGNIZED)
> + return null; // fast fail
> + try {
> + Thread.sleep(15000);
> + } catch (InterruptedException e) {
> + logger.info(e.getStackTrace().toString());
> + }
> + }
This is only after the last loop iteration, which should only happen on a
timeout. Timeout here is supposed to be very much an edge case - we expect the
instance to become either available or error out within a few minutes.
The sleep is needed between status retries.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-openstack/pull/12/files#r5127442