You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Matt Spurlin <ma...@appcore.com> on 2014/04/23 16:00:48 UTC

CloudStack 4.3+ Plugins

In version 4.2 and below to get a plugin to work, I was adding a dependency in the pom.xml of the Client project and modifying applicationContext.xml.inand commands.properties.in. 4.3 appears to have introduces discoverable plugins. What needs to be done differently in order to take advantage of this?
Thank you for your time,
Matt

Re: Create template from snapshot using ec2

Posted by sebgoa <ru...@gmail.com>.
On Apr 30, 2014, at 11:47 AM, Páll Helgason <pa...@greenqloud.com> wrote:

> Hi Marty,
> 
> Thanks for the reply. It doesn’t really get to the management server since it’s failing before that.
> 
> 2014-04-23 10:38:19,017 INFO  [cloud.api.ApiServer] (catalina-exec-18:null) (userId=10 accountId=10 sessionId=null) 127.0.0.1 -- GET command=registerTemplate&response=json&zoneid=596ee614-0917-496c-bce3-129254c3e110&hypervisor=VMWare&name=CentosFromSnapshot&displaytext=test&format=ova&url=null&ostypeid=1f3da26c-c553-11e3-b989-005056b0541d&apikey=ZmpaQ2xwNDVSbDh3SnRnNnE0dG9Kc2xLWW5GZFdr&signature=n41Wzfb%2FV9WvTxo4UGgam9bNZgU%3D 431 Please specify a valid URL. URL:null is invalid
> 
> I’ve since gone through the code and figured out that the current implementation requires that the [manifest] parameter (according to the ec2 spec) is set and is used as the URL. So I’ll be changing that for us to make this possible (i.e. to create register a snapshot without having a URL to it). I’ve also added the ability to register an ISO image with ec2-register. I can commit these changes, when done, to the master branch if anyone is interested.
> 

Yes please, can you file a bug for it, and then submit your review.

-sebastien

> Cheers,
> 
> -- 
> Páll Helgason
> Core Team
> 
> Tel: (+354) 415 0202 
> palli@greenqloud.com
> www.greenqloud.com
> 
> 
> <unknown.tiff>
> 
> On 25.4.2014, at 18:33, Marty Sweet <ms...@gmail.com> wrote:
> 
>> Hi Pall,
>> 
>> I have CC'ed in the users mailing list as they might have more suggestions there.
>> 
>> In the meantime, please can you provide the management-server.log around the time when you run this API command. It might provide a useful insight to the problem.
>> Also, how you do mean 'fails on the url'? What does it return? an error code? JSON array?
>> 
>> Marty
>> 
>> 
>> 
>> 
>> On 23 April 2014 15:37, Páll Helgason <pa...@greenqloud.com> wrote:
>> Hi,
>> 
>> Maybe someone here can help me with this. I’m trying to create a template from a snapshot (CS 4.2.1 + VMWare 5.0) created with the ec2 tools. Creating the snapshot works just fine (and so does ec2-create-image). But when I try to register the snapshot as a template it’s just not working. 
>> 
>> The command I use is ec2-register -d test -n CentosFromSnapshot -s c651d9b9-fd17-4002-b32f-c46ad27c93ac -a ova:VUmc:Other:VMWare (figured out the -a stuff from the code). According to the awsapi logs this calls 
>> 
>> http://127.0.0.1:8080/client/api?command=registerTemplate&response=json&zoneid=596ee614-0917-496c-bce3-129254c3e110&hypervisor=VMWare&name=CentosFromSnapshot&displaytext=test&format=ova&url=null&ostypeid=1f3da26c-c553-11e3-b989-005056b0541d&apikey=xxx&signature=xxxx
>> 
>> which of course fails on the url. Going through the code I can’t find anything that is handling the -s parameter. Am I missing something or is this not implemented?
>> 
>> Cheers,
>> 
>> -- 
>> Páll Helgason
>> Core Team
>> 
>> Tel: (+354) 415 0202 
>> palli@greenqloud.com
>> www.greenqloud.com
>> 
>> 
>> 
>> 
>> 
> 


