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!