You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jclouds.apache.org by Charles Paclat <ch...@paclat.net> on 2014/06/04 19:17:03 UTC

Looking to customize ImageToOperatingSystem

I am using JCloud with OpenStack and the Nova APIs.  I am finding that the
templates that perform matching on the image meta data are not quite
working for my use cases.  I would like to see about enhancing the
ImageToOperatingSystem function in my client to be able to parse some
additional meta data tags on our deployment when they are available.  I
would also like to support CentOS in the matching for OpenStack.

I am a bit new to Guice,  but it seems to me there must be a way to replace
the ImageToOperatingSystem function with a custom one.

Is this advisable?  Has anyone else tried to customize Jclouds Nova
provider in this way?  Is there an example that I can refer to?

Re: Looking to customize ImageToOperatingSystem

Posted by Andrew Phillips <ap...@qrmedia.com>.
To add to what Ignasi has said: if you think the use case you're  
working with is likely to be a general issue, and not just specific to  
your environment, could you briefly describe what you need on the user  
list? It could well be something we would want to include in jclouds!

Thanks

ap

Re: Looking to customize ImageToOperatingSystem

Posted by Ignasi Barrera <na...@apache.org>.
Hi Charles,

As you said, the way to do that is by configuring Guice to provide
your implementation of the ImageToOperatingSystem, using a linked
binding [1].

You will first have to subclass the ImageToOperatingSystem class and
put your custom logic there (it has to be a subclass, as you won't be
able to bind directly the generic function type as there is already a
binding for it and Guice does not allow duplicated bindings).

Then you just to create a Guice module that configures the binding.
Something like:

class CustomGuiceBindings extends AbstractModule {
   @Override
   protected void configure()
      bind(ImageToOperatingSystem).to(YourCustomImageToOperatingSystem).in(SINGLETON);
   }
}

And add it to the list of modules you provide when creating the context.

HTH!


Ignasi





[1] https://code.google.com/p/google-guice/wiki/LinkedBindings

On 4 June 2014 19:17, Charles Paclat <ch...@paclat.net> wrote:
> I am using JCloud with OpenStack and the Nova APIs.  I am finding that the
> templates that perform matching on the image meta data are not quite
> working for my use cases.  I would like to see about enhancing the
> ImageToOperatingSystem function in my client to be able to parse some
> additional meta data tags on our deployment when they are available.  I
> would also like to support CentOS in the matching for OpenStack.
>
> I am a bit new to Guice,  but it seems to me there must be a way to replace
> the ImageToOperatingSystem function with a custom one.
>
> Is this advisable?  Has anyone else tried to customize Jclouds Nova
> provider in this way?  Is there an example that I can refer to?