ContainX / openstack4j

A Fluent OpenStack SDK / Client Library for Java
http://openstack4j.com
Other
290 stars 366 forks source link

Is there any ways to rebuild an instance from OpenStack4J? #65

Closed anhdenday closed 10 years ago

anhdenday commented 10 years ago

Dear Gondor, I want to rebuild an instance from OpenStack4J, I've searched but did not found any results. Please help me. Thanks you so much

gondor commented 10 years ago

What do you mean rebuild? You mean build locally from source? If so in command line:

mvn clean install

This will install the current snapshot locally for you. You can then have eclipse Update your local Project and refresh it's dependencies (if using eclipse)

anhdenday commented 10 years ago

No, I mean how to rebuild an instance, when i created one instance with cirros image, but now I want to rebuild it with ubuntu image. You can check in the dashboard, In the field Actions/more/rebuild so that one dialog box appear for choosing another image for rebuilding. Below is screenshot with rebuild in my dashboard. https://www.dropbox.com/s/1kzi7bsz3tumgte/Screen%20Shot%202014-09-30%20at%2011.42.54%20PM.png?dl=0 Thanks you so much

gondor commented 10 years ago

Ok, looked into it. There are a few various options you can technically specify. Will make this an enhancement and try to get this in.

gondor commented 10 years ago

Ok, I have added support for Rebuild. I have allowed for optional params to be specified as well. See example below:

ActionResponse resp = os.compute().servers().rebuild("serverId", RebuildOptions.create().image("93e8b965-db21-4de1-97a6-65493591cff4"));

// Another example
resp = os.compute().servers().rebuild("serverId", RebuildOptions.create().image("93e8b965-db21-4de1-97a6-65493591cff4").name("new server name").adminPass("new password"));

// Example with no options - use original settings
resp = os.compute().servers().rebuild("serverId", null);
anhdenday commented 10 years ago

That's great, thanks you so much