You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Ignasi Barrera <no...@github.com> on 2016/02/17 17:29:10 UTC
[jclouds-labs] Refactored ProfitBricks locations to not rely on
existing DataCenters (#235)
This change removes the `DataCenter - Location` mapping. The current version uses the DataCenter entity to represent locations where nodes can be deployed, but that requires that a DataCenters for each location already exist in order to let users deploy servers to those locations, which is kind of annoying when you're getting started with a clean account.
The current PR changes this, and preconfigures the ProfitBricks regions and zones as jclouds properties (like AWS, rackspace and many others) and does not use a ProfitBricks specific entity to represent a Location. When provisioning nodes, jclouds will take care of creating the DataCenters if needed.
This has some benefits:
* Works out of the box without users having to pre-create anything to let jclouds work.
* Users can use the real location ids ("us/las", "de/fra", etc) when specifying the `locationId` in the template builder.
* There is no need for a custom implementation of the template builder that resolves the zones.
* Removes the need for the Location and DataCenter transformation functions.
* Allows users to override the properties to "restrict" the regions/zones jclouds can work with.
* Cleans up the ComputeService live tests so they don't need to precreate DataCenters. (Note that you might need to specify the `locationId` in the template property when running the live tests if the image being used exists only in one zone).
I haven't been able to run the complete ComputeService live test suite because provisioning was terribly slow. However, I've been able to properly list locations, images, and create nodes using the jclouds-cli compiled with the changes in this PR.
@devcsrj Could you please have a look at this, and give feedback about this functional change?
I think this location abstraction change makes a lot of sense and I'd pretty much like to have it merged before promoting the provider.
You can view, comment on, or merge this pull request online at:
https://github.com/jclouds/jclouds-labs/pull/235
-- Commit Summary --
* Refactored locations to not rely on existing DataCenters
-- File Changes --
M profitbricks/README.md (4)
M profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksProviderMetadata.java (20)
M profitbricks/src/main/java/org/jclouds/profitbricks/compute/ProfitBricksComputeServiceAdapter.java (52)
D profitbricks/src/main/java/org/jclouds/profitbricks/compute/ProfitBricksTemplateBuilderImpl.java (101)
M profitbricks/src/main/java/org/jclouds/profitbricks/compute/config/ProfitBricksComputeServiceContextModule.java (34)
D profitbricks/src/main/java/org/jclouds/profitbricks/compute/function/DataCenterToLocation.java (54)
D profitbricks/src/main/java/org/jclouds/profitbricks/compute/function/LocationToLocation.java (47)
M profitbricks/src/main/java/org/jclouds/profitbricks/compute/function/ProvisionableToImage.java (29)
M profitbricks/src/main/java/org/jclouds/profitbricks/compute/function/ServerToNodeMetadata.java (42)
A profitbricks/src/main/java/org/jclouds/profitbricks/compute/strategy/AssignDataCenterToTemplate.java (110)
A profitbricks/src/main/java/org/jclouds/profitbricks/compute/strategy/TemplateWithDataCenter.java (107)
M profitbricks/src/test/java/org/jclouds/profitbricks/compute/ProfitBricksComputeServiceLiveTest.java (77)
D profitbricks/src/test/java/org/jclouds/profitbricks/compute/function/DataCenterToLocationTest.java (77)
D profitbricks/src/test/java/org/jclouds/profitbricks/compute/function/LocationToLocationTest.java (62)
M profitbricks/src/test/java/org/jclouds/profitbricks/compute/function/ProvisionableToImageTest.java (52)
M profitbricks/src/test/java/org/jclouds/profitbricks/compute/function/ServerToNodeMetadataTest.java (68)
-- Patch Links --
https://github.com/jclouds/jclouds-labs/pull/235.patch
https://github.com/jclouds/jclouds-labs/pull/235.diff
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/235
Re: [jclouds-labs] Refactored ProfitBricks locations to not rely on
existing DataCenters (#235)
Posted by Reijhanniel Jearl Campos <no...@github.com>.
Man you're a magician! :+1:
The way you did the *create-datacenter-if-not-exist* was awesome. Wasn't familiar with how `CreateNodesWithGroupEncodedIntoNameThenAddToSet` worked before, and your [custom impl](https://github.com/jclouds/jclouds-labs/pull/235/files#diff-2de75f6f337c46cc3ee37511896f795fR57) gave me a lot of context.
Just one thing I'd like to ask, how did you get the correct ISO codes for the locations? (i.e.: `DE-BW`, `DE-HE`, `US-NV`)? I remember [asking](https://botbot.me/freenode/jclouds/2014-12-20/?msg=28000713&page=1) for this before (and still couldn't find a list now) and was only able to determine, `DE` for Germany, etc. Did you manually [match](https://www.iso.org/obp/ui/#iso:code:3166:DE), like look at a map or something? :smiley:
[nit] Just some typos in the [`TemplateWithDataCenter`](https://github.com/jclouds/jclouds-labs/pull/235/files#diff-3db81757e47ede67f080ce2a0d44aef1R43).
This **definitely** needs to get merged before the promotion. Some serious refactoring stuff you did here. Thanks @nacx !
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/235#issuecomment-185504039
Re: [jclouds-labs] Refactored ProfitBricks locations to not rely on
existing DataCenters (#235)
Posted by Ignasi Barrera <no...@github.com>.
Pushed to master as [7b8adc62](http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/7b8adc62).
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/235#issuecomment-185634655
Re: [jclouds-labs] Refactored ProfitBricks locations to not rely on
existing DataCenters (#235)
Posted by Ignasi Barrera <no...@github.com>.
Closed #235.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/235#event-554842224
Re: [jclouds-labs] Refactored ProfitBricks locations to not rely on
existing DataCenters (#235)
Posted by Ignasi Barrera <no...@github.com>.
ComputeService live tests are passing. I get a couple failures due to resource limits, but that's because of my (still) limited account. I'll squash and merge in a while.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/235#issuecomment-185631127