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 ActionResponse
attach(String volumeId, String instanceId, String mountpoint, String hostName)
Description:Attach volume to a serverActionResponse
bootable(String volumeId, Boolean bootable)
Update volume bootable status.Volume
create(Volume volume)
Creates a new Block Storage VolumeVolumeType
createVolumeType(VolumeType volumeType)
Creates a new volume type with the specified nameVolumeTypeEncryption
createVolumeTypeEncryption(String volumeTypeId, VolumeTypeEncryption volumeTypeEncryption)
Creates a new encryption with the specified instance for the specified volume typeActionResponse
delete(String volumeId)
Deletes the specified volumevoid
deleteVolumeType(String volumeTypeId)
Deletes the specified VolumeTypevoid
deleteVolumeTypeEncryption(String volumeTypeId, String encryptionId)
Deletes the specified volume type encryption for the specified volume typeActionResponse
detach(String volumeId, String attachmentId)
Detach volume from serverActionResponse
extend(String volumeId, Integer newSize)
Extends the specified volume size.ActionResponse
forceDelete(String volumeId)
Attempt forced removal of volume, regardless of the state.ActionResponse
forceDetach(String volumeId, String initiator, String attachmentId)
Description:Force detach a volumeVolume
get(String volumeId)
Gets a Block Storage volume by IDVolumeTypeEncryption
getVolumeTypeEncryption(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 volumeActionResponse
migrate(String volumeId, String hostService, boolean forceHostCopy)
migrate a volume to another host and serviceActionResponse
readOnlyModeUpdate(String volumeId, boolean readonly)
Updates volume read-only access-mode flagActionResponse
resetState(String volumeId, Volume.Status status)
Resets the specified volume status.BlockVolumeTransferService
transfer()
Returns the API used to transfer a Volume from one tenant/project to anotherActionResponse
update(String volumeId, String name, String description)
OpenStack only allows name or description to be updated.VolumeUploadImage
uploadToImage(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:
listVolumeTypes
in 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:
list
in 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:
list
in 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:
listAll
in interfaceBlockVolumeService
- Returns:
- List of all Volumes
-
get
public Volume get(String volumeId)
Gets a Block Storage volume by ID- Specified by:
get
in 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:
delete
in 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:
forceDelete
in 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:
resetState
in 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:
extend
in 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:
bootable
in 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:
create
in 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:
update
in 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:
deleteVolumeType
in interfaceBlockVolumeService
- Parameters:
volumeTypeId
- the volume type identifier
-
createVolumeType
public VolumeType createVolumeType(VolumeType volumeType)
Creates a new volume type with the specified name- Specified by:
createVolumeType
in 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:
createVolumeTypeEncryption
in 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:
getVolumeTypeEncryption
in 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:
deleteVolumeTypeEncryption
in interfaceBlockVolumeService
- Parameters:
volumeTypeId
- the volume type identifierencryptionId
- the encryption identifier
-
migrate
public ActionResponse migrate(String volumeId, String hostService, boolean forceHostCopy)
Description copied from interface:BlockVolumeService
migrate a volume to another host and service- Specified by:
migrate
in 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:BlockVolumeService
Uploads a volume to the image service- Specified by:
uploadToImage
in 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:BlockVolumeService
Returns the API used to transfer a Volume from one tenant/project to another- Specified by:
transfer
in interfaceBlockVolumeService
- Returns:
- the volume transfer service
-
readOnlyModeUpdate
public ActionResponse readOnlyModeUpdate(String volumeId, boolean readonly)
Updates volume read-only access-mode flag- Specified by:
readOnlyModeUpdate
in 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:
attach
in interfaceBlockVolumeService
- Returns:
- ActionResponse
-
forceDetach
public ActionResponse forceDetach(String volumeId, String initiator, String attachmentId)
Description:Force detach a volume
Author:Wang Ting/王婷
- Specified by:
forceDetach
in 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:
detach
in interfaceBlockVolumeService
-
-