Re: Create template from snapshot using ec2

Posted by Páll Helgason <pa...@greenqloud.com>.
Hi Marty,

Thanks for the reply. It doesn’t really get to the management server since it’s failing before that.

2014-04-23 10:38:19,017 INFO  [cloud.api.ApiServer] (catalina-exec-18:null) (userId=10 accountId=10 sessionId=null) 127.0.0.1 -- GET command=registerTemplate&response=json&zoneid=596ee614-0917-496c-bce3-129254c3e110&hypervisor=VMWare&name=CentosFromSnapshot&displaytext=test&format=ova&url=null&ostypeid=1f3da26c-c553-11e3-b989-005056b0541d&apikey=ZmpaQ2xwNDVSbDh3SnRnNnE0dG9Kc2xLWW5GZFdr&signature=n41Wzfb%2FV9WvTxo4UGgam9bNZgU%3D 431 Please specify a valid URL. URL:null is invalid

I’ve since gone through the code and figured out that the current implementation requires that the [manifest] parameter (according to the ec2 spec) is set and is used as the URL. So I’ll be changing that for us to make this possible (i.e. to create register a snapshot without having a URL to it). I’ve also added the ability to register an ISO image with ec2-register. I can commit these changes, when done, to the master branch if anyone is interested.

Cheers,

-- 
Páll Helgason
Core Team

Tel: (+354) 415 0202 
palli@greenqloud.com
www.greenqloud.com




On 25.4.2014, at 18:33, Marty Sweet <ms...@gmail.com> wrote:

> Hi Pall,
> 
> I have CC'ed in the users mailing list as they might have more suggestions there.
> 
> In the meantime, please can you provide the management-server.log around the time when you run this API command. It might provide a useful insight to the problem.
> Also, how you do mean 'fails on the url'? What does it return? an error code? JSON array?
> 
> Marty
> 
> 
> 
> 
> On 23 April 2014 15:37, Páll Helgason <pa...@greenqloud.com> wrote:
> Hi,
> 
> Maybe someone here can help me with this. I’m trying to create a template from a snapshot (CS 4.2.1 + VMWare 5.0) created with the ec2 tools. Creating the snapshot works just fine (and so does ec2-create-image). But when I try to register the snapshot as a template it’s just not working. 
> 
> The command I use is ec2-register -d test -n CentosFromSnapshot -s c651d9b9-fd17-4002-b32f-c46ad27c93ac -a ova:VUmc:Other:VMWare (figured out the -a stuff from the code). According to the awsapi logs this calls 
> 
> http://127.0.0.1:8080/client/api?command=registerTemplate&response=json&zoneid=596ee614-0917-496c-bce3-129254c3e110&hypervisor=VMWare&name=CentosFromSnapshot&displaytext=test&format=ova&url=null&ostypeid=1f3da26c-c553-11e3-b989-005056b0541d&apikey=xxx&signature=xxxx
> 
> which of course fails on the url. Going through the code I can’t find anything that is handling the -s parameter. Am I missing something or is this not implemented?
> 
> Cheers,
> 
> -- 
> Páll Helgason
> Core Team
> 
> Tel: (+354) 415 0202 
> palli@greenqloud.com
> www.greenqloud.com
> 
> 
> 
> 
> 


Re: Create template from snapshot using ec2

Posted by Páll Helgason <pa...@greenqloud.com>.
Hi Marty,

Thanks for the reply. It doesn’t really get to the management server since it’s failing before that.

2014-04-23 10:38:19,017 INFO  [cloud.api.ApiServer] (catalina-exec-18:null) (userId=10 accountId=10 sessionId=null) 127.0.0.1 -- GET command=registerTemplate&response=json&zoneid=596ee614-0917-496c-bce3-129254c3e110&hypervisor=VMWare&name=CentosFromSnapshot&displaytext=test&format=ova&url=null&ostypeid=1f3da26c-c553-11e3-b989-005056b0541d&apikey=ZmpaQ2xwNDVSbDh3SnRnNnE0dG9Kc2xLWW5GZFdr&signature=n41Wzfb%2FV9WvTxo4UGgam9bNZgU%3D 431 Please specify a valid URL. URL:null is invalid

