use of org.openstack4j.model.network.State in project cloudbreak by hortonworks.
the class OpenStackNetworkResourceBuilder method checkStatus.
@Override
protected boolean checkStatus(OpenStackContext context, AuthenticatedContext auth, CloudResource resource) {
CloudContext cloudContext = auth.getCloudContext();
OSClient<?> osClient = createOSClient(auth);
org.openstack4j.model.network.Network osNetwork = osClient.networking().network().get(resource.getReference());
if (osNetwork != null && context.isBuild()) {
State networkStatus = osNetwork.getStatus();
if (State.ERROR == networkStatus) {
throw new OpenStackResourceException("Network in failed state", resource.getType(), resource.getName(), cloudContext.getId(), networkStatus.name());
}
return networkStatus == State.ACTIVE;
} else {
return osNetwork == null && !context.isBuild();
}
}
use of org.openstack4j.model.network.State in project cloudbreak by hortonworks.
the class OpenStackRouterResourceBuilder method checkStatus.
@Override
protected boolean checkStatus(OpenStackContext context, AuthenticatedContext auth, CloudResource resource) {
CloudContext cloudContext = auth.getCloudContext();
OSClient<?> osClient = createOSClient(auth);
Router osRouter = osClient.networking().router().get(resource.getReference());
if (osRouter != null && context.isBuild()) {
State routerStatus = osRouter.getStatus();
if (State.ERROR == routerStatus) {
throw new OpenStackResourceException("Router in failed state", resource.getType(), utils.getStackName(auth), cloudContext.getId(), resource.getName());
}
return routerStatus == State.ACTIVE;
} else {
return osRouter == null && !context.isBuild();
}
}
Aggregations