Openstack and cloudservers

30 views
Skip to first unread message

Christophe Hamerling

unread,
Jan 10, 2012, 2:31:35 PM1/10/12
to jclouds
Hi all,

I am using clouds to interact with openstack and I have some troubles
with it. I do not known if it is an openstack problem or a cloud one.
So let's see what you think:

I am not able to use jclouds with the openstack instance using the
openstack drivers, so I tried to use the cloudservers-us driver which
seems to work. It works but not in all cases...

1. Using cloudfiles-us to interact with swift : OK
2. Using cloudservers-us to list images and instances : OK
3. Using cloudservers-us to start instance : KO

Here is the error message I have on point 3:

org.petalslink.edelweiss.core.CloudException:
org.jclouds.compute.RunNodesException: error running 1 node
tag(default) location(cloudservers-us) image(39) size(10)
options([inboundPorts=[22], privateKey=false, publicKey=false,
runScript=false, blockUntilRunning=true, blockOnComplete=true,
port:seconds=-1:-1, userMetadata: {}])
Execution failures:

1) ExecutionException on default-52c:
java.util.concurrent.ExecutionException:
org.jclouds.http.HttpResponseException: command: POST
http://94.143.114.137:8774/v1.1/petalslink/servers?format=json HTTP/
1.1 failed with response: HTTP/1.1 400 Bad Request; content:
[{"badRequest": {"message": "Missing imageRef attribute", "code":
400}}]
at com.google.common.util.concurrent.AbstractFuture
$Sync.getValue(AbstractFuture.java:328)
...

What about this imageRef attribute, I can not find it anywhere. I
created the context like that:

String imageId = node.getImage();
if (imageId == null) {
imageId = "39";
}

org.jclouds.compute.ComputeService client = getClient(imageId);

Set<? extends NodeMetadata> createdNodes;
try {
createdNodes = client.createNodesInGroup(
"default", 1, getTemplate(client, imageId));
} catch (RunNodesException e) {
throw new CloudException(e);
}


with #getClient

private org.jclouds.compute.ComputeService getClient(String imageId)
{
// If we specify the image, it doesn't download info about all
others
Properties props = new Properties();
// overrides.setProperty(AWSEC2Constants.PROPERTY_EC2_AMI_QUERY,
// "image-id=" + imageId);
//props.setProperty(AWSEC2Constants.PROPERTY_EC2_AMI_QUERY,
"image-id=" + imageId);
props.put(Constants.PROPERTY_ENDPOINT, MYNOVAENDPOINT);
props.put(Constants.PROPERTY_IDENTITY, ME);
props.put(Constants.PROPERTY_CREDENTIAL, CRED);

// also works with version 1.0
props.put(Constants.PROPERTY_API_VERSION, "1.1");

// get a context with ec2 that offers the portable ComputeService
api
// example of injecting a ssh implementation
Iterable<Module> modules = ImmutableSet.<Module> of(
new SshjSshClientModule(), new SLF4JLoggingModule(),
new EnterpriseConfigurationModule());

return new ComputeServiceContextFactory().createContext(provider,
ME, CRED, modules, props)
.getComputeService();
}


As I said, I can get images and instances with the same approach. ANy
suggestions?
Thanks a lot!

Andrew Phillips

unread,
Jan 10, 2012, 3:00:51 PM1/10/12
to jcl...@googlegroups.com
Hi Christophe

First things first ;-)

> 1) ExecutionException on default-52c:
> java.util.concurrent.ExecutionException:
> org.jclouds.http.HttpResponseException: command: POST
> http://94.143.114.137:8774/v1.1/petalslink/servers?format=json HTTP/
> 1.1 failed with response: HTTP/1.1 400 Bad Request; content:
> [{"badRequest": {"message": "Missing imageRef attribute", "code":
> 400}}]

looks like it might be related to https://bugs.launchpad.net/nova/+bug/879318

Could you switch on wire and header logging (see towards the bottom of
[1]) so we can see what's actually being sent?

Note also that the unit tests [2] can be a useful reference point for
how to construct certain requests, i.e. which inputs are expected and
what the response should be.

Moving on:

> I am not able to use jclouds with the openstack instance using the
> openstack drivers, so I tried to use the cloudservers-us driver which
> seems to work. It works but not in all cases...

Out of curiosity, which errors were you running into?

Thanks!

ap

[1] http://www.jclouds.org/documentation/reference/jclouds-logging
[2]
https://github.com/jclouds/jclouds/blob/master/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersAsyncClientTest.java

