Hi Jose,

The selection logic is performed by the TemplateBuilder implementation
[1] (note that some providers may define its own implementation of the
template builder).

Once the TemplateBuilder has collected the list of image and hardware
profile candidates, it uses an "image chooser" to select the "best"
image from the list. By default, it uses an ordering based chooser
[2], but you can define your own chooser using the "imageChooser"
method [3].

Hardware profile selection works in a very similar way. There is an
ordering based chooser that takes into accout the "smallest, fastest
and biggest" parameters to select the best compatible hardware profile
for the selected image [4, 5].


HTH!

Ignasi


[1] 
https://github.com/jclouds/jclouds/blob/master/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java#L668-L717
[2] 
https://github.com/jclouds/jclouds/blob/master/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java#L485-L526
[3] 
https://github.com/jclouds/jclouds/blob/master/compute/src/main/java/org/jclouds/compute/domain/TemplateBuilder.java#L172-L179
[4] 
https://github.com/jclouds/jclouds/blob/master/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java#L801-L808
[5] 
https://github.com/jclouds/jclouds/blob/master/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java#L762-L794

On 20 February 2014 10:50, Jose <[email protected]> wrote:
> Hi.
>
> Thanks a lot for your replies, it was veru usefull for me.
> I thought jclouds works in this way.
> jclouds will choose an instance type that meets the requirements, but which
> is the predicate or the filter that jclouds uses to select the correct (the
> best matching) instance (e.g a medium or a large instance) ? I have taken a
> look to the source code to understand the mechanism which is used to resolve
> this issue, but I do not get to find it.
> I'd like to show the potential candidates to be intanciated.
>
> Thank you again.
> Jose.
>
>
>
> El 16/01/2014 15:21, Andrew Phillips escribió:
>>>
>>> When do you define a template Jclouds searchs and builds a node (fox
>>>
>>> example a AMI in Amazon) which matchs with the template specification?
>>
>>
>> From my understanding, it doesn't *build* a "custom" node, it simply
>> searches for an existing AMI that matches the requirements that you set in
>> the template.
>>
>> For things like memory size which are based (in EC2) on the instance that
>> is instantiated, jclouds will choose an instance type (micro, medium etc.)
>> that meets the requirements, if that is possible.
>>
>> Hope that helps. jclouds EC2 experts will hopefully be able to expand
>> on/correct my comments!
>>
>> ap
>
>

Reply via email to