You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jclouds.apache.org by Mohan Baruwal Chhetri <mo...@gmail.com> on 2013/08/01 01:44:40 UTC

Issue using JClouds with Ninefold

Hi,

I am trying to create an instance on Ninefold using the JClouds API.

        ComputeServiceContext computeServiceContext =
ContextBuilder.newBuilder("ninefold-compute").
                credentials(identity, credentials).
                endpoint("https://api.ninefold.com/compute/v2.0").
                modules(modules).
                overrides(p).
                buildView(ComputeServiceContext.class);
        ComputeService computeService =
computeServiceContext.getComputeService();

I have changed the endpoint to point to the api version 2.0.

I then create a template where I specify explicitly the imageId, locationId
and hardwareId

Template template = computeService.templateBuilder().options(tOptions).
                imageId("<Image-ID>").
                locationId("<Location-ID").
                hardwareId("Hardware-ID").build();

However, when I try to create an image as follows:

       try {
            computeService.createNodesInGroup("mohan", 1, template);
        } catch (RunNodesException ex) {

Logger.getLogger(CloudStackSCBClient.class.getName()).log(Level.SEVERE,
null, ex);
        }

I get an "imageId not found" exception.

On examining the logs I see that the query to retrieve templates is as
follows:

https://api.ninefold.com/compute/v2.0?response=json&command=listTemplates&listAll=true&templatefilter=executable&apiKey=

But in the CloudStackAPI, it says that we need to specify the project id as
well in order to get details of the private templates. The above query
retrieves only the public templates.

How do I specify the CloudStack specific project id as part of my request?
I've tried to use the CloudStackTemplateOptions where I specify the
projectId as part of the user metadata as well as part of the properties
that can be used to override the default properties when instantiating the
ComputeServiceContext.

I couldn't find any working example to show how to create instances on
cloud infrastructure built using CloudStack.

Any help would be appreciated.

Cheers,
Mohan

Re: Issue using JClouds with Ninefold

Posted by Andrew Bayer <an...@gmail.com>.
Hmm. Could you open a JIRA for this at https://issues.apache.org? I'll dig
into it.

A.

On Wed, Jul 31, 2013 at 4:44 PM, Mohan Baruwal Chhetri <
mohanbaruwal@gmail.com> wrote:

> Hi,
>
> I am trying to create an instance on Ninefold using the JClouds API.
>
>         ComputeServiceContext computeServiceContext =
> ContextBuilder.newBuilder("ninefold-compute").
>                 credentials(identity, credentials).
>                 endpoint("https://api.ninefold.com/compute/v2.0").
>                 modules(modules).
>                 overrides(p).
>                 buildView(ComputeServiceContext.class);
>         ComputeService computeService =
> computeServiceContext.getComputeService();
>
> I have changed the endpoint to point to the api version 2.0.
>
> I then create a template where I specify explicitly the imageId,
> locationId and hardwareId
>
> Template template = computeService.templateBuilder().options(tOptions).
>                 imageId("<Image-ID>").
>                 locationId("<Location-ID").
>                 hardwareId("Hardware-ID").build();
>
> However, when I try to create an image as follows:
>
>        try {
>             computeService.createNodesInGroup("mohan", 1, template);
>         } catch (RunNodesException ex) {
>
> Logger.getLogger(CloudStackSCBClient.class.getName()).log(Level.SEVERE,
> null, ex);
>         }
>
> I get an "imageId not found" exception.
>
> On examining the logs I see that the query to retrieve templates is as
> follows:
>
>
> https://api.ninefold.com/compute/v2.0?response=json&command=listTemplates&listAll=true&templatefilter=executable&apiKey=
>
> But in the CloudStackAPI, it says that we need to specify the project id
> as well in order to get details of the private templates. The above query
> retrieves only the public templates.
>
> How do I specify the CloudStack specific project id as part of my request?
> I've tried to use the CloudStackTemplateOptions where I specify the
> projectId as part of the user metadata as well as part of the properties
> that can be used to override the default properties when instantiating the
> ComputeServiceContext.
>
> I couldn't find any working example to show how to create instances on
> cloud infrastructure built using CloudStack.
>
> Any help would be appreciated.
>
> Cheers,
> Mohan
>

