You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jclouds.apache.org by Vijay Sukthankar <vi...@gmail.com> on 2014/03/20 00:24:45 UTC

CreateServer()

I am still a newbie to jclouds and trying to get some understanding on
jclouds APIs....I am trying to create a server on devstack using the
following..

 private void CreateServer() {
            CreateServerOptions n = new CreateServerOptions();
            ServerApi serverApi =
nova.getApi().getServerForZone("RegioneOne");
            ServerCreated servercreated  =
serverApi.create("jclouds-server", "cirrus-0.3.1_x86_64-

usec","m1-tiny",n);
}

I get an exception for the above..



-- 
Regards
Vijay Sukthankar

Re: CreateServer()

Posted by Andrew Phillips <an...@apache.org>.
> http://10.0.2.15:8774/v2/1d83ccc107c545f78c59c6580ba64367/serversHTTP/1.1
> failed with response: HTTP/1.1 400 Bad Request; content:
> [{"badRequest": {"message": "Invalid imageRef provided.", "code": 400}}]

My initial guess would be that it doesn't like one of the following  
arguments you're passing:

"jclouds-server","cirrus-0.3.1-x86_64-usec","m1-tiny"

Probably "cirrus-0.3.1-x86_64-usec" or "m1-tiny".

Are you able to verify that these are correct and work if you don't  
use jclouds?

Regards!

ap

Re: CreateServer()

Posted by Andrew Phillips <an...@apache.org>.
> Your third argument is also wrong.  It's supposed to be the UUID of   
> the image flavor.

Thanks for providing the missing details I didn't know, Jeffrey ;-)

ap

Re: CreateServer()

Posted by "Jeffrey Nguyen (jeffrngu)" <je...@cisco.com>.
Your third argument is also wrong.  It's supposed to be the UUID of the image flavor.

-Jeffrey

From: jeffrngu <je...@cisco.com>>
Date: Wednesday, March 19, 2014 7:53 PM
To: "user@jclouds.apache.org<ma...@jclouds.apache.org>" <us...@jclouds.apache.org>>
Subject: Re: CreateServer()

Hi Vijay,

In your call "serverApi.create()", the second param's supposed to be the UUID of the image, not the name as you have in your code (shown below).

ServerCreated servercreated = serverApi.create("jclouds-server","cirrus-0.3.1-x86_64-usec","m1-tiny",n);


-Jeffrey


From: Vijay Sukthankar <vi...@gmail.com>>
Reply-To: "user@jclouds.apache.org<ma...@jclouds.apache.org>" <us...@jclouds.apache.org>>
Date: Wednesday, March 19, 2014 6:16 PM
To: "user@jclouds.apache.org<ma...@jclouds.apache.org>" <us...@jclouds.apache.org>>
Subject: Re: CreateServer()

Exception in thread "main" org.jclouds.http.HttpResponseException: command: POST http://10.0.2.15:8774/v2/1d83ccc107c545f78c59c6580ba64367/servers HTTP/1.1 failed with response: HTTP/1.1 400 Bad Request; content: [{"badRequest": {"message": "Invalid imageRef provided.", "code": 400}}]
    at org.jclouds.openstack.nova.v2_0.handlers.NovaErrorHandler.handleError(NovaErrorHandler.java:83)
    at org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:69)
    at org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:182)
    at org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:152)
    at org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.invoke(InvokeSyncToAsyncHttpMethod.java:133)
    at org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.apply(InvokeSyncToAsyncHttpMethod.java:99)
    at org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.apply(InvokeSyncToAsyncHttpMethod.java:60)
    at org.jclouds.reflect.FunctionalReflection$FunctionalInvocationHandler.handleInvocation(FunctionalReflection.java:119)
    at com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:70)
    at sun.proxy.$Proxy74.create(Unknown Source)
    at JCloudsManualAuthentication.CreateServer(JCloudsManualAuthentication.java:163)
    at JCloudsManualAuthentication.main(JCloudsManualAuthentication.java:61)


