deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Dietisheim <>
Subject Re: Java REST Client
Date Mon, 07 Jan 2013 16:01:41 GMT
Hi Dario

Happy new year!
Sorry for the late response, but I was on holidays the last 3 weeks.

On 12/31/2012 01:18 PM, Dario Garcia Gasulla wrote:
> Thanks Andre and Mario, your explanations were quite useful.
> The approach you use to create and manage instances is quite simple 
> and intuitive (much better than what I was trying to do).
> I found one more problem, I'll tell you about it to see if you know 
> what I'm doing wrong:
> When launching an instance
> /   instance = client.createInstance(image.getId());/
> there's no way to specify the pem key the instance is supposed to 
> accept. The second create method does not accept key id either:
> /createInstance(String name, String imageId, String profileId, String 
> realmId, String memory, String storage)/
> Unfortunately, if the key is not provided on launch time, the instance 
> will only be accessible through <user,pass> (says Amazon).
> I've tried to set it before and then launch it:/
>         instance.setKeyId("pem_key_file");
> //        instance = client.createInstance(image.getId());/
> But it does not work, and the created instance has no key associated 
> once created. Image doesn't accept keys either.
> I haven't found any other method for defining the key before creating 
> the instance.
> Is there a way to do this?

Afaik the keys were handled at a user global level (and not at an 
instance level - at least that was the case when I wrote the client. 
Things might have changed since then, I dont really know):


The integration tests for the keys are here:;a=blob;f=clients/java/org.apache.deltacloud.client.test/src/org/apache/deltacloud/client/internal/test/client/;h=8591c7c16f02b1d153cafd8ad4d1dcd59639fe45;hb=HEAD

Hope that helps...


> Thanks again, and happy new year!
> Dario.
> El 27/12/12 10:39, escribió:
>> Andre - thanks very much for your very useful input
>> Dario - minor point on clarification inline:
>> On 22/12/12 12:34, André Dietisheim wrote:
>>> Hi Dario
>>> .
>>>> Right now there are several things I wonder about the code. I've been
>>>> capable of figuring out some of them, but not all. If you could help me
>>>> out with the first one, that would be great.
>>>>       -When performing an Action, I set the name (e.g., STOP_NAME) and the
>>>> url from the instance to stop (e.g., instance.getPublicAddress().get(0)).
>>>> This url is of the form: "",
>>>> however I get the following error:
>> the URL you are getting from "instance.getPublicAddress().get(0)" is
>> literally the public address of the ec2 instance. This is the address
>> you would use to (for example) connect to the running instance using an
>> (external) ssh client.
>> Actions are invoked on the actual instance object - as shown clearly in
>> the link below (Andre's test suite):
>> <quote>
>> 1. public void canShutdownInstance() throws DeltaCloudClientException {
>> 2. Instance testInstance = testSetup.getTestInstance();
>> 3. DeltaCloudClient client = testSetup.getClient();
>> 4. testInstance.stop(client);
>> 5. testInstance = client.listInstances(testInstance.getId()); // reload!
>> 6. assertEquals(State.STOPPED, testInstance.getState());
>> }
>> </quote>
>> so on line 2 we get a reference to the instance, and on line 4 call the
>> stop action.
>> marios
>>>>               Could not connect to
>>>> "". The url is invalid.
>>>>               Caused by: no protocol:
>>>> What protocol does this library use? Should I concatenate it at the
>>>> beginning of the url? The address is ok, since I can ping it.
>>> There's a test that I wrote back then to integration-test if the client
>>> can stop a running instance:
>>> The test is running against a local DC which is running with a mock
>>> driver. The url you'd have to pass to the client is a fully fledged URL
>>> (with protocol):
>>> Afair this was because:
>>> 1) to allow you to run DC server on what proto you want (http, https, etc.)
>>> 2) is good REST practice anyhow, you should not have some resource url
>>> building logic. Links to resources within responses should be absolute
>>> links
>>>>       -When calling the method to perform an Action, it returns an
>>>> InputStream. What is that stream used for?
>>> Afaik the stream holds the server response. You can see it in the client
>>> impl when it performs a request and then unmarshalls the response:
>>> <>
>>>>       -Why is Action<OWNER> defined as Raw type?
>>> Afaik because Actions operate on different resources. The OWNER is the
>>> resource the Action operatea on. You see this in
>>> Actions may be operated on any class that knows states, that extends
>>> StateAware<OWNER>. Ex.
>>> *Instance extends StateAware<Instance>:
>>> * Key extends StateAware<Key>:
>>> Actions change the state of a resource if they're executed successfully.
>>>> Regarding marios question:
>>>> interesting... how are you tackling the issue of pricing for example?
>>>> Like many clouds don't expose pricing info via the API (aws only started
>>>> supporting this recently if i recall correctly) - will you be
>>>> maintaining some kind of persistence layer with pricing info?
>>>> We are not currently working on the pricing, but eventually we'll have
>>>> to.
>>>> The idea was to define some scheduler with AI heuristics on it which can
>>>> choose at each time the most cost-efficient provider for each job. I'm
>>>> an AI PhD student after all.
>>>> If we can get that information from an API we'll have to store it
>>>> manually and provide an interface to update that information (we can't
>>>> do anything else, can we?). But that's still a few months away.
>>>> Thanks for your time,
>>>> Dario.
>>>>> Cheers
>>>>> André
>>>>> On 12/20/2012 11:07 AM,  wrote:
>>>>>> Hi Dario:
>>>>>> On 20/12/12 11:50, Dario Garcia Gasulla wrote:
>>>>>>> Hi,
>>>>>>> I'm Dario Garcia, a researcher from the Technical University
>>>>>>> Catalonia (UPC). In a research project we are developing together
>>>>>>> other partners we are using deltacloud to manage connections
>>>>>>> various
>>>>>>> IaaS providers. For this we require a java REST client which
>>>>>>> automate the requests to deltacloud.
>>>>>> awesome - is there any more info on the project (e.g. do you have
>>>>>> website somewhere?)?
>>>>>>> I've been looking for Java REST clients, and there is not a single
>>>>>>> library which seems to be particularly appropriate. I also noticed
>>>>>>> that
>>>>>>> there's a client developed within the deltacloud project:
>>>>>>> I've already downloaded this client and I'm currently testing
>>>>>>> However, any information and help I could get about it would
be most
>>>>>>> useful.
>>>>>>> My question mainly is, what is the state of this client? Which
>>>>>>> functionalities work in the latest version?
>>>>>> wrt to the 'state' - I believe the last anyone worked on this client
>>>>>> close to 2 years ago (that brave soul was Andre Dietisheim - I cc
>>>>>> here for any input/pointers he could give if he has the time these
>>>>>> days).
>>>>>> So I'm not quite sure what does/doesn't work there. My suggestion
>>>>>> now is to try it out. For those things that aren't working, file
>>>>>> tickets [1] so they can be addressed. Even better, if you are able
>>>>>> implement the fixes yourself, we will be very happy to help you on
>>>>>> way (here/irc) ;) - on anything ranging from 'how to make patches'
>>>>>> to 'the layout of the deltacloud code' etc
>>>>>> marios
>>>>>> [1]
>>>>>> [2]
>>>>>>> If I can get to use this client I could provide bugs reports
and usage
>>>>>>> examples.
>>>>>>> Thanks in advance,
>>>>>>> Dario.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message