CloudStack image location is Zone, and the part of the zone is the provider location

This commit is contained in:
Andrei Savu 2012-03-20 11:53:53 +02:00
parent e4197bec8f
commit c377c6da01
2 changed files with 7 additions and 5 deletions

View File

@ -61,10 +61,12 @@ public class LocationPredicate implements Predicate<ComputeMetadata> {
input.getLocation().getParent() != null || input.getLocation().getScope() == LocationScope.PROVIDER,
"only locations of scope PROVIDER can have a null parent; input: %s",
input.getLocation());
return location.equals(input.getLocation()) || location.getParent() != null
&& location.getParent().equals(input.getLocation()) || location.getParent().getParent() != null
&& location.getParent().getParent().equals(input.getLocation());
return location.equals(input.getLocation()) ||
(input.getLocation().getParent() != null && location.equals(input.getLocation().getParent())) ||
(location.getParent() != null && location.getParent().equals(input.getLocation())) ||
(location.getParent() != null && location.getParent().getParent() != null &&
location.getParent().getParent().equals(input.getLocation()));
}
@Override

View File

@ -614,7 +614,7 @@ public class TemplateBuilderImpl implements TemplateBuilder {
location = defaultLocation.get();
Predicate<Image> imagePredicate = buildImagePredicate();
Iterable<? extends Image> supportedImages = filter(images, buildImagePredicate());
Iterable<? extends Image> supportedImages = filter(images, imagePredicate);
if (size(supportedImages) == 0) {
if (imagePredicate == idPredicate) {
throw new NoSuchElementException(format("%s not found", idPredicate));