You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Adrian Cole <no...@github.com> on 2014/11/16 19:28:59 UTC

[jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

This starts work towards https://issues.apache.org/jira/browse/JCLOUDS-774
You can merge this Pull Request by running:

  git pull https://github.com/adriancole/jclouds adrian.JCLOUDS-774

Or you can view, comment on it, or merge it online at:

  https://github.com/jclouds/jclouds/pull/602

-- Commit Summary --

  * JCLOUDS-774 cleanup derived location suppliers and backfill test for inconsistent region and zone mappings.

-- File Changes --

    M core/src/main/java/org/jclouds/location/suppliers/derived/RegionIdsFromRegionIdToURIKeySet.java (22)
    M core/src/main/java/org/jclouds/location/suppliers/derived/ZoneIdToURIFromJoinOnRegionIdToURI.java (29)
    M core/src/main/java/org/jclouds/location/suppliers/derived/ZoneIdsFromRegionIdToZoneIdsValues.java (25)
    M core/src/main/java/org/jclouds/location/suppliers/derived/ZoneIdsFromZoneIdToURIKeySet.java (17)
    A core/src/test/java/org/jclouds/location/suppliers/derived/ZoneIdToURIFromJoinOnRegionIdToURITest.java (69)

-- Patch Links --

https://github.com/jclouds/jclouds/pull/602.patch
https://github.com/jclouds/jclouds/pull/602.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Adrian Cole <no...@github.com>.
Closed #602.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#event-194004368

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #1382](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/1382/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63238602

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1908](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1908/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63236750

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests-java-7 #296](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests-java-7/296/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63254558

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Adrian Cole <no...@github.com>.
>     }
>  
>     @Override
>     public Map<String, Supplier<URI>> get() {
> -      Builder<String, Supplier<URI>> builder = ImmutableMap.<String, Supplier<URI>> builder();
> -      for (Entry<String, Supplier<URI>> regionToURI : regionIdToURISupplier.get().entrySet()) {
> -         for (String zone : regionIdToZoneIdsSupplier.get().get(regionToURI.getKey()).get()) {
> +      Map<String, Supplier<Set<String>>> regionIdToZoneIds = this.regionIdToZoneIds.get();
> +      Builder<String, Supplier<URI>> builder = ImmutableMap.builder();
> +      for (Entry<String, Supplier<URI>> regionToURI : regionIdToURIs.get().entrySet()) {
> +         Supplier<Set<String>> zoneIds = regionIdToZoneIds.get(regionToURI.getKey());
> +         checkState(zoneIds != null, "region %s is not in the configured region to zone mappings: %s",
> +               regionToURI.getKey(), regionIdToZoneIds);

yeah I don't like saying the same thing twice. iotw `regionIdToZoneIds.containsKey(regionToURI.getKey())` is a mouthful, as is `regionIdToZoneIds.get(regionToURI.getKey())`

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602/files#r20411991

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Adrian Cole <ad...@gmail.com>.
I hate it because it is distracting, and if we looked closely and were
interested in efficiency, we'd kill the function on function on predicate
stuff way before being concerned about looping 5 region keys multiple
times. So.. I'm killing the bigger problem.

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Adrian Cole <no...@github.com>.
>     @Override
>     public Map<String, Supplier<URI>> get() {
> -      Map<String, URI> regionToUris = client.describeRegions();
> -      return Maps.transformValues(regionToUris, Suppliers2.<URI> ofInstanceFunction());
> +      Map<String, URI> regionToUris = api.getAvailabilityZoneAndRegionApi().get().describeRegions();
> +      Map<String, Supplier<URI>> result = Maps.transformValues(regionToUris, Suppliers2.<URI>ofInstanceFunction());
> +      if (whitelistedRegionIds.isEmpty()) {
> +         return result;
> +      }
> +      return Maps.filterKeys(result, Predicates.in(whitelistedRegionIds));

tbh I kindof hate the transform stuff either way. I'm switching it out.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602/files#r20416366

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Adrian Cole <no...@github.com>.
It appears that the "jclouds.regions" whitelist is being ignored in ec2. This can cause the zone supply to come back as null. Working on that now.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63241410

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #1383](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/1383/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63238782

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests-java-7 #297](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests-java-7/297/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63254573

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests-java-7 #293](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests-java-7/293/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63238240

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Andrew Phillips <no...@github.com>.
>     }
>  
>     @Override
>     public Map<String, Supplier<URI>> get() {
> -      Builder<String, Supplier<URI>> builder = ImmutableMap.<String, Supplier<URI>> builder();
> -      for (Entry<String, Supplier<URI>> regionToURI : regionIdToURISupplier.get().entrySet()) {
> -         for (String zone : regionIdToZoneIdsSupplier.get().get(regionToURI.getKey()).get()) {
> +      Map<String, Supplier<Set<String>>> regionIdToZoneIds = this.regionIdToZoneIds.get();
> +      Builder<String, Supplier<URI>> builder = ImmutableMap.builder();
> +      for (Entry<String, Supplier<URI>> regionToURI : regionIdToURIs.get().entrySet()) {
> +         Supplier<Set<String>> zoneIds = regionIdToZoneIds.get(regionToURI.getKey());
> +         checkState(zoneIds != null, "region %s is not in the configured region to zone mappings: %s",
> +               regionToURI.getKey(), regionIdToZoneIds);

To make sure I'm getting this right: the `zoneIds == null` check is a proxy for `regionIdToZoneIds.containsKey(regionToURI.getKey())` here?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602/files#r20411924

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Andrew Phillips <no...@github.com>.
> There are only a few clouds with dynamic locations (and would define classes like this)

Good point to mention other clouds - I was first of all wondering whether all other suppliers-of-things-derived-from-region _in ec2_ are OK now?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63251678

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Andrew Phillips <no...@github.com>.
>     @Override
>     public Map<String, Supplier<URI>> get() {
> -      Map<String, URI> regionToUris = client.describeRegions();
> -      return Maps.transformValues(regionToUris, Suppliers2.<URI> ofInstanceFunction());
> +      ImmutableMap.Builder<String, Supplier<URI>> result = ImmutableMap.builder();
> +      for (Entry<String, URI> regionUrl : api.getAvailabilityZoneAndRegionApi().get().describeRegions().entrySet()) {
> +         if (whitelistedRegionIds.isEmpty() || whitelistedRegionIds.contains(regionUrl.getKey())) {
> +            result.put(regionUrl.getKey(), Suppliers.ofInstance(regionUrl.getValue()));
> +         }
> +      }

Thanks for the updated version, @adriancole!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602/files#r20416641

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1909](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1909/) UNSTABLE
Looks like there's a problem with this pull request
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63239807

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Andrew Phillips <no...@github.com>.
>     @Override
>     public Map<String, Supplier<URI>> get() {
> -      Map<String, URI> regionToUris = client.describeRegions();
> -      return Maps.transformValues(regionToUris, Suppliers2.<URI> ofInstanceFunction());
> +      Map<String, URI> regionToUris = api.getAvailabilityZoneAndRegionApi().get().describeRegions();
> +      Map<String, Supplier<URI>> result = Maps.transformValues(regionToUris, Suppliers2.<URI>ofInstanceFunction());
> +      if (whitelistedRegionIds.isEmpty()) {
> +         return result;
> +      }
> +      return Maps.filterKeys(result, Predicates.in(whitelistedRegionIds));

This works for me. I wonder if this is slightly more efficient, since it avoids transforming values that will not be returned:
```
Map<String, URI> regionToUris = api.getAvailabilityZoneAndRegionApi().get().describeRegions();
if (!whitelistedRegionIds.isEmpty()) {
   regionToUris = Maps.filterKeys(regionToUris, Predicates.in(whitelistedRegionIds));
}
return Maps.transformValues(regionToUris, Suppliers2.<URI>ofInstanceFunction());
```
But also fine with leaving as-is if you prefer.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602/files#r20415551

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests-java-7 #291](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests-java-7/291/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63232414

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Adrian Cole <no...@github.com>.
> +      assertEquals(result.get("us-east-1").get(),
> +            ImmutableSet.of("us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d"));
> +
> +      assertPosted("us-east-1", "Action=DescribeRegions");
> +      assertPosted("us-east-1", "Action=DescribeAvailabilityZones");
> +   }
> +
> +   public void failsOnAuthorizationErrorToAnyRegion() throws Exception {
> +      enqueueRegions("us-east-1", "eu-central-1");
> +      enqueueXml("us-east-1", "/availabilityZones.xml");
> +      enqueue("eu-central-1", new MockResponse().setResponseCode(401));
> +
> +      DescribeAvailabilityZonesInRegion supplier = new DescribeAvailabilityZonesInRegion(api(),
> +            supplyRegionIds("us-east-1", "eu-central-1"));
> +
> +      try {

@danbroudy  ping.. sorry mispelled earlier

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602/files#r20412853

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Adrian Cole <no...@github.com>.
@demobox I think I'd like to merge these two commits independently of any fix to ec2. Appreciate any review of the new commit I added.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63237423

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Andrew Phillips <no...@github.com>.
+1 - didn't review the tests in detail, but the main code changes look good to me.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63238135

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Adrian Cole <no...@github.com>.
There are only a few clouds with dynamic locations (and would define
classes like this). I will follow-up with similar changes if needed (hold
me to it). Good idea to look!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63250936

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Adrian Cole <no...@github.com>.
>     @Override
>     public Map<String, Supplier<URI>> get() {
> -      Map<String, URI> regionToUris = client.describeRegions();
> -      return Maps.transformValues(regionToUris, Suppliers2.<URI> ofInstanceFunction());
> +      ImmutableMap.Builder<String, Supplier<URI>> result = ImmutableMap.builder();
> +      for (Entry<String, URI> regionUrl : api.getAvailabilityZoneAndRegionApi().get().describeRegions().entrySet()) {
> +         if (whitelistedRegionIds.isEmpty() || whitelistedRegionIds.contains(regionUrl.getKey())) {
> +            result.put(regionUrl.getKey(), Suppliers.ofInstance(regionUrl.getValue()));
> +         }
> +      }

np. it only takes a little more time, yet I feel less dirty inside. Thanks
for the nudge!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602/files#r20416688

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests-java-7 #294](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests-java-7/294/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63238571

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #1384](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/1384/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63243503

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1915](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1915/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63256302

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1911](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1911/) FAILURE
Looks like there's a problem with this pull request
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63242395

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #1381](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/1381/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63232719

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Adrian Cole <no...@github.com>.
@demobox I opened https://issues.apache.org/jira/browse/JCLOUDS-779 to address the remaining implementations. I'm hoping one of the rax folks can help with this, so I described what to do vs doing it myself.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63258479

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Andrew Phillips <no...@github.com>.
>        for (String region : regions.get()) {
> -         try {
> -            ImmutableSet<String> zones = ImmutableSet.copyOf(Iterables.transform(client
> -                     .describeAvailabilityZonesInRegion(region), new Function<AvailabilityZoneInfo, String>() {
> -
> -               @Override
> -               public String apply(AvailabilityZoneInfo arg0) {
> -                  return arg0.getZone();
> -               }
> -
> -            }));
> -            if (!zones.isEmpty())
> -               map.put(region, zones);
> -         } catch (HttpResponseException e) {
> -            // TODO: this should be in retry handler, not here.

> This was very dodgy as it trapped a weird edge case.

I was going to say: why are we special-casing for a proxy error here? Thanks for reverting!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602/files#r20412970

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Adrian Cole <no...@github.com>.
merged 2 commits on base tests.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63241064

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1914](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1914/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63246769

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Adrian Cole <no...@github.com>.
>        for (String region : regions.get()) {
> -         try {
> -            ImmutableSet<String> zones = ImmutableSet.copyOf(Iterables.transform(client
> -                     .describeAvailabilityZonesInRegion(region), new Function<AvailabilityZoneInfo, String>() {
> -
> -               @Override
> -               public String apply(AvailabilityZoneInfo arg0) {
> -                  return arg0.getZone();
> -               }
> -
> -            }));
> -            if (!zones.isEmpty())
> -               map.put(region, zones);
> -         } catch (HttpResponseException e) {
> -            // TODO: this should be in retry handler, not here.

This was very dodgy as it trapped a weird edge case.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602/files#r20412928

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Adrian Cole <no...@github.com>.
Maybe.. let me verify first.

PS https://forums.aws.amazon.com/search.jspa?objID=f30&q=eu-central-1&x=0&y=0 is odd, right? Why are people told to upgrade just to list the eu region?!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63233337

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #1385](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/1385/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63254891

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests-java-7 #292](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests-java-7/292/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63232538

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1912](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1912/) FAILURE
Looks like there's a problem with this pull request
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63242401

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1916](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1916/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63258778

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Andrew Phillips <no...@github.com>.
Code looks good to me. Are you thinking of committing this now, or looking to do more work?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63232994

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Adrian Cole <no...@github.com>.
This pull request must be slightly ahead of the mirror. @demobox PTAL at the code. I was able to reproduce the issue.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63242812

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Adrian Cole <no...@github.com>.
> +package org.jclouds.ec2.suppliers;
> +
> +import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
> +import static org.testng.Assert.assertEquals;
> +import static org.testng.Assert.assertNotNull;
> +
> +import java.net.URI;
> +import java.util.Map;
> +import java.util.Properties;
> +
> +import org.jclouds.ec2.internal.BaseEC2ApiMockTest;
> +import org.testng.annotations.Test;
> +
> +import com.google.common.base.Supplier;
> +
> +@Test(groups = "unit", testName = "DescribeRegionsForRegionURIsMockTest", singleThreaded = true)

Yep!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602/files#r20415660

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #1380](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/1380/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63232663

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Adrian Cole <no...@github.com>.
@demobox so the question about things derived from ec2, there are only 2 aws-ec2 and openstack-nova-ec2.

Besides a recent change to remove Nullable from a bunch of methods, openstack-nova-ec2 hasn't had openstack-related maintenance since 2012. I would be surprised if it works at all.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63254007

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Andrew Phillips <no...@github.com>.
> I opened https://issues.apache.org/jira/browse/JCLOUDS-779 to address the remaining implementations

Thanks. With this, we can hopefully unblock our EC2 users and move on ;-)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63266287

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Adrian Cole <no...@github.com>.
I found a big fault in DescribeAvailabilityZonesInRegion. jclouds is not designed to work with inconsistent state (at least not now). This implementation of DescribeAvailabilityZonesInRegion introduced in 428b2bd makes it possible to have inconsistent mappings between regions and zones. I am reverting this, as it is better to fail fast than fail very lazily.

There's still a problem, but this is related code.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63234345

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests-java-7 #295](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests-java-7/295/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63243162

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Adrian Cole <no...@github.com>.
> +      assertEquals(result.get("us-east-1").get(),
> +            ImmutableSet.of("us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d"));
> +
> +      assertPosted("us-east-1", "Action=DescribeRegions");
> +      assertPosted("us-east-1", "Action=DescribeAvailabilityZones");
> +   }
> +
> +   public void failsOnAuthorizationErrorToAnyRegion() throws Exception {
> +      enqueueRegions("us-east-1", "eu-central-1");
> +      enqueueXml("us-east-1", "/availabilityZones.xml");
> +      enqueue("eu-central-1", new MockResponse().setResponseCode(401));
> +
> +      DescribeAvailabilityZonesInRegion supplier = new DescribeAvailabilityZonesInRegion(api(),
> +            supplyRegionIds("us-east-1", "eu-central-1"));
> +
> +      try {

@danbrody I think you were curious how to test exceptions. Note we aren't interested in testing default fallbacks, but in this specific case, testing an exception is important.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602/files#r20412838

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Andrew Phillips <no...@github.com>.
Code looks good to me - just a minor comment. Main question: do we need to add this kind of filtering in other suppliers too, or do they all use this one as the "root" source of regions?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63250717

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by Andrew Phillips <no...@github.com>.
> +package org.jclouds.ec2.suppliers;
> +
> +import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
> +import static org.testng.Assert.assertEquals;
> +import static org.testng.Assert.assertNotNull;
> +
> +import java.net.URI;
> +import java.util.Map;
> +import java.util.Properties;
> +
> +import org.jclouds.ec2.internal.BaseEC2ApiMockTest;
> +import org.testng.annotations.Test;
> +
> +import com.google.common.base.Supplier;
> +
> +@Test(groups = "unit", testName = "DescribeRegionsForRegionURIsMockTest", singleThreaded = true)

`singleThreaded = true` was because of the setup in the parent class..?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602/files#r20415564

Re: [jclouds] JCLOUDS-774 inconsistent region and zone mappings. (#602)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #1386](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/1386/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/602#issuecomment-63254890