if (region == null || iaasInfo == null) {
String msg =
"Region or IaaSProvider is null: region: " + region + " - IaaSProvider: " +
iaasInfo;
log.error(msg);
throw new InvalidRegionException(msg);
}
ComputeServiceContext context = iaasInfo.getComputeService().getContext();
RestContext<NovaApi, NovaAsyncApi> nova = context.unwrap();
Set<String> zones = nova.getApi().getConfiguredZones();
for (String configuredZone : zones) {
if (region.equalsIgnoreCase(configuredZone)) {
if (log.isDebugEnabled()) {
log.debug("Found a matching region: " + region);
}
return true;
}
}
String msg = "Invalid region: " + region +" in the iaas: "+iaasInfo.getType();
log.error(msg);
throw new InvalidRegionException(msg);
}