Christophe Hamerling

unread,
Jan 11, 2012, 7:58:19 AM1/11/12
to jclouds
Hi,

1. I am now able to create instance with the nova driver by getting
the nova specific context and its API client but not by using the
jclouds abstraction.

2. When using the nova driver, here is the error I have on instance
create call:

java.lang.IllegalStateException: URI is not available
at org.jclouds.openstack.nova.domain.Resource.getURI(Resource.java:
50)
at
org.jclouds.openstack.nova.compute.functions.NovaImageToImage.apply(NovaImageToImage.java:
52)
at
org.jclouds.openstack.nova.compute.functions.NovaImageToImage.apply(NovaImageToImage.java:
35)
at com.google.common.collect.Iterators$8.next(Iterators.java:782)
at com.google.common.collect.Sets.newLinkedHashSet(Sets.java:267)
at
org.jclouds.openstack.nova.compute.suppliers.NovaImageSupplier.get(NovaImageSupplier.java:
65)
at
org.jclouds.openstack.nova.compute.suppliers.NovaImageSupplier.get(NovaImageSupplier.java:
44)
at org.jclouds.compute.config.BaseComputeServiceContextModule
$8.get(BaseComputeServiceContextModule.java:219)
at org.jclouds.compute.config.BaseComputeServiceContextModule
$8.get(BaseComputeServiceContextModule.java:216)
at
org.jclouds.rest.suppliers.SetAndThrowAuthorizationExceptionSupplier.get(SetAndThrowAuthorizationExceptionSupplier.java:
49)
at
org.jclouds.concurrent.RetryOnTimeOutExceptionSupplier.get(RetryOnTimeOutExceptionSupplier.java:
47)
at com.google.common.base.Suppliers
$ExpiringMemoizingSupplier.get(Suppliers.java:173)
at
org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.get(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:
59)
at
org.jclouds.compute.domain.internal.TemplateBuilderImpl.getImages(TemplateBuilderImpl.java:
669)
at
org.jclouds.compute.domain.internal.TemplateBuilderImpl.build(TemplateBuilderImpl.java:
562)
at
org.petalslink.edelweiss.jclouds.ComputeService.getTemplate(ComputeService.java:
209)
at
org.petalslink.edelweiss.jclouds.ComputeService.create(ComputeService.java:
187)
at
org.petalslink.edelweiss.jclouds.ComputeServiceTest.testCreateNode(ComputeServiceTest.java:
49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:
130)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:
38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:
390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:
197)



On 10 jan, 21:00, Andrew Phillips <aphill...@qrmedia.com> wrote:
> Hi Christophe
>
> First things first ;-)
>
> > 1) ExecutionException on default-52c:
> > java.util.concurrent.ExecutionException:
> > org.jclouds.http.HttpResponseException: command: POST
> >http://94.143.114.137:8774/v1.1/petalslink/servers?format=jsonHTTP/
> > 1.1 failed with response: HTTP/1.1 400 Bad Request; content:
> > [{"badRequest": {"message": "Missing imageRef attribute", "code":
> > 400}}]
>
> looks like it might be related tohttps://bugs.launchpad.net/nova/+bug/879318
>
> Could you switch on wire and header logging (see towards the bottom of
> [1]) so we can see what's actually being sent?
>
> Note also that the unit tests [2] can be a useful reference point for
> how to construct certain requests, i.e. which inputs are expected and
> what the response should be.
>
> Moving on:
>
> > I am not able to use jclouds with the openstack instance using the
> > openstack drivers, so I tried to use the cloudservers-us driver which
> > seems to work. It works but not in all cases...
>
> Out of curiosity, which errors were you running into?
>
> Thanks!
>
> ap
>
> [1]http://www.jclouds.org/documentation/reference/jclouds-logging
> [2]  https://github.com/jclouds/jclouds/blob/master/apis/cloudservers/src/...

Andrew Phillips

unread,
Jan 11, 2012, 10:21:27 AM1/11/12
to jcl...@googlegroups.com
> 2. When using the nova driver, here is the error I have on instance
> create call:
>
> java.lang.IllegalStateException: URI is not available
> at org.jclouds.openstack.nova.domain.Resource.getURI(Resource.java:

Thanks for the info, Christophe! Could you post your code to create
and use the context here or in Pastebin [1], or is it the same as in
your previous email?

ap

[1] http://pastebin.com

Reply all
Reply to author
Forward
0 new messages