diff --git a/sandbox-apis/nova/pom.xml b/sandbox-apis/nova/pom.xml
index 13e3dda25b..3bfbacda2c 100644
--- a/sandbox-apis/nova/pom.xml
+++ b/sandbox-apis/nova/pom.xml
@@ -1,150 +1,179 @@
-
-
-
-
- 4.0.0
-
- org.jclouds
- jclouds-project
- 1.0-SNAPSHOT
- ../../project/pom.xml
-
- org.jclouds.api
- nova
- jcloud nova api
- jclouds components to access an implementation of OpenStack Nova
-
-
- https://auth.api.rackspacecloud.com
- 1.1
- FIXME
- FIXME
-
-
-
-
- org.jclouds.common
- openstack-common
- ${project.version}
-
-
- org.jclouds
- jclouds-compute
- ${project.version}
-
-
- org.jclouds
- jclouds-core
- ${project.version}
- test-jar
- test
-
-
- org.jclouds.common
- openstack-common
- ${project.version}
- test-jar
- test
-
-
- org.jclouds
- jclouds-compute
- ${project.version}
- test-jar
- test
-
-
- org.jclouds.driver
- jclouds-jsch
- ${project.version}
- test
-
-
- com.jcraft
- jsch
- test
-
-
- org.jclouds.driver
- jclouds-log4j
- ${project.version}
- test
-
-
- log4j
- log4j
- 1.2.16
- test
-
-
-
-
-
- live
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- integration
- integration-test
-
- test
-
-
-
-
- test.nova.endpoint
- ${test.nova.endpoint}
-
-
- test.nova.apiversion
- ${test.nova.apiversion}
-
-
- test.nova.identity
- ${test.nova.identity}
-
-
- test.nova.credential
- ${test.nova.credential}
-
-
- test.initializer
- ${test.initializer}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ 4.0.0
+
+ org.jclouds
+ jclouds-project
+ 1.0-SNAPSHOT
+ ../../project/pom.xml
+
+ org.jclouds.api
+ nova
+ jcloud nova api
+ jclouds components to access an implementation of OpenStack Nova
+
+
+
+
+
+
+
+ org.jclouds.common
+ openstack-common
+ ${project.version}
+
+
+ org.jclouds
+ jclouds-compute
+ ${project.version}
+
+
+ org.jclouds
+ jclouds-core
+ ${project.version}
+ test-jar
+ test
+
+
+ org.jclouds.common
+ openstack-common
+ ${project.version}
+ test-jar
+ test
+
+
+ org.jclouds
+ jclouds-compute
+ ${project.version}
+ test-jar
+ test
+
+
+ org.jclouds.driver
+ jclouds-jsch
+ ${project.version}
+ test
+
+
+ org.jclouds.driver
+ jclouds-slf4j
+ ${project.version}
+ test
+
+
+ slf4j-api
+ org.slf4j
+ 1.6.1
+ test
+
+
+ ch.qos.logback
+ logback-classic
+ 0.9.28
+ test
+
+
+
+
+
+
+ maven-remote-resources-plugin
+ 1.2
+
+
+ process-remote-resources
+
+
+
+
+
+
+
+
+
+
+ live
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.8.1
+
+
+ org.apache.maven.surefire
+ surefire-testng
+ 2.8.1
+
+
+
+
+ integration
+ integration-test
+
+ test
+
+
+
+
+ test.nova.endpoint
+ ${test.nova.endpoint}
+
+
+ test.nova.apiversion
+ ${test.nova.apiversion}
+
+
+ test.nova.identity
+ ${test.nova.identity}
+
+
+ test.nova.credential
+ ${test.nova.credential}
+
+
+ test.ssh.keyfile.public
+ ${test.ssh.keyfile.public}
+
+
+ test.ssh.keyfile.private
+ ${test.ssh.keyfile.private}
+
+
+ test.initializer
+ ${test.initializer}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/NovaAsyncClient.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/NovaAsyncClient.java
index 73bbab0d57..663ade8c32 100644
--- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/NovaAsyncClient.java
+++ b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/NovaAsyncClient.java
@@ -18,50 +18,22 @@
*/
package org.jclouds.openstack.nova;
-import java.util.Set;
-import java.util.concurrent.ExecutionException;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.openstack.nova.binders.BindBackupScheduleToJsonPayload;
-import org.jclouds.openstack.nova.domain.Addresses;
-import org.jclouds.openstack.nova.domain.BackupSchedule;
-import org.jclouds.openstack.nova.domain.Flavor;
-import org.jclouds.openstack.nova.domain.Image;
-import org.jclouds.openstack.nova.domain.RebootType;
-import org.jclouds.openstack.nova.domain.Server;
-import org.jclouds.openstack.nova.domain.SharedIpGroup;
-import org.jclouds.openstack.nova.options.CreateServerOptions;
-import org.jclouds.openstack.nova.options.CreateSharedIpGroupOptions;
-import org.jclouds.openstack.nova.options.ListOptions;
-import org.jclouds.openstack.nova.options.RebuildServerOptions;
-import org.jclouds.http.functions.ReturnFalseOn404;
+import com.google.common.util.concurrent.ListenableFuture;
import org.jclouds.openstack.filters.AddTimestampQuery;
import org.jclouds.openstack.filters.AuthenticateRequest;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Endpoint;
-import org.jclouds.rest.annotations.ExceptionParser;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.Payload;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SkipEncoding;
-import org.jclouds.rest.annotations.Unwrap;
+import org.jclouds.openstack.nova.domain.*;
+import org.jclouds.openstack.nova.options.CreateServerOptions;
+import org.jclouds.openstack.nova.options.ListOptions;
+import org.jclouds.openstack.nova.options.RebuildServerOptions;
+import org.jclouds.rest.annotations.*;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnFalseOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
-import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
-import com.google.common.util.concurrent.ListenableFuture;
+import javax.ws.rs.*;
+import javax.ws.rs.core.MediaType;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
/**
* Provides asynchronous access to OpenStack Nova via their REST API.
@@ -69,13 +41,13 @@ import com.google.common.util.concurrent.ListenableFuture;
* All commands return a ListenableFuture of the result from OpenStack Nova. Any exceptions incurred
* during processing will be wrapped in an {@link ExecutionException} as documented in
* {@link ListenableFuture#get()}.
- *
+ *
+ * @author Adrian Cole
* @see NovaClient
* @see
- * @author Adrian Cole
*/
-@SkipEncoding({ '/', '=' })
-@RequestFilters({ AuthenticateRequest.class, AddTimestampQuery.class })
+@SkipEncoding({'/', '='})
+@RequestFilters({AuthenticateRequest.class, AddTimestampQuery.class})
@Endpoint(ServerManagement.class)
public interface NovaAsyncClient {
@@ -158,8 +130,8 @@ public interface NovaAsyncClient {
@QueryParams(keys = "format", values = "json")
@Path("/servers")
@MapBinder(CreateServerOptions.class)
- ListenableFuture createServer(@PayloadParam("name") String name, @PayloadParam("imageId") int imageId,
- @PayloadParam("flavorId") int flavorId, CreateServerOptions... options);
+ ListenableFuture createServer(@PayloadParam("name") String name, @PayloadParam("imageRef") String imageRef,
+ @PayloadParam("flavorRef") String flavorRef, CreateServerOptions... options);
/**
* @see NovaClient#rebuildServer
@@ -170,33 +142,14 @@ public interface NovaAsyncClient {
@MapBinder(RebuildServerOptions.class)
ListenableFuture rebuildServer(@PathParam("id") int id, RebuildServerOptions... options);
- /**
- * @see NovaClient#shareIp
- */
- @PUT
- @Path("/servers/{id}/ips/public/{address}")
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"shareIp\":%7B\"sharedIpGroupId\":{sharedIpGroupId},\"configureServer\":{configureServer}%7D%7D")
- ListenableFuture shareIp(@PathParam("address") String addressToShare,
- @PathParam("id") int serverToTosignBindressTo, @PayloadParam("sharedIpGroupId") int sharedIpGroup,
- @PayloadParam("configureServer") boolean configureServer);
-
- /**
- * @see NovaClient#unshareIp
- */
- @DELETE
- @Path("/servers/{id}/ips/public/{address}")
- @ExceptionParser(ReturnVoidOnNotFoundOr404.class)
- ListenableFuture unshareIp(@PathParam("address") String addressToShare,
- @PathParam("id") int serverToTosignBindressTo);
/**
* @see NovaClient#changeAdminPass
*/
- @PUT
- @Path("/servers/{id}")
+ @POST
+ @Path("/servers/{id}/action")
@Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"server\":%7B\"adminPass\":\"{adminPass}\"%7D%7D")
+ @Payload("%7B\"changePassword\":%7B\"adminPass\":\"{adminPass}\"%7D%7D")
ListenableFuture changeAdminPass(@PathParam("id") int id, @PayloadParam("adminPass") String adminPass);
/**
@@ -271,76 +224,7 @@ public interface NovaAsyncClient {
@Produces(MediaType.APPLICATION_JSON)
@Payload("%7B\"image\":%7B\"serverId\":{serverId},\"name\":\"{name}\"%7D%7D")
ListenableFuture createImageFromServer(@PayloadParam("name") String imageName,
- @PayloadParam("serverId") int serverId);
-
- /**
- * @see NovaClient#listSharedIpGroups
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/shared_ip_groups")
- @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
- ListenableFuture extends Set> listSharedIpGroups(ListOptions... options);
-
- /**
- * @see NovaClient#getSharedIpGroup
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/shared_ip_groups/{id}")
- @ExceptionParser(ReturnNullOnNotFoundOr404.class)
- ListenableFuture getSharedIpGroup(@PathParam("id") int id);
-
- /**
- * @see NovaClient#createSharedIpGroup
- */
- @POST
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/shared_ip_groups")
- @MapBinder(CreateSharedIpGroupOptions.class)
- ListenableFuture createSharedIpGroup(@PayloadParam("name") String name,
- CreateSharedIpGroupOptions... options);
-
- /**
- * @see NovaClient#deleteSharedIpGroup
- */
- @DELETE
- @ExceptionParser(ReturnFalseOnNotFoundOr404.class)
- @Path("/shared_ip_groups/{id}")
- ListenableFuture deleteSharedIpGroup(@PathParam("id") int id);
-
- /**
- * @see NovaClient#listBackupSchedule
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/backup_schedule")
- ListenableFuture getBackupSchedule(@PathParam("id") int serverId);
-
- /**
- * @see NovaClient#deleteBackupSchedule
- */
- @DELETE
- @ExceptionParser(ReturnFalseOnNotFoundOr404.class)
- @Path("/servers/{id}/backup_schedule")
- ListenableFuture deleteBackupSchedule(@PathParam("id") int serverId);
-
- /**
- * @see NovaClient#replaceBackupSchedule
- */
- @POST
- @ExceptionParser(ReturnFalseOn404.class)
- @Path("/servers/{id}/backup_schedule")
- ListenableFuture replaceBackupSchedule(@PathParam("id") int id,
- @BinderParam(BindBackupScheduleToJsonPayload.class) BackupSchedule backupSchedule);
+ @PayloadParam("serverId") int serverId);
/**
* @see NovaClient#listAddresses
diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/NovaClient.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/NovaClient.java
index 22acaf2ce6..3ed6f04e50 100644
--- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/NovaClient.java
+++ b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/NovaClient.java
@@ -26,14 +26,11 @@ import javax.ws.rs.PathParam;
import org.jclouds.concurrent.Timeout;
import org.jclouds.openstack.nova.domain.Addresses;
-import org.jclouds.openstack.nova.domain.BackupSchedule;
import org.jclouds.openstack.nova.domain.Flavor;
import org.jclouds.openstack.nova.domain.Image;
import org.jclouds.openstack.nova.domain.RebootType;
import org.jclouds.openstack.nova.domain.Server;
-import org.jclouds.openstack.nova.domain.SharedIpGroup;
import org.jclouds.openstack.nova.options.CreateServerOptions;
-import org.jclouds.openstack.nova.options.CreateSharedIpGroupOptions;
import org.jclouds.openstack.nova.options.ListOptions;
import org.jclouds.openstack.nova.options.RebuildServerOptions;
import org.jclouds.rest.ResourceNotFoundException;
@@ -154,7 +151,7 @@ public interface NovaClient {
* @param options
* - used to specify extra files, metadata, or ip parameters during server creation.
*/
- Server createServer(String name, int imageId, int flavorId, CreateServerOptions... options);
+ Server createServer(String name, String imageRef, String flavorRef, CreateServerOptions... options);
/**
* The rebuild function removes all data on the server and replaces it with the specified image.
@@ -173,40 +170,6 @@ public interface NovaClient {
*/
void rebuildServer(int id, RebuildServerOptions... options);
- /**
- * /** This operation allows you share an IP address to the specified server
- *
- * This operation shares an IP from an existing server in the specified shared IP group to
- * another specified server in the same group. The operation modifies cloud network restrictions
- * to allow IP traffic for the given IP to/from the server specified.
- *
- *
- * Status Transition: ACTIVE - SHARE_IP - ACTIVE (if configureServer is true) ACTIVE -
- * SHARE_IP_NO_CONFIG - ACTIVE
- *
- * @param configureServer
- *
- * if set to true, the server is configured with the new address, though the address is
- * not enabled. Note that configuring the server does require a reboot.
- *
- * If set to false, does not bind the IP to the server itself. A heartbeat facility
- * (e.g. keepalived) can then be used within the servers to perform health checks and
- * manage IP failover.
- */
- void shareIp(String addressToShare, int serverToTosignBindressTo, int sharedIpGroup,
- boolean configureServer);
-
- /**
- * This operation removes a shared IP address from the specified server.
- *
- * Status Transition: ACTIVE - DELETE_IP - ACTIVE
- *
- * @param addressToShare
- * @param serverToTosignBindressTo
- * @return
- */
- void unshareIp(String addressToShare, int serverToTosignBindressTo);
-
/**
* This operation allows you to change the administrative password.
*
@@ -295,66 +258,6 @@ public interface NovaClient {
*/
Image createImageFromServer(String imageName, int serverId);
- /**
- *
- * List shared IP groups (IDs and names only)
- *
- * in order to retrieve all details, pass the option {@link ListOptions#withDetails()
- * withDetails()}
- */
- Set listSharedIpGroups(ListOptions... options);
-
- /**
- *
- * This operation returns details of the specified shared IP group.
- *
- * @return null, if the shared ip group is not found
- *
- * @see SharedIpGroup
- */
- SharedIpGroup getSharedIpGroup(int id);
-
- /**
- * This operation creates a new shared IP group. Please note, all responses to requests for
- * shared_ip_groups return an array of servers. However, on a create request, the shared IP group
- * can be created empty or can be initially populated with a single server. Use
- * {@link CreateSharedIpGroupOptions} to specify an server.
- */
- SharedIpGroup createSharedIpGroup(String name, CreateSharedIpGroupOptions... options);
-
- /**
- * This operation deletes the specified shared IP group. This operation will ONLY succeed if 1)
- * there are no active servers in the group (i.e. they have all been terminated) or 2) no servers
- * in the group are actively sharing IPs.
- *
- * @return false if the shared ip group is not found
- * @see SharedIpGroup
- */
- boolean deleteSharedIpGroup(int id);
-
- /**
- * List the backup schedule for the specified server
- *
- * @throws ResourceNotFoundException
- * , if the server doesn't exist
- */
- BackupSchedule getBackupSchedule(int serverId);
-
- /**
- * Delete backup schedule for the specified server.
- *
- * Web Hosting #119571 currently disables the schedule, not deletes it.
- *
- * @return false if the schedule is not found
- */
- boolean deleteBackupSchedule(int serverId);
-
- /**
- * Enable/update the backup schedule for the specified server
- *
- */
- void replaceBackupSchedule(int id, BackupSchedule backupSchedule);
-
/**
* List all server addresses
*
diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/NovaPropertiesBuilder.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/NovaPropertiesBuilder.java
new file mode 100644
index 0000000000..5c808e974b
--- /dev/null
+++ b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/NovaPropertiesBuilder.java
@@ -0,0 +1,48 @@
+/**
+ *
+ * Copyright (C) 2010 Cloud Conscious, LLC.
+ *
+ * ====================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ====================================================================
+ */
+
+package org.jclouds.openstack.nova;
+
+import org.jclouds.PropertiesBuilder;
+
+import java.util.Properties;
+
+import static org.jclouds.Constants.PROPERTY_API_VERSION;
+
+/**
+ * Builds properties used in Openstack Nova Clients
+ *
+ * @author Dmitri Babaev
+ */
+public class NovaPropertiesBuilder extends PropertiesBuilder {
+ @Override
+ protected Properties defaultProperties() {
+ Properties properties = super.defaultProperties();
+ properties.setProperty(PROPERTY_API_VERSION, "1.1");
+ return properties;
+ }
+
+ public NovaPropertiesBuilder(Properties properties) {
+ super(properties);
+ }
+
+ public NovaPropertiesBuilder() {
+ super();
+ }
+}
diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/binders/BindBackupScheduleToJsonPayload.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/binders/BindBackupScheduleToJsonPayload.java
deleted file mode 100644
index 30b2916f6e..0000000000
--- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/binders/BindBackupScheduleToJsonPayload.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- *
- * Copyright (C) 2011 Cloud Conscious, LLC.
- *
- * ====================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ====================================================================
- */
-package org.jclouds.openstack.nova.binders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import java.util.Map;
-
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.openstack.nova.domain.BackupSchedule;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.collect.ImmutableMap;
-
-/**
- *
- * @author Adrian Cole
- *
- */
-@Singleton
-public class BindBackupScheduleToJsonPayload extends BindToJsonPayload {
-
- @Override
- public R bindToRequest(R request, Map postParams) {
- throw new IllegalStateException(
- "Replace Backup Schedule needs an BackupSchedule object, not a Map");
- }
-
- @Override
- public R bindToRequest(R request, Object toBind) {
- checkArgument(toBind instanceof BackupSchedule,
- "this binder is only valid for BackupSchedules!");
- return super.bindToRequest(request, ImmutableMap.of("backupSchedule", toBind));
- }
-}
diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/config/NovaComputeServiceDependenciesModule.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/config/NovaComputeServiceDependenciesModule.java
index acd932d565..234b2971bc 100644
--- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/config/NovaComputeServiceDependenciesModule.java
+++ b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/config/NovaComputeServiceDependenciesModule.java
@@ -89,19 +89,11 @@ public class NovaComputeServiceDependenciesModule extends AbstractModule {
.put(ServerStatus.PREP_RESIZE, NodeState.PENDING)//
.put(ServerStatus.RESIZE, NodeState.PENDING)//
.put(ServerStatus.VERIFY_RESIZE, NodeState.PENDING)//
- .put(ServerStatus.QUEUE_MOVE, NodeState.PENDING)//
- .put(ServerStatus.PREP_MOVE, NodeState.PENDING)//
- .put(ServerStatus.MOVE, NodeState.PENDING)//
- .put(ServerStatus.VERIFY_MOVE, NodeState.PENDING)//
.put(ServerStatus.RESCUE, NodeState.PENDING)//
- .put(ServerStatus.ERROR, NodeState.ERROR)//
.put(ServerStatus.BUILD, NodeState.PENDING)//
- .put(ServerStatus.RESTORING, NodeState.PENDING)//
.put(ServerStatus.PASSWORD, NodeState.PENDING)//
.put(ServerStatus.REBUILD, NodeState.PENDING)//
.put(ServerStatus.DELETE_IP, NodeState.PENDING)//
- .put(ServerStatus.SHARE_IP_NO_CONFIG, NodeState.PENDING)//
- .put(ServerStatus.SHARE_IP, NodeState.PENDING)//
.put(ServerStatus.REBOOT, NodeState.PENDING)//
.put(ServerStatus.HARD_REBOOT, NodeState.PENDING)//
.put(ServerStatus.UNKNOWN, NodeState.UNRECOGNIZED)//
diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/functions/FlavorToHardware.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/functions/FlavorToHardware.java
index 8f5064a61b..f166754303 100644
--- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/functions/FlavorToHardware.java
+++ b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/functions/FlavorToHardware.java
@@ -36,8 +36,13 @@ import com.google.common.collect.ImmutableList;
@Singleton
public class FlavorToHardware implements Function {
public Hardware apply(Flavor from) {
- return new HardwareBuilder().ids(from.getId() + "").name(from.getName())
- .processors(ImmutableList.of(new Processor(from.getDisk() / 10.0, 1.0))).ram(from.getRam())
- .volumes(ImmutableList. of(new VolumeImpl((float) from.getDisk(), true, true))).build();
+ return new HardwareBuilder()
+ .ids(from.getId() + "")
+ .name(from.getName())
+ .processors(ImmutableList.of(new Processor(from.getDisk() / 10.0, 1.0)))
+ .ram(from.getRam())
+ .volumes(ImmutableList. of(new VolumeImpl((float) from.getDisk(), true, true)))
+ .uri(from.getURI())
+ .build();
}
}
diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/functions/NovaImageToImage.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/functions/NovaImageToImage.java
index 23660c95d4..e606c5b13a 100644
--- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/functions/NovaImageToImage.java
+++ b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/functions/NovaImageToImage.java
@@ -44,11 +44,12 @@ public class NovaImageToImage implements Function {
@Override
public boolean apply(Image input) {
- return input.getProviderId().equals(instance.getImageId() + "");
+ return input.getUri().toString().equals(instance.getImageRef() + "");
}
}
@@ -88,14 +82,14 @@ public class ServerToNodeMetadata implements Function {
@Override
public boolean apply(Hardware input) {
- return input.getProviderId().equals(instance.getFlavorId() + "");
+ return input.getUri().toString().equals(instance.getFlavorRef() + "");
}
}
@Inject
ServerToNodeMetadata(Map serverStateToNodeState, Map credentialStore,
- @Memoized Supplier> images, Supplier location,
- @Memoized Supplier> hardwares) {
+ @Memoized Supplier> images, Supplier location,
+ @Memoized Supplier> hardwares) {
this.serverToNodeState = checkNotNull(serverStateToNodeState, "serverStateToNodeState");
this.credentialStore = checkNotNull(credentialStore, "credentialStore");
this.images = checkNotNull(images, "images");
@@ -109,16 +103,20 @@ public class ServerToNodeMetadata implements Function {
builder.ids(from.getId() + "");
builder.name(from.getName());
builder.location(new LocationBuilder().scope(LocationScope.HOST).id(from.getHostId()).description(
- from.getHostId()).parent(location.get()).build());
+ from.getHostId()).parent(location.get()).build());
builder.userMetadata(from.getMetadata());
builder.group(parseGroupFromName(from.getName()));
- builder.imageId(from.getImageId() + "");
- builder.operatingSystem(parseOperatingSystem(from));
+ Image image = parseImage(from);
+ if (image != null) {
+ builder.imageId(image.getId());
+ builder.operatingSystem(image.getOperatingSystem());
+ }
builder.hardware(parseHardware(from));
builder.state(serverToNodeState.get(from.getStatus()));
- builder.publicAddresses(from.getAddresses().getPublicAddresses());
- builder.privateAddresses(from.getAddresses().getPrivateAddresses());
+ builder.publicAddresses(Iterables.transform(from.getAddresses().getPublicAddresses(), Address.newAddress2StringFunction()));
+ builder.privateAddresses(Iterables.transform(from.getAddresses().getPrivateAddresses(), Address.newAddress2StringFunction()));
builder.credentials(credentialStore.get("node#" + from.getId()));
+ builder.uri(from.getURI());
return builder.build();
}
@@ -130,10 +128,10 @@ public class ServerToNodeMetadata implements Function {
}
return null;
}
-
- protected OperatingSystem parseOperatingSystem(Server from) {
+
+ protected Image parseImage(Server from) {
try {
- return Iterables.find(images.get(), new FindImageForServer(from)).getOperatingSystem();
+ return Iterables.find(images.get(), new FindImageForServer(from));
} catch (NoSuchElementException e) {
logger.warn("could not find a matching image for server %s in location %s", from, location);
}
diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/strategy/NovaCreateNodeWithGroupEncodedIntoName.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/strategy/NovaCreateNodeWithGroupEncodedIntoName.java
index 71e37bbb16..5cb3b1fa5a 100644
--- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/strategy/NovaCreateNodeWithGroupEncodedIntoName.java
+++ b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/strategy/NovaCreateNodeWithGroupEncodedIntoName.java
@@ -53,8 +53,7 @@ public class NovaCreateNodeWithGroupEncodedIntoName implements CreateNodeWithGro
@Override
public NodeMetadata createNodeWithGroupEncodedIntoName(String group, String name, Template template) {
- Server from = client.createServer(name, Integer.parseInt(template.getImage().getProviderId()), Integer
- .parseInt(template.getHardware().getProviderId()));
+ Server from = client.createServer(name, template.getImage().getId(), template.getHardware().getId());
credentialStore.put("node#" + from.getId(), new Credentials("root", from.getAdminPass()));
return serverToNodeMetadata.apply(from);
}
diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/strategy/NovaLifeCycleStrategy.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/strategy/NovaLifeCycleStrategy.java
index 79a552cd27..41a0c3873b 100644
--- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/strategy/NovaLifeCycleStrategy.java
+++ b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/compute/strategy/NovaLifeCycleStrategy.java
@@ -47,7 +47,7 @@ public class NovaLifeCycleStrategy implements RebootNodeStrategy, SuspendNodeStr
public NodeMetadata rebootNode(String id) {
int serverId = Integer.parseInt(id);
// if false server wasn't around in the first place
- client.rebootServer(serverId, RebootType.HARD);
+ client.rebootServer(serverId, RebootType.SOFT);
return getNode.getNode(id);
}
diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Address.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Address.java
new file mode 100644
index 0000000000..96a8538d99
--- /dev/null
+++ b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Address.java
@@ -0,0 +1,80 @@
+package org.jclouds.openstack.nova.domain;
+
+import com.google.common.base.Function;
+import com.google.gson.annotations.SerializedName;
+
+import javax.annotation.Nullable;
+
+/**
+ * @author Dmitri Babaev
+ */
+public class Address {
+ @SerializedName("addr")
+ private String address;
+ private int version;
+
+ //for de-serialization
+ @SuppressWarnings("unused")
+ private Address() {
+ }
+
+ public Address(String address, int version) {
+ this.address = address;
+ this.version = version;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public int getVersion() {
+ return version;
+ }
+
+ @Override
+ public String toString() {
+ return address;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Address address1 = (Address) o;
+
+ if (version != address1.version) return false;
+ if (address != null ? !address.equals(address1.address) : address1.address != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = address != null ? address.hashCode() : 0;
+ result = 31 * result + version;
+ return result;
+ }
+
+ public static Function newAddress2StringFunction() {
+ return new Function() {
+ @Override
+ public String apply(@Nullable Address input) {
+ return input.getAddress();
+ }
+ };
+ }
+
+ public static Address valueOf(String address) {
+ return new Address(address, address.startsWith("::") ? 6 : 4);
+ }
+
+ public static Function newString2AddressFunction() {
+ return new Function() {
+ @Override
+ public Address apply(@Nullable String input) {
+ return valueOf(input);
+ }
+ };
+ }
+}
diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Addresses.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Addresses.java
index 02cdc9f6e0..478808f156 100644
--- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Addresses.java
+++ b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Addresses.java
@@ -30,31 +30,31 @@ import com.google.gson.annotations.SerializedName;
public class Addresses {
@SerializedName("public")
- private Set publicAddresses = Sets.newLinkedHashSet();
+ private Set publicAddresses = Sets.newLinkedHashSet();
@SerializedName("private")
- private Set privateAddresses = Sets.newLinkedHashSet();
+ private Set privateAddresses = Sets.newLinkedHashSet();
public Addresses() {
}
- public Addresses(Set publicAddresses, Set privateAddresses) {
+ public Addresses(Set publicAddresses, Set privateAddresses) {
this.publicAddresses = publicAddresses;
this.privateAddresses = privateAddresses;
}
- public void setPublicAddresses(Set publicAddresses) {
+ public void setPublicAddresses(Set publicAddresses) {
this.publicAddresses = publicAddresses;
}
- public Set getPublicAddresses() {
+ public Set getPublicAddresses() {
return publicAddresses;
}
- public void setPrivateAddresses(Set privateAddresses) {
+ public void setPrivateAddresses(Set privateAddresses) {
this.privateAddresses = privateAddresses;
}
- public Set getPrivateAddresses() {
+ public Set getPrivateAddresses() {
return privateAddresses;
}
diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/BackupSchedule.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/BackupSchedule.java
deleted file mode 100644
index 18087b0318..0000000000
--- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/BackupSchedule.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- *
- * Copyright (C) 2011 Cloud Conscious, LLC.
- *
- * ====================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ====================================================================
- */
-package org.jclouds.openstack.nova.domain;
-
-/**
- * A backup schedule can be defined to create server images at regular intervals (daily and weekly).
- * Backup schedules are configurable per server.
- *
- * @author Adrian Cole
- */
-public class BackupSchedule {
- protected DailyBackup daily = DailyBackup.DISABLED;
- protected boolean enabled;
- protected WeeklyBackup weekly = WeeklyBackup.DISABLED;
-
- public BackupSchedule() {
- }
-
- public BackupSchedule(WeeklyBackup weekly, DailyBackup daily, boolean enabled) {
- this.weekly = weekly;
- this.daily = daily;
- this.enabled = enabled;
- }
-
- public DailyBackup getDaily() {
- return daily;
- }
-
- public void setDaily(DailyBackup value) {
- this.daily = value;
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public void setEnabled(boolean value) {
- this.enabled = value;
- }
-
- public WeeklyBackup getWeekly() {
- return weekly;
- }
-
- public void setWeekly(WeeklyBackup value) {
- this.weekly = value;
- }
-
- @Override
- public String toString() {
- return "[daily=" + daily + ", enabled=" + enabled + ", weekly=" + weekly + "]";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((daily == null) ? 0 : daily.hashCode());
- result = prime * result + (enabled ? 1231 : 1237);
- result = prime * result + ((weekly == null) ? 0 : weekly.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- BackupSchedule other = (BackupSchedule) obj;
- if (daily == null) {
- if (other.daily != null)
- return false;
- } else if (!daily.equals(other.daily))
- return false;
- if (enabled != other.enabled)
- return false;
- if (weekly == null) {
- if (other.weekly != null)
- return false;
- } else if (!weekly.equals(other.weekly))
- return false;
- return true;
- }
-
-}
diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/DailyBackup.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/DailyBackup.java
deleted file mode 100644
index 6a6518bdc6..0000000000
--- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/DailyBackup.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright (C) 2011 Cloud Conscious, LLC.
- *
- * ====================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ====================================================================
- */
-package org.jclouds.openstack.nova.domain;
-
-public enum DailyBackup {
-
- DISABLED, H_0000_0200, H_0200_0400, H_0400_0600, H_0600_0800, H_0800_1000, H_1000_1200, H_1200_1400, H_1400_1600, H_1600_1800, H_1800_2000, H_2000_2200, H_2200_0000, UNRECOGNIZED;
-
- public String value() {
- return name();
- }
-
- public static DailyBackup fromValue(String v) {
- try {
- return valueOf(v);
- } catch (IllegalArgumentException e) {
- return UNRECOGNIZED;
- }
- }
-
-}
diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Flavor.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Flavor.java
index b0f9cb2b1b..94ab5c61cf 100644
--- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Flavor.java
+++ b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Flavor.java
@@ -25,7 +25,7 @@ package org.jclouds.openstack.nova.domain;
*
* @author Adrian Cole
*/
-public class Flavor {
+public class Flavor extends Resource {
public Flavor() {
}
diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Image.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Image.java
index a98eeeecf9..8a3934ee6d 100644
--- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Image.java
+++ b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Image.java
@@ -18,26 +18,41 @@
*/
package org.jclouds.openstack.nova.domain;
+import com.google.common.collect.Maps;
+
+import java.util.Collections;
import java.util.Date;
+import java.util.Map;
/**
* An image is a collection of files used to create or rebuild a server. Rackspace provides a number
* of pre-built OS images by default. You may also create custom images from cloud servers you have
* launched. These custom images are useful for backup purposes or for producing gold server images
* if you plan to deploy a particular server configuration frequently.
- *
+ *
* @author Adrian Cole
*/
-public class Image {
+public class Image extends Resource {
- private Date created;
private int id;
private String name;
private Integer progress;
- private Integer serverId;
+ private String serverRef;
private ImageStatus status;
+ private Map metadata = Maps.newHashMap();
+
+ private Date created;
private Date updated;
+ public Date getCreated() {
+ return created;
+ }
+
+ public Date getUpdated() {
+ return updated;
+ }
+
+
public Image() {
}
@@ -46,13 +61,6 @@ public class Image {
this.name = name;
}
- public void setCreated(Date created) {
- this.created = created;
- }
-
- public Date getCreated() {
- return created;
- }
public void setId(int id) {
this.id = id;
@@ -78,12 +86,12 @@ public class Image {
return progress;
}
- public void setServerId(Integer serverId) {
- this.serverId = serverId;
+ public void setServerRef(String serverRef) {
+ this.serverRef = serverRef;
}
- public Integer getServerId() {
- return serverId;
+ public String getServerRef() {
+ return serverRef;
}
public void setStatus(ImageStatus status) {
@@ -94,15 +102,17 @@ public class Image {
return status;
}
- public void setUpdated(Date updated) {
- this.updated = updated;
+
+ public Map getMetadata() {
+ return Collections.unmodifiableMap(metadata);
}
- public Date getUpdated() {
- return updated;
+ public void setMetadata(Map metadata) {
+ this.metadata = Maps.newHashMap(metadata);
}
+
/**
- * note that this ignores the create time
+ * note that this ignores some fields
*/
@Override
public int hashCode() {
@@ -110,12 +120,12 @@ public class Image {
int result = 1;
result = prime * result + id;
result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((serverId == null) ? 0 : serverId.hashCode());
+ result = prime * result + ((serverRef == null) ? 0 : serverRef.hashCode());
return result;
}
/**
- * note that this ignores the serverid and create time.
+ * note that this ignores some fields
*/
@Override
public boolean equals(Object obj) {
@@ -138,8 +148,8 @@ public class Image {
@Override
public String toString() {
- return "Image [created=" + created + ", id=" + id + ", name=" + name + ", serverId="
- + serverId + "]";
+ return "Image [created=" + getCreated() + ", id=" + id + ", name=" + name + ", serverRef="
+ + serverRef + "]";
}
}
diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Resource.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Resource.java
new file mode 100644
index 0000000000..6e6f9f241e
--- /dev/null
+++ b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Resource.java
@@ -0,0 +1,34 @@
+package org.jclouds.openstack.nova.domain;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
+import java.util.Map;
+
+import com.google.common.base.Functions;
+import com.google.common.collect.Lists;
+
+/**
+ * @author Dmitri Babaev
+ */
+public class Resource {
+
+ private List