On Thu, Mar 20, 2014 at 7:31 AM, Andrew Phillips <an...@apache.org>> wrote:
https://gist.github.com/vksuktha/9655554

Thanks for that...now please just add the actual exception you're getting (i.e. the full stacktrace) ;-)

Regards

ap



--
Regards
Vijay Sukthankar

Re: CreateServer()

Posted by "Jeffrey Nguyen (jeffrngu)" <je...@cisco.com>.
Hi Vijay,

In your call "serverApi.create()", the second param's supposed to be the UUID of the image, not the name as you have in your code (shown below).

ServerCreated servercreated = serverApi.create("jclouds-server","cirrus-0.3.1-x86_64-usec","m1-tiny",n);


-Jeffrey


From: Vijay Sukthankar <vi...@gmail.com>>
Reply-To: "user@jclouds.apache.org<ma...@jclouds.apache.org>" <us...@jclouds.apache.org>>
Date: Wednesday, March 19, 2014 6:16 PM
To: "user@jclouds.apache.org<ma...@jclouds.apache.org>" <us...@jclouds.apache.org>>
Subject: Re: CreateServer()

Exception in thread "main" org.jclouds.http.HttpResponseException: command: POST http://10.0.2.15:8774/v2/1d83ccc107c545f78c59c6580ba64367/servers HTTP/1.1 failed with response: HTTP/1.1 400 Bad Request; content: [{"badRequest": {"message": "Invalid imageRef provided.", "code": 400}}]
    at org.jclouds.openstack.nova.v2_0.handlers.NovaErrorHandler.handleError(NovaErrorHandler.java:83)
    at org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:69)
    at org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:182)
    at org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:152)
    at org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.invoke(InvokeSyncToAsyncHttpMethod.java:133)
    at org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.apply(InvokeSyncToAsyncHttpMethod.java:99)
    at org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.apply(InvokeSyncToAsyncHttpMethod.java:60)
    at org.jclouds.reflect.FunctionalReflection$FunctionalInvocationHandler.handleInvocation(FunctionalReflection.java:119)
    at com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:70)
    at sun.proxy.$Proxy74.create(Unknown Source)
    at JCloudsManualAuthentication.CreateServer(JCloudsManualAuthentication.java:163)
    at JCloudsManualAuthentication.main(JCloudsManualAuthentication.java:61)


On Thu, Mar 20, 2014 at 7:31 AM, Andrew Phillips <an...@apache.org>> wrote:
https://gist.github.com/vksuktha/9655554

Thanks for that...now please just add the actual exception you're getting (i.e. the full stacktrace) ;-)

Regards

ap



--
Regards
Vijay Sukthankar

Re: CreateServer()

Posted by Vijay Sukthankar <vi...@gmail.com>.
Exception in thread "main" org.jclouds.http.HttpResponseException: command:
POST http://10.0.2.15:8774/v2/1d83ccc107c545f78c59c6580ba64367/serversHTTP/1.1
failed with response: HTTP/1.1 400 Bad Request; content:
[{"badRequest": {"message": "Invalid imageRef provided.", "code": 400}}]
    at
org.jclouds.openstack.nova.v2_0.handlers.NovaErrorHandler.handleError(NovaErrorHandler.java:83)
    at
org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:69)
    at
org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:182)
    at
org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:152)
    at
org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.invoke(InvokeSyncToAsyncHttpMethod.java:133)
    at
org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.apply(InvokeSyncToAsyncHttpMethod.java:99)
    at
org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.apply(InvokeSyncToAsyncHttpMethod.java:60)
    at
org.jclouds.reflect.FunctionalReflection$FunctionalInvocationHandler.handleInvocation(FunctionalReflection.java:119)
    at
com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:70)
    at sun.proxy.$Proxy74.create(Unknown Source)
    at
JCloudsManualAuthentication.CreateServer(JCloudsManualAuthentication.java:163)
    at JCloudsManualAuthentication.main(JCloudsManualAuthentication.java:61)