I’ve since gone through the code and figured out that the current implementation requires that the [manifest] parameter (according to the ec2 spec) is set and is used as the URL. So I’ll be changing that for us to make this possible (i.e. to create register a snapshot without having a URL to it). I’ve also added the ability to register an ISO image with ec2-register. I can commit these changes, when done, to the master branch if anyone is interested.

Cheers,

-- 
Páll Helgason
Core Team

Tel: (+354) 415 0202 
palli@greenqloud.com
www.greenqloud.com




On 25.4.2014, at 18:33, Marty Sweet <ms...@gmail.com> wrote:

> Hi Pall,
> 
> I have CC'ed in the users mailing list as they might have more suggestions there.
> 
> In the meantime, please can you provide the management-server.log around the time when you run this API command. It might provide a useful insight to the problem.
> Also, how you do mean 'fails on the url'? What does it return? an error code? JSON array?
> 
> Marty
> 
> 
> 
> 
> On 23 April 2014 15:37, Páll Helgason <pa...@greenqloud.com> wrote:
> Hi,
> 
> Maybe someone here can help me with this. I’m trying to create a template from a snapshot (CS 4.2.1 + VMWare 5.0) created with the ec2 tools. Creating the snapshot works just fine (and so does ec2-create-image). But when I try to register the snapshot as a template it’s just not working. 
> 
> The command I use is ec2-register -d test -n CentosFromSnapshot -s c651d9b9-fd17-4002-b32f-c46ad27c93ac -a ova:VUmc:Other:VMWare (figured out the -a stuff from the code). According to the awsapi logs this calls 
> 
> http://127.0.0.1:8080/client/api?command=registerTemplate&response=json&zoneid=596ee614-0917-496c-bce3-129254c3e110&hypervisor=VMWare&name=CentosFromSnapshot&displaytext=test&format=ova&url=null&ostypeid=1f3da26c-c553-11e3-b989-005056b0541d&apikey=xxx&signature=xxxx
> 
> which of course fails on the url. Going through the code I can’t find anything that is handling the -s parameter. Am I missing something or is this not implemented?
> 
> Cheers,
> 
> -- 
> Páll Helgason
> Core Team
> 
> Tel: (+354) 415 0202 
> palli@greenqloud.com
> www.greenqloud.com
> 
> 
> 
> 
> 


Re: Create template from snapshot using ec2

Posted by Marty Sweet <ms...@gmail.com>.
Hi Pall,

I have CC'ed in the users mailing list as they might have more suggestions
there.

In the meantime, please can you provide the management-server.log around
the time when you run this API command. It might provide a useful insight
to the problem.
Also, how you do mean 'fails on the url'? What does it return? an error
code? JSON array?

Marty




On 23 April 2014 15:37, Páll Helgason <pa...@greenqloud.com> wrote:

> Hi,
>
> Maybe someone here can help me with this. I’m trying to create a template
> from a snapshot (CS 4.2.1 + VMWare 5.0) created with the ec2 tools.
> Creating the snapshot works just fine (and so does ec2-create-image). But
> when I try to register the snapshot as a template it’s just not working.
>
> The command I use is ec2-register -d test -n CentosFromSnapshot -s
> c651d9b9-fd17-4002-b32f-c46ad27c93ac -a ova:VUmc:Other:VMWare (figured out
> the -a stuff from the code). According to the awsapi logs this calls
>
>
> http://127.0.0.1:8080/client/api?command=registerTemplate&response=json&zoneid=596ee614-0917-496c-bce3-129254c3e110&hypervisor=VMWare&name=CentosFromSnapshot&displaytext=test&format=ova&url=null&ostypeid=1f3da26c-c553-11e3-b989-005056b0541d&apikey=xxx&signature=xxxx
>
> which of course fails on the url. Going through the code I can’t find
> anything that is handling the -s parameter. Am I missing something or is
> this not implemented?
>
> Cheers,
>
> --
> *Páll Helgason*
> Core Team
>
> Tel: (+354) 415 0202
> palli@greenqloud.com
> www.greenqloud.com
>
>
>
>

