Class BlockVolumeServiceImpl
- java.lang.Object
-
- org.openstack4j.openstack.internal.BaseOpenStackService
-
- org.openstack4j.openstack.storage.block.internal.BaseBlockStorageServices
-
- org.openstack4j.openstack.storage.block.internal.BlockVolumeServiceImpl
-
- All Implemented Interfaces:
BlockVolumeService,RestService
public class BlockVolumeServiceImpl extends BaseBlockStorageServices implements BlockVolumeService
Manages Volumes and Volume Type based operations against Block Storage (Cinder)- Author:
- Jeremy Unruh
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstack4j.openstack.internal.BaseOpenStackService
BaseOpenStackService.Invocation<R>
-
-
Constructor Summary
Constructors Constructor Description BlockVolumeServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ActionResponseattach(String volumeId, String instanceId, String mountpoint, String hostName)Description:Attach volume to a serverActionResponsebootable(String volumeId, Boolean bootable)Update volume bootable status.Volumecreate(Volume volume)Creates a new Block Storage VolumeVolumeTypecreateVolumeType(VolumeType volumeType)Creates a new volume type with the specified nameVolumeTypeEncryptioncreateVolumeTypeEncryption(String volumeTypeId, VolumeTypeEncryption volumeTypeEncryption)Creates a new encryption with the specified instance for the specified volume typeActionResponsedelete(String volumeId)Deletes the specified volumevoiddeleteVolumeType(String volumeTypeId)Deletes the specified VolumeTypevoiddeleteVolumeTypeEncryption(String volumeTypeId, String encryptionId)Deletes the specified volume type encryption for the specified volume typeActionResponsedetach(String volumeId, String attachmentId)Detach volume from serverActionResponseextend(String volumeId, Integer newSize)Extends the specified volume size.ActionResponseforceDelete(String volumeId)Attempt forced removal of volume, regardless of the state.ActionResponseforceDetach(String volumeId, String initiator, String attachmentId)Description:Force detach a volumeVolumeget(String volumeId)Gets a Block Storage volume by IDVolumeTypeEncryptiongetVolumeTypeEncryption(String volumeTypeId)Retrieves the encryption for the specified volume typeList<? extends Volume>list()Lists summary information for all Block Storage volumes that the tenant who submits the request can access.List<? extends Volume>list(Map<String,String> filteringParams)Returns list of Block Storage volumes filtered by parameters.List<? extends Volume>listAll()Lists all Block Storage volumes for all tenants.List<? extends VolumeType>listVolumeTypes()The volume type defines the characteristics of a volumeActionResponsemigrate(String volumeId, String hostService, boolean forceHostCopy)migrate a volume to another host and serviceActionResponsereadOnlyModeUpdate(String volumeId, boolean readonly)Updates volume read-only access-mode flagActionResponseresetState(String volumeId, Volume.Status status)Resets the specified volume status.BlockVolumeTransferServicetransfer()Returns the API used to transfer a Volume from one tenant/project to anotherActionResponseupdate(String volumeId, String name, String description)OpenStack only allows name or description to be updated.VolumeUploadImageuploadToImage(String volumeId, UploadImageData data)Uploads a volume to the image service-
Methods inherited from class org.openstack4j.openstack.internal.BaseOpenStackService
delete, deleteWithResponse, get, getProvider, getServiceVersion, getWithResponse, getXOpenstackRequestId, head, patch, patchWithResponse, post, postWithResponse, put, putWithResponse, request, toList, uri
-
-
-
-
Method Detail
-
listVolumeTypes
public List<? extends VolumeType> listVolumeTypes()
The volume type defines the characteristics of a volume- Specified by:
listVolumeTypesin interfaceBlockVolumeService- Returns:
- List of VolumeType entities
-
list
public List<? extends Volume> list()
Lists summary information for all Block Storage volumes that the tenant who submits the request can access.- Specified by:
listin interfaceBlockVolumeService- Returns:
- List of Volumes
-
list
public List<? extends Volume> list(Map<String,String> filteringParams)
Returns list of Block Storage volumes filtered by parameters.- Specified by:
listin interfaceBlockVolumeService- Parameters:
filteringParams- map (name, value) of filtering parameters
-
listAll
public List<? extends Volume> listAll()
Lists all Block Storage volumes for all tenants.- Specified by:
listAllin interfaceBlockVolumeService- Returns:
- List of all Volumes
-
get
public Volume get(String volumeId)
Gets a Block Storage volume by ID- Specified by:
getin interfaceBlockVolumeService- Parameters:
volumeId- the volume identifier- Returns:
- the volume or null if not found
-
delete
public ActionResponse delete(String volumeId)
Deletes the specified volume- Specified by:
deletein interfaceBlockVolumeService- Parameters:
volumeId- the volume identifier- Returns:
- the action response
-
forceDelete
public ActionResponse forceDelete(String volumeId)
Attempt forced removal of volume, regardless of the state. It's dangerous but useful. It's not 100% success.- Specified by:
forceDeletein interfaceBlockVolumeService- Parameters:
volumeId- the volume id- Returns:
- the action response
-
resetState
public ActionResponse resetState(String volumeId, Volume.Status status)
Resets the specified volume status.- Specified by:
resetStatein interfaceBlockVolumeService- Parameters:
volumeId- the volume idstatus- new volume status- Returns:
- the action response
-
extend
public ActionResponse extend(String volumeId, Integer newSize)
Extends the specified volume size.- Specified by:
extendin interfaceBlockVolumeService- Parameters:
volumeId- the volume idnewSize- new volume size- Returns:
- the action response
-
bootable
public ActionResponse bootable(String volumeId, Boolean bootable)
Update volume bootable status.- Specified by:
bootablein interfaceBlockVolumeService- Parameters:
volumeId- the volume idbootable- Enables or disables the bootable attribute- Returns:
- the action response
-
create
public Volume create(Volume volume)
Creates a new Block Storage Volume- Specified by:
createin interfaceBlockVolumeService- Parameters:
volume- the volume for create- Returns:
- the created volume
-
update
public ActionResponse update(String volumeId, String name, String description)
OpenStack only allows name or description to be updated. This call enforces that based on the API docs.- Specified by:
updatein interfaceBlockVolumeService- Parameters:
volumeId- the volume idname- the name to update (null indicates no name update)description- the description to update (null indicates no description update)- Returns:
- the action response
-
deleteVolumeType
public void deleteVolumeType(String volumeTypeId)
Deletes the specified VolumeType- Specified by:
deleteVolumeTypein interfaceBlockVolumeService- Parameters:
volumeTypeId- the volume type identifier
-
createVolumeType
public VolumeType createVolumeType(VolumeType volumeType)
Creates a new volume type with the specified name- Specified by:
createVolumeTypein interfaceBlockVolumeService- Parameters:
volumeType- the volumeType for create- Returns:
- the created volume type
-
createVolumeTypeEncryption
public VolumeTypeEncryption createVolumeTypeEncryption(String volumeTypeId, VolumeTypeEncryption volumeTypeEncryption)
Creates a new encryption with the specified instance for the specified volume type- Specified by:
createVolumeTypeEncryptionin interfaceBlockVolumeService- Parameters:
volumeTypeId- the volume type identifiervolumeTypeEncryption- the encryption to create- Returns:
- the created volume type encryption
-
getVolumeTypeEncryption
public VolumeTypeEncryption getVolumeTypeEncryption(String volumeTypeId)
Retrieves the encryption for the specified volume type- Specified by:
getVolumeTypeEncryptionin interfaceBlockVolumeService- Parameters:
volumeTypeId- the volume type identifier- Returns:
- the encryption
-
deleteVolumeTypeEncryption
public void deleteVolumeTypeEncryption(String volumeTypeId, String encryptionId)
Deletes the specified volume type encryption for the specified volume type- Specified by:
deleteVolumeTypeEncryptionin interfaceBlockVolumeService- Parameters:
volumeTypeId- the volume type identifierencryptionId- the encryption identifier
-
migrate
public ActionResponse migrate(String volumeId, String hostService, boolean forceHostCopy)
Description copied from interface:BlockVolumeServicemigrate a volume to another host and service- Specified by:
migratein interfaceBlockVolumeService- Parameters:
volumeId- the volume idhostService- the destination host and service ,like kvmnode002021.cnsuning.com@lvmdriver- Returns:
- the action response
-
uploadToImage
public VolumeUploadImage uploadToImage(String volumeId, UploadImageData data)
Description copied from interface:BlockVolumeServiceUploads a volume to the image service- Specified by:
uploadToImagein interfaceBlockVolumeService- Parameters:
volumeId- the volume identifier to uploaddata- the data about the volume being uploaded (required)- Returns:
- the volume upload image containing the current status
-
transfer
public BlockVolumeTransferService transfer()
Description copied from interface:BlockVolumeServiceReturns the API used to transfer a Volume from one tenant/project to another- Specified by:
transferin interfaceBlockVolumeService- Returns:
- the volume transfer service
-
readOnlyModeUpdate
public ActionResponse readOnlyModeUpdate(String volumeId, boolean readonly)
Updates volume read-only access-mode flag- Specified by:
readOnlyModeUpdatein interfaceBlockVolumeService- Parameters:
volumeId- ID of volume to updatereadonly- enables or disables update of volume to read-only access mode- Returns:
- the action response
-
attach
public ActionResponse attach(String volumeId, String instanceId, String mountpoint, String hostName)
Description:Attach volume to a server
Volume status must be available. You should set instanceId or hostName.Author:Wang Ting/王婷
- Specified by:
attachin interfaceBlockVolumeService- Returns:
- ActionResponse
-
forceDetach
public ActionResponse forceDetach(String volumeId, String initiator, String attachmentId)
Description:Force detach a volume
Author:Wang Ting/王婷
- Specified by:
forceDetachin interfaceBlockVolumeService- See Also:
BlockVolumeService.forceDetach(java.lang.String, java.lang.String, java.lang.String)
-
detach
public ActionResponse detach(String volumeId, String attachmentId)
Detach volume from server- Specified by:
detachin interfaceBlockVolumeService
-
-