On Thu, Mar 20, 2014 at 7:31 AM, Andrew Phillips <an...@apache.org> wrote:

> https://gist.github.com/vksuktha/9655554
>>
>
> Thanks for that...now please just add the actual exception you're getting
> (i.e. the full stacktrace) ;-)
>
> Regards
>
> ap
>



-- 
Regards
Vijay Sukthankar

Re: CreateServer()

Posted by Andrew Phillips <an...@apache.org>.
> https://gist.github.com/vksuktha/9655554

Thanks for that...now please just add the actual exception you're  
getting (i.e. the full stacktrace) ;-)

Regards

ap

Re: CreateServer()

Posted by Vijay Sukthankar <vi...@gmail.com>.
https://gist.github.com/vksuktha/9655554


On Thu, Mar 20, 2014 at 5:01 AM, Andrew Phillips <an...@apache.org> wrote:

> Hi Vijay
>
> Could you post the exception you are seeing, as well as the code you are
> using to create the "nova" context, to a Gist or Pastie [1, 2]?
>
> Please of course replace any credentials with dummy values first!
>
> Regards
>
> ap
>
> [1] https://gist.github.com
> [2] http://pastie.org
>



-- 
Regards
Vijay Sukthankar

Re: CreateServer()

Posted by Andrew Phillips <an...@apache.org>.
Hi Vijay

Could you post the exception you are seeing, as well as the code you  
are using to create the "nova" context, to a Gist or Pastie [1, 2]?

Please of course replace any credentials with dummy values first!

Regards

ap

[1] https://gist.github.com
[2] http://pastie.org

Re: CreateServer()

Posted by Andrew Phillips <an...@apache.org>.
> Thanks that fixed the issue

Good to hear - thanks for letting us know!

ap

Re: CreateServer()

Posted by Vijay Sukthankar <vi...@gmail.com>.
Thanks that fixed the issue


On Thu, Mar 20, 2014 at 5:21 PM, Jayant Kaushal <aw...@gmail.com>wrote:

> check with image id than image name.
> may be that will work.
>
>
>
> Regards
> Jayant Kaushal
>
>
>
> On Thu, Mar 20, 2014 at 4:54 AM, Vijay Sukthankar <
> vijay.sukthankar@gmail.com> wrote:
>
>> I am still a newbie to jclouds and trying to get some understanding on
>> jclouds APIs....I am trying to create a server on devstack using the
>> following..
>>
>>  private void CreateServer() {
>>             CreateServerOptions n = new CreateServerOptions();
>>             ServerApi serverApi =
>> nova.getApi().getServerForZone("RegioneOne");
>>             ServerCreated servercreated  =
>> serverApi.create("jclouds-server", "cirrus-0.3.1_x86_64-
>>
>> usec","m1-tiny",n);
>> }
>>
>> I get an exception for the above..
>>
>>
>>
>> --
>> Regards
>> Vijay Sukthankar
>>
>
>


-- 
Regards
Vijay Sukthankar

Re: CreateServer()

Posted by Jayant Kaushal <aw...@gmail.com>.
check with image id than image name.
may be that will work.



Regards
Jayant Kaushal



On Thu, Mar 20, 2014 at 4:54 AM, Vijay Sukthankar <
vijay.sukthankar@gmail.com> wrote:

> I am still a newbie to jclouds and trying to get some understanding on
> jclouds APIs....I am trying to create a server on devstack using the
> following..
>
>  private void CreateServer() {
>             CreateServerOptions n = new CreateServerOptions();
>             ServerApi serverApi =
> nova.getApi().getServerForZone("RegioneOne");
>             ServerCreated servercreated  =
> serverApi.create("jclouds-server", "cirrus-0.3.1_x86_64-
>
> usec","m1-tiny",n);
> }
>
> I get an exception for the above..
>
>
>
> --
> Regards
> Vijay Sukthankar
>