Re: Create template from snapshot using ec2

Posted by Marty Sweet <ms...@gmail.com>.
Hi Pall,

I have CC'ed in the users mailing list as they might have more suggestions
there.

In the meantime, please can you provide the management-server.log around
the time when you run this API command. It might provide a useful insight
to the problem.
Also, how you do mean 'fails on the url'? What does it return? an error
code? JSON array?

Marty




On 23 April 2014 15:37, Páll Helgason <pa...@greenqloud.com> wrote:

> Hi,
>
> Maybe someone here can help me with this. I’m trying to create a template
> from a snapshot (CS 4.2.1 + VMWare 5.0) created with the ec2 tools.
> Creating the snapshot works just fine (and so does ec2-create-image). But
> when I try to register the snapshot as a template it’s just not working.
>
> The command I use is ec2-register -d test -n CentosFromSnapshot -s
> c651d9b9-fd17-4002-b32f-c46ad27c93ac -a ova:VUmc:Other:VMWare (figured out
> the -a stuff from the code). According to the awsapi logs this calls
>
>
> http://127.0.0.1:8080/client/api?command=registerTemplate&response=json&zoneid=596ee614-0917-496c-bce3-129254c3e110&hypervisor=VMWare&name=CentosFromSnapshot&displaytext=test&format=ova&url=null&ostypeid=1f3da26c-c553-11e3-b989-005056b0541d&apikey=xxx&signature=xxxx
>
> which of course fails on the url. Going through the code I can’t find
> anything that is handling the -s parameter. Am I missing something or is
> this not implemented?
>
> Cheers,
>
> --
> *Páll Helgason*
> Core Team
>
> Tel: (+354) 415 0202
> palli@greenqloud.com
> www.greenqloud.com
>
>
>
>

Create template from snapshot using ec2

Posted by Páll Helgason <pa...@greenqloud.com>.
Hi,

Maybe someone here can help me with this. I’m trying to create a template from a snapshot (CS 4.2.1 + VMWare 5.0) created with the ec2 tools. Creating the snapshot works just fine (and so does ec2-create-image). But when I try to register the snapshot as a template it’s just not working. 

The command I use is ec2-register -d test -n CentosFromSnapshot -s c651d9b9-fd17-4002-b32f-c46ad27c93ac -a ova:VUmc:Other:VMWare (figured out the -a stuff from the code). According to the awsapi logs this calls 

http://127.0.0.1:8080/client/api?command=registerTemplate&response=json&zoneid=596ee614-0917-496c-bce3-129254c3e110&hypervisor=VMWare&name=CentosFromSnapshot&displaytext=test&format=ova&url=null&ostypeid=1f3da26c-c553-11e3-b989-005056b0541d&apikey=xxx&signature=xxxx

which of course fails on the url. Going through the code I can’t find anything that is handling the -s parameter. Am I missing something or is this not implemented?

Cheers,

-- 
Páll Helgason
Core Team

Tel: (+354) 415 0202 
palli@greenqloud.com
www.greenqloud.com





Re: CloudStack 4.3+ Plugins

Posted by Nate Gordon <na...@appcore.com>.
With spring you can externalize values like this in a properties file. You
can then use classpath loading of the properties file in your spring xml
which allows you to have a properties file in your jar that provides sane
defaults, and a properties file in the WEB-INF/classes folder that
overrides it. You can check out the config at:
http://docs.spring.io/spring/docs/3.2.8.RELEASE/spring-framework-reference/htmlsingle/#beans-factory-placeholderconfigurer

We are doing something similar to configure some custom plugins we are
working on, but with groovy and spring java config. For example something
like this (I didn't even remotely test this example conversion for syntax
or typos):

context.xml:

<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  <property name="locations" value="classpath:com/foo/myplugin.properties"/>
</bean>
<bean id="elastistorDataStoreProvider"
 class="org.apache.cloudstack.storage.datastore.provider.
