jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ignasi Barrera <notificati...@github.com>
Subject Re: [jclouds-labs] JCLOUDS-702: JClouds ProfitBricks provider - ComputeServiceAdapter (#145)
Date Wed, 04 Mar 2015 10:53:12 GMT
> +      checkNotNull(from, "Null image");
> +
> +      String desc = from.name();
> +      OsFamily osFamily = parseOsFamily(desc);
> +
> +      OperatingSystem os = OperatingSystem.builder()
> +	      .description(osFamily.value())
> +	      .family(osFamily)
> +	      .version(parseVersion(desc))
> +	      .is64Bit(is64Bit(desc))
> +	      .build();
> +
> +      return new ImageBuilder()
> +	      .ids(from.id())
> +	      .name(desc)
> +	      .location(mapLocation(from.location()))

The location hierarchy makes sense. jclouds, however, already provides the PROVIDER location
through the `JustProvider` supplier. You can inject it in the DataCenterToLocation function
and use it. Have a look at how [digitalocean](https://github.com/jclouds/jclouds-labs/blob/master/digitalocean/src/main/java/org/jclouds/digitalocean/compute/functions/RegionToLocation.java)
does this.

Regarding the images that don't exist in all locations:

* The ComputeServiceAdapter must return each existing image, for each location. One image
for each different location.
* The providerId of the image must be set to the *real* id of the image in the provider.
* The "id" of the image is the one jclouds will use to identify it (for example when calling
the `geImage(id)` in the ComputeService or when using the `imageId` template option. If the
same image id is available in multiple locations, usually providers encode the region in this
field. Something like: "us-west-1/image-id". If ids are unique it is ok to use the same id
for the providerId and the id (what the `ids` method in the builder does). Otherwise you'll
have to make the "id" field able to distinguish between each image in each region. You can
have a look at how the OpenStack provider uses the [RegionAndId](https://github.com/jclouds/jclouds/blob/master/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/regionscoped/RegionAndId.java)
class.
* Finally, if images are by default available in **all** locations, the "location" field should
be left null, otherwise it should be set to the right location (region) instead of being set
to the PROVIDER scoped one. You can do this by injecting the locations supplier here as you
do in the `ServerToNodeMetadata` to find the location where the image is available. This assumes
that the ComputeService returns one copy of the image for each location where it is available,
so you can make sure you return there all you need to build this properly here.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/145/files#r25766050
Mime
View raw message