Interface VolumeAttachmentApi
-
@Consumes("application/json") @Path("/servers") public interface VolumeAttachmentApi
Provides access to the OpenStack Compute (Nova) Volume Attachments Extension API. This API strictly handles attaching Volumes to Servers. To create and manage Volumes you need to use the Cinder API.- See Also:
VolumeApi
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description VolumeAttachment
attachVolumeToServerAsDevice(String volumeId, String serverId, String device)
Attaches a Volume to a Server.boolean
detachVolumeFromServer(String volumeId, String serverId)
Detaches a Volume from a server.VolumeAttachment
getAttachmentForVolumeOnServer(String volumeId, String serverId)
Gets a specific Volume Attachment for a Volume and Server.com.google.common.collect.FluentIterable<VolumeAttachment>
listAttachmentsOnServer(String serverId)
Lists Volume Attachments for a given Server.
-
-
-
Method Detail
-
listAttachmentsOnServer
@Named("volumeAttachment:list") @GET @Path("/{serverId}/os-volume_attachments") com.google.common.collect.FluentIterable<VolumeAttachment> listAttachmentsOnServer(@PathParam("serverId") String serverId)
Lists Volume Attachments for a given Server.- Parameters:
serverId
- The ID of the Server- Returns:
- All VolumeAttachments for the Server
-
getAttachmentForVolumeOnServer
@Named("volumeAttachment:get") @GET @Path("/{serverId}/os-volume_attachments/{id}") @Nullable VolumeAttachment getAttachmentForVolumeOnServer(@PathParam("id") String volumeId, @PathParam("serverId") String serverId)
Gets a specific Volume Attachment for a Volume and Server.- Parameters:
volumeId
- The ID of the VolumeserverId
- The ID of the Server- Returns:
- The Volume Attachment.
-
attachVolumeToServerAsDevice
@Named("volumeAttachment:attach") @POST @Path("/{serverId}/os-volume_attachments") @Produces("application/json") VolumeAttachment attachVolumeToServerAsDevice(String volumeId, @PathParam("serverId") String serverId, String device)
Attaches a Volume to a Server. Note: If you are using KVM as your hypervisor then the actual device name in the Server will be different than the one specified. When the Server sees a new device, it picks the next available name (which in most cases is /dev/vdc) and the disk shows up there on the Server.- Parameters:
serverId
- The ID of the ServervolumeId
- The ID of the Volumedevice
- The name of the device this Volume will be identified as in the Server (e.g. /dev/vdc)- Returns:
- The Volume Attachment.
-
detachVolumeFromServer
@Named("volumeAttachment:detach") @DELETE @Path("/{serverId}/os-volume_attachments/{id}") boolean detachVolumeFromServer(@PathParam("id") String volumeId, @PathParam("serverId") String serverId)
Detaches a Volume from a server. Note: Make sure you've unmounted the volume first. Failure to do so could result in failure or data loss.- Parameters:
volumeId
- The ID of the VolumeserverId
- The ID of the Server- Returns:
- true if successful
-
-