ElastistorPrimaryDataStoreProvider">
        <property name="esmanagementip" value="${myplugin.esmanagementip}"/>
        <property name="esapikey" value="${myplugin.esapikey}"/>
        <property name="esaccountid" value="${myplugin.esaccountid}"/>
        <property name="espoolid" value="${myplugin.espoolid}"/>
        <property name="esdefaultgateway" value="
${myplugin.esdefaultgateway}"/>
        <property name="essubnet" value="${myplugin.essubnet}"/>
        <property name="estntinterface" value="${myplugin.estntinerface}"/>
  </bean>

myplugin.properties:
myplugin.esmanagementip=10.10.171.180
...



On Thu, Apr 24, 2014 at 12:34 AM, Punith S <pu...@cloudbyte.com> wrote:

> hi,
>
> its good to have privately modularized context for plugins, but how do we
> inject the required variables from the component context after building the
> jars in 4.3 ?
> in 4.2 i used to inject the required params for my plugin from the
> componentcontext.xml after building the jars. so that params values can be
> changed at any point of time.
> all you need to do was to just restart the management server.
> ref - <bean id="elastistorDataStoreProvider"
>
>  class="org.apache.cloudstack.storage.datastore.provider.ElastistorPrimaryDataStoreProvider">
>         <property name="esmanagementip" value="10.10.171.180"/>
>         <property name="esapikey"
>
> value="PubSInZaCji8hrRfOsCxgbug2I2k_sRJ0i2a9qmAzZIiCTcFPmZelzx6uNK9TYgqkdohCmq1L2J9eYmUe9YO6A"/>
>         <property name="esaccountid"
> value="9e9f67d5-e06f-4d63-a0b8-e7255cba84b8"/>
>         <property name="espoolid"
> value="d2d15d11-0f06-3426-a097-3e6e8b36f85c"/>
>         <property name="esdefaultgateway" value="10.10.1.1"/>
>         <property name="essubnet" value="8"/>
>         <property name="estntinterface" value="em0"/>
>   </bean>
>
> but in 4.3 i'm not able to access my context.xml for injecting param values
> once i build my jars. !!
> any workaround available to do this ?
>
> thanks.
>
>
> On Thu, Apr 24, 2014 at 12:34 AM, Chris Suich <cs...@gmail.com> wrote:
>
> > Hey Matt,
> >
> > Your correct in seeing that some improvements were made in 4.3 to
> > support more modularized plugins. This wiki page and its two child
> > pages should help you get started:
> > https://cwiki.apache.org/confluence/display/CLOUDSTACK/Modularize+Spring
> >
> > You no longer NEED to put your commands in the commands.properties.in
> > file as they can be specified in the API annotation now (they can be
> > put in the file to allow users to white/blacklist the file per use
> > role if they desire). Each module can also specify its own application
> > context so that everything is privately modularized.
> >
> > Take a look at the SolidFire storage plugin. That module is using the
> > new form of Spring extensions.
> >
> > -Chris
> >
> > On Wed, Apr 23, 2014 at 10:00 AM, Matt Spurlin <matt.spurlin@appcore.com
> >
> > wrote:
> > > In version 4.2 and below to get a plugin to work, I was adding a
> > dependency in the pom.xml of the Client project and modifying
> > applicationContext.xml.inand commands.properties.in. 4.3 appears to have
> > introduces discoverable plugins. What needs to be done differently in
> order
> > to take advantage of this?
> > > Thank you for your time,
> > > Matt
> >
> >
> >
> > --
> > Chris Suich
> > 919-334-8193
> > csuich2@gmail.com
> >
>
>
>
> --
> regards,
>
> punith s
> cloudbyte.com
>



-- 


*Nate Gordon*Director of Technology | Appcore - the business of cloud
computing®

Office +1.800.735.7104  |  Direct +1.515.612.7787
nate.gordon@appcore.com  |  www.appcore.com

----------------------------------------------------------------------