Re: Issue using JClouds with Ninefold

Posted by Andrew Bayer <an...@gmail.com>.
Actually, the filter should be returning every template that's executable,
across all projects, etc...I don't think the project id is the issue, I
think the issue is that your templates aren't marked as executable.

A.

On Wed, Jul 31, 2013 at 5:20 PM, Mohan Baruwal Chhetri <
mohanbaruwal@gmail.com> wrote:

> Hi Andrew,
>
> I haven't tried the TemplateApi directly, but on examining the
> listTemplates method, the query parameters are 'command:listTemplates' and
> 'listall:true' and 'templatefilter:true'
>
> If I use ComputeService to listImages(), I get only the public templates
> which are:
>
> 10:12:30.810 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector - bfbfd106-1f2c-4401-8bfb-c0d4db22be1a,
> ninefold_app_template
> 10:12:30.810 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector - 1173bd05-a251-4f24-8aa1-ada42b70a043,
> CentOS 6.4
> 10:12:30.810 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector - 2943770f-51fc-47b2-b211-74344dc84cf8,
> Debian 7.0
> 10:12:30.810 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector - 23e4dc75-8fd3-4659-8724-276349a037e0,
> Ubuntu 13.04
> 10:12:30.810 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector - d26ba567-63e0-4563-9d5f-349e9fc18a2c,
> Ubuntu 12.10
> 10:12:30.810 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector - 3008bb3b-73ab-4436-a781-e3070245a2a9,
> Ubuntu 12.04.2 LTS
> 10:12:30.811 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector - 6c2a1750-c5fd-4861-8b33-3232009b9156,
> Fedora 18
> 10:12:30.812 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector - 333e5e38-25eb-4a5d-a72e-aaae7a20d883,
> CentOS 6.3
> 10:12:30.812 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector - 09c74deb-45bb-4ba5-84aa-93b9558a5588,
> Windows 2008 R2 - Enterprise
> 10:12:30.812 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector - 04ab04ce-7587-48c2-9892-58b7615a3dd5,
> Windows 2012 - DataCentre
> 10:12:30.812 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector - 35a0bb4f-7a7a-4f4c-bf9b-6536596c0825,
> Ninefold App Template
>
> The reason for this is the way the query is constructed:
>
>
> https://api.ninefold.com/compute/v2.0?response=json&command=listTemplates&listAll=true&templatefilter=executable- this only returns public templates.
>
> I have written a wrapper for the CloudStack API which correctly constructs
> the query as follows:
>
>
> https://api.ninefold.com/compute/v2.0?command=listTemplates&listall=true&templatefilter=self&projectid=
> <id>&apiKey=<key>&signature=<signature>
>
> This correctly returns the templates that I own in addition to the public
> templates.
>
> So, what is happening is that the listTemplates() method requires an
> additional parameter 'projectid' in order to retrieve the private
> templates. At the moment this is missing.
>
> Cheers,
> Mohan
>
>
> On Thu, Aug 1, 2013 at 10:09 AM, Andrew Phillips <an...@apache.org>wrote:
>
>> But in the CloudStackAPI, it says that we need to specify the project id
>>> as
>>> well in order to get details of the private templates. The above query
>>> retrieves only the public templates.
>>>
>>
>> I can't see any explicit support for private templates, but the
>> TemplateApi [1] comments do seem to talk about them - have you been able to
>> use the listTemplates() command or the updateTemplatePermissions() to check
>> whether jclouds can find them?
>>
>> ap
>>
>> [1] https://github.com/jclouds/**jclouds/blob/master/apis/**
>> cloudstack/src/main/java/org/**jclouds/cloudstack/features/**
>> TemplateApi.java#L247<https://github.com/jclouds/jclouds/blob/master/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/TemplateApi.java#L247>
>>
>
>
>
>
>

Re: Issue using JClouds with Ninefold

Posted by Mohan Baruwal Chhetri <mo...@gmail.com>.
Hi Andrew,

I haven't tried the TemplateApi directly, but on examining the
listTemplates method, the query parameters are 'command:listTemplates' and
'listall:true' and 'templatefilter:true'

If I use ComputeService to listImages(), I get only the public templates
which are:

10:12:30.810 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector -
bfbfd106-1f2c-4401-8bfb-c0d4db22be1a,
ninefold_app_template
10:12:30.810 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector -
1173bd05-a251-4f24-8aa1-ada42b70a043,
CentOS 6.4
10:12:30.810 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector -
2943770f-51fc-47b2-b211-74344dc84cf8,
Debian 7.0
10:12:30.810 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector -
23e4dc75-8fd3-4659-8724-276349a037e0,
Ubuntu 13.04
10:12:30.810 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector -
d26ba567-63e0-4563-9d5f-349e9fc18a2c,
Ubuntu 12.10
10:12:30.810 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector -
3008bb3b-73ab-4436-a781-e3070245a2a9,
Ubuntu 12.04.2 LTS
10:12:30.811 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector -
6c2a1750-c5fd-4861-8b33-3232009b9156,
Fedora 18
10:12:30.812 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector -
333e5e38-25eb-4a5d-a72e-aaae7a20d883,
CentOS 6.3
10:12:30.812 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector -
09c74deb-45bb-4ba5-84aa-93b9558a5588,
Windows 2008 R2 - Enterprise
10:12:30.812 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector -
04ab04ce-7587-48c2-9892-58b7615a3dd5,
Windows 2012 - DataCentre
10:12:30.812 [main] DEBUG a.e.s.s.cloudconnect.CloudConnector -
35a0bb4f-7a7a-4f4c-bf9b-6536596c0825,
Ninefold App Template

The reason for this is the way the query is constructed:

https://api.ninefold.com/compute/v2.0?response=json&command=listTemplates&listAll=true&templatefilter=executable-
this only returns public templates.

I have written a wrapper for the CloudStack API which correctly constructs
the query as follows:

https://api.ninefold.com/compute/v2.0?command=listTemplates&listall=true&templatefilter=self&projectid=
<id>&apiKey=<key>&signature=<signature>

This correctly returns the templates that I own in addition to the public
templates.

So, what is happening is that the listTemplates() method requires an
additional parameter 'projectid' in order to retrieve the private
templates. At the moment this is missing.

Cheers,
Mohan


On Thu, Aug 1, 2013 at 10:09 AM, Andrew Phillips <an...@apache.org> wrote:

> But in the CloudStackAPI, it says that we need to specify the project id as
>> well in order to get details of the private templates. The above query
>> retrieves only the public templates.
>>
>
> I can't see any explicit support for private templates, but the
> TemplateApi [1] comments do seem to talk about them - have you been able to
> use the listTemplates() command or the updateTemplatePermissions() to check
> whether jclouds can find them?
>
> ap
>
> [1] https://github.com/jclouds/**jclouds/blob/master/apis/**
> cloudstack/src/main/java/org/**jclouds/cloudstack/features/**
> TemplateApi.java#L247<https://github.com/jclouds/jclouds/blob/master/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/TemplateApi.java#L247>
>

Re: Issue using JClouds with Ninefold

Posted by Andrew Phillips <an...@apache.org>.
> But in the CloudStackAPI, it says that we need to specify the project id as
> well in order to get details of the private templates. The above query
> retrieves only the public templates.

I can't see any explicit support for private templates, but the  
TemplateApi [1] comments do seem to talk about them - have you been  
able to use the listTemplates() command or the  
updateTemplatePermissions() to check whether jclouds can find them?

ap

[1]  
https://github.com/jclouds/jclouds/blob/master/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/TemplateApi.java#L247