diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/extensions/VolumeAsyncClient.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/extensions/VolumeAsyncClient.java index fbc7465e0b..97584b1d07 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/extensions/VolumeAsyncClient.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/extensions/VolumeAsyncClient.java @@ -131,7 +131,7 @@ public interface VolumeAsyncClient { @SelectJson("volumeAttachments") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listAttachments(@PathParam("server_id") String serverId); + ListenableFuture> listAttachmentsOnServer(@PathParam("server_id") String serverId); /** * Get a specific attached volume. @@ -143,7 +143,8 @@ public interface VolumeAsyncClient { @SelectJson("volumeAttachment") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getAttachment(@PathParam("server_id") String serverId, @PathParam("id") String volumeId); + ListenableFuture getAttachmentForVolumeOnServer(@PathParam("id") String volumeId, + @PathParam("server_id") String serverId); /** * Attach a volume to an instance @@ -156,9 +157,8 @@ public interface VolumeAsyncClient { @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Payload("%7B\"volumeAttachment\":%7B\"volumeId\":\"{id}\",\"device\":\"{device}\"%7D%7D") - ListenableFuture attachVolume(@PathParam("server_id") String serverId, - @PayloadParam("id") String volumeId, - @PayloadParam("device") String device); + ListenableFuture attachVolumeToServerAsDevice(@PayloadParam("id") String volumeId, + @PathParam("server_id") String serverId, @PayloadParam("device") String device); /** * Detach a Volume from an instance. @@ -169,7 +169,7 @@ public interface VolumeAsyncClient { @Path("/servers/{server_id}/os-volume_attachments/{id}") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnFalseOnNotFoundOr404.class) - ListenableFuture detachVolume(@PathParam("server_id") String serverId, @PathParam("id") String volumeId); + ListenableFuture detachVolumeFromServer(@PathParam("id") String volumeId, @PathParam("server_id") String serverId); /** * Returns a summary list of snapshots. diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/extensions/VolumeClient.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/extensions/VolumeClient.java index fc26aad4cf..3f40523d79 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/extensions/VolumeClient.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/extensions/VolumeClient.java @@ -80,28 +80,28 @@ public interface VolumeClient { * * @return all Floating IPs */ - Set listAttachments(String serverId); + Set listAttachmentsOnServer(String serverId); /** * Get a specific attached volume. * * @return data about the given volume attachment. */ - VolumeAttachment getAttachment(String serverId, String volumeId); + VolumeAttachment getAttachmentForVolumeOnServer(String volumeId, String serverId); /** * Attach a volume to an instance * * @return data about the new volume attachment */ - VolumeAttachment attachVolume(String serverId, String volumeId, String device); + VolumeAttachment attachVolumeToServerAsDevice(String volumeId, String serverId, String device); /** * Detach a Volume from an instance. * * @return true if successful */ - Boolean detachVolume(String server_id, String volumeId); + Boolean detachVolumeFromServer(String server_id, String volumeId); /** * Returns a summary list of snapshots. diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/extensions/VolumeClientExpectTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/extensions/VolumeClientExpectTest.java index 4f70e81496..3349f0ac92 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/extensions/VolumeClientExpectTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/extensions/VolumeClientExpectTest.java @@ -199,7 +199,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest { standardResponseBuilder(200).payload(payloadFromResource("/attachment_list.json")).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); - Set attachments = client.listAttachments("instance-1"); + Set attachments = client.listAttachmentsOnServer("instance-1"); assertEquals(attachments, ImmutableSet.of(testAttachment())); // double-check individual fields VolumeAttachment attachment = Iterables.getOnlyElement(attachments); @@ -219,7 +219,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest { standardResponseBuilder(401).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); - client.listAttachments("instance-2"); + client.listAttachmentsOnServer("instance-2"); } public void testGetAttachment() { @@ -231,7 +231,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest { standardResponseBuilder(200).payload(payloadFromResource("/attachment_details.json")).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); - VolumeAttachment attachment = client.getAttachment("instance-1", "1"); + VolumeAttachment attachment = client.getAttachmentForVolumeOnServer("1", "instance-1"); assertEquals(attachment, testAttachment()); } @@ -244,7 +244,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest { standardResponseBuilder(404).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); - assertNull(client.getAttachment("instance-1", "1")); + assertNull(client.getAttachmentForVolumeOnServer("1", "instance-1")); } public void testAttachVolume() { @@ -257,7 +257,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest { standardResponseBuilder(200).payload(payloadFromResource("/attachment_details.json")).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); - VolumeAttachment result = client.attachVolume("instance-1", "1", "/dev/vdc"); + VolumeAttachment result = client.attachVolumeToServerAsDevice("1", "instance-1", "/dev/vdc"); assertEquals(result, testAttachment()); } @@ -272,7 +272,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest { standardResponseBuilder(404).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); - client.attachVolume("instance-1", "1", "/dev/vdc"); + client.attachVolumeToServerAsDevice("1", "instance-1","/dev/vdc"); } public void testDetachVolume() { @@ -284,7 +284,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest { standardResponseBuilder(200).payload(payloadFromResource("/attachment_details.json")).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); - assertTrue(client.detachVolume("instance-1", "1")); + assertTrue(client.detachVolumeFromServer("1", "instance-1")); } public void testDetachVolumeFail() { @@ -296,7 +296,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest { standardResponseBuilder(404).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); - assertFalse(client.detachVolume("instance-1", "1")); + assertFalse(client.detachVolumeFromServer("1", "instance-1")); } public void testListSnapshots() { diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/extensions/VolumeClientLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/extensions/VolumeClientLiveTest.java index b4b61ed103..bca364837c 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/extensions/VolumeClientLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/extensions/VolumeClientLiveTest.java @@ -218,22 +218,22 @@ public class VolumeClientLiveTest extends BaseNovaClientLiveTest { Set servers = novaContext.getApi().getServerClientForZone(zone).listServers(); if (!servers.isEmpty()) { final String serverId = Iterables.getFirst(servers, null).getId(); - Set attachments = client.listAttachments(serverId); + Set attachments = client.listAttachmentsOnServer(serverId); assertNotNull(attachments); final int before = attachments.size(); - VolumeAttachment testAttachment = client.attachVolume(serverId, testVolume.getId(), "/dev/vdf"); + VolumeAttachment testAttachment = client.attachVolumeToServerAsDevice(testVolume.getId(), serverId, "/dev/vdf"); assertNotNull(testAttachment.getId()); assertEquals(testAttachment.getVolumeId(), testVolume.getId()); assertTrue(new RetryablePredicate(new Predicate() { @Override public boolean apply(VolumeClient volumeClient) { - return client.listAttachments(serverId).size() == before+1; + return client.listAttachmentsOnServer(serverId).size() == before+1; } }, 60 * 1000L).apply(client)); - attachments = client.listAttachments(serverId); + attachments = client.listAttachmentsOnServer(serverId); assertNotNull(attachments); assertEquals(attachments.size(), before+1); @@ -241,7 +241,7 @@ public class VolumeClientLiveTest extends BaseNovaClientLiveTest { boolean foundIt = false; for (VolumeAttachment att : attachments) { - VolumeAttachment details = client.getAttachment(serverId, att.getId()); + VolumeAttachment details = client.getAttachmentForVolumeOnServer(att.getVolumeId(), serverId); assertNotNull(details); assertNotNull(details.getId()); assertNotNull(details.getServerId()); @@ -255,11 +255,11 @@ public class VolumeClientLiveTest extends BaseNovaClientLiveTest { assertTrue(foundIt, "Failed to find the attachment we created in listAttachments() response"); - client.detachVolume(serverId, testVolume.getId()); + client.detachVolumeFromServer(testVolume.getId(), serverId); assertTrue(new RetryablePredicate(new Predicate() { @Override public boolean apply(VolumeClient volumeClient) { - return client.listAttachments(serverId).size() == before; + return client.listAttachmentsOnServer(serverId).size() == before; } }, 60 * 1000L).apply(client)); }