The information in this message is intended for the named recipients only.
It may contain information that is privileged, confidential or otherwise
protected from disclosure. If you are not the intended recipient, you are
hereby notified that any disclosure, copying, distribution, or the taking
of any action in reliance on the contents of this message is strictly
prohibited. If you have received this e-mail in error, do not print it or
disseminate it or its contents. In such event, please notify the sender by
return e-mail and delete the e-mail file immediately thereafter. Thank you.

Re: CloudStack 4.3+ Plugins

Posted by Punith S <pu...@cloudbyte.com>.
hi,

its good to have privately modularized context for plugins, but how do we
inject the required variables from the component context after building the
jars in 4.3 ?
in 4.2 i used to inject the required params for my plugin from the
componentcontext.xml after building the jars. so that params values can be
changed at any point of time.
all you need to do was to just restart the management server.
ref - <bean id="elastistorDataStoreProvider"
 class="org.apache.cloudstack.storage.datastore.provider.ElastistorPrimaryDataStoreProvider">
        <property name="esmanagementip" value="10.10.171.180"/>
        <property name="esapikey"
value="PubSInZaCji8hrRfOsCxgbug2I2k_sRJ0i2a9qmAzZIiCTcFPmZelzx6uNK9TYgqkdohCmq1L2J9eYmUe9YO6A"/>
        <property name="esaccountid"
value="9e9f67d5-e06f-4d63-a0b8-e7255cba84b8"/>
        <property name="espoolid"
value="d2d15d11-0f06-3426-a097-3e6e8b36f85c"/>
        <property name="esdefaultgateway" value="10.10.1.1"/>
        <property name="essubnet" value="8"/>
        <property name="estntinterface" value="em0"/>
  </bean>

but in 4.3 i'm not able to access my context.xml for injecting param values
once i build my jars. !!
any workaround available to do this ?

thanks.


On Thu, Apr 24, 2014 at 12:34 AM, Chris Suich <cs...@gmail.com> wrote:

> Hey Matt,
>
> Your correct in seeing that some improvements were made in 4.3 to
> support more modularized plugins. This wiki page and its two child
> pages should help you get started:
> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Modularize+Spring
>
> You no longer NEED to put your commands in the commands.properties.in
> file as they can be specified in the API annotation now (they can be
> put in the file to allow users to white/blacklist the file per use
> role if they desire). Each module can also specify its own application
> context so that everything is privately modularized.
>
> Take a look at the SolidFire storage plugin. That module is using the
> new form of Spring extensions.
>
> -Chris
>
> On Wed, Apr 23, 2014 at 10:00 AM, Matt Spurlin <ma...@appcore.com>
> wrote:
> > In version 4.2 and below to get a plugin to work, I was adding a
> dependency in the pom.xml of the Client project and modifying
> applicationContext.xml.inand commands.properties.in. 4.3 appears to have
> introduces discoverable plugins. What needs to be done differently in order
> to take advantage of this?
> > Thank you for your time,
> > Matt
>
>
>
> --
> Chris Suich
> 919-334-8193
> csuich2@gmail.com
>



-- 
regards,

punith s
cloudbyte.com

Re: CloudStack 4.3+ Plugins

Posted by Chris Suich <cs...@gmail.com>.
Hey Matt,

Your correct in seeing that some improvements were made in 4.3 to
support more modularized plugins. This wiki page and its two child
pages should help you get started:
https://cwiki.apache.org/confluence/display/CLOUDSTACK/Modularize+Spring

You no longer NEED to put your commands in the commands.properties.in
file as they can be specified in the API annotation now (they can be
put in the file to allow users to white/blacklist the file per use
role if they desire). Each module can also specify its own application
context so that everything is privately modularized.

Take a look at the SolidFire storage plugin. That module is using the
new form of Spring extensions.

-Chris

On Wed, Apr 23, 2014 at 10:00 AM, Matt Spurlin <ma...@appcore.com> wrote:
> In version 4.2 and below to get a plugin to work, I was adding a dependency in the pom.xml of the Client project and modifying applicationContext.xml.inand commands.properties.in. 4.3 appears to have introduces discoverable plugins. What needs to be done differently in order to take advantage of this?
> Thank you for your time,
> Matt



-- 
Chris Suich
919-334-8193
csuich2@gmail.com