Cinder¶
Cinder conftest¶
Contains fixtures specific for cinder.
-
stepler.cinder.conftest.backup_steps(get_backup_steps, cleanup_backups)[source]¶ Function fixture to get volume backup steps.
Parameters: - get_backup_steps (object) – function to get backup steps
- cleanup_backups (function) – function to cleanup backups after test
Yields: stepler.cinder.steps.BackupSteps – instantiated backup steps
-
stepler.cinder.conftest.big_snapshot_quota(get_current_project, get_cinder_quota_steps)[source]¶ Session fixture to increase cinder snapshots count quota.
This fixture restore original quota value after test.
Parameters: - get_current_project (function) – function to get current project
- get_cinder_quota_steps (function) – function to get cinder quota steps
-
stepler.cinder.conftest.bootable_volume(cirros_image, volume_steps)[source]¶ Function fixture to create bootable volume with default options.
Parameters: - cirros_image (obj) – glance image to create volume from
- volume_steps (VolumeSteps) – instantiated volume steps
Returns: bootable cinder volume
Return type: object
-
stepler.cinder.conftest.bootable_volume_with_private_image(cirros_image_private, volume_steps)[source]¶ Function fixture to create bootable volume with default options.
Parameters: - cirros_image (obj) – glance image to create volume from
- volume_steps (VolumeSteps) – instantiated volume steps
Returns: bootable cinder volume
Return type: object
-
stepler.cinder.conftest.cinder_client(get_cinder_client)[source]¶ Function fixture to get cinder client.
Parameters: get_cinder_client (function) – function to get cinder client Returns: instantiated cinder client Return type: cinderclient.client.Client
-
stepler.cinder.conftest.cinder_quota_steps(get_cinder_quota_steps)[source]¶ Function fixture to get cinder quota steps.
Parameters: get_cinder_quota_steps (function) – function to get cinder quota steps Returns: instantiated quota steps Return type: stepler.cinder.steps.CinderQuotaSteps
-
stepler.cinder.conftest.cleanup_backups(uncleanable)[source]¶ Callable function fixture to clear created backups after test.
It stores ids of all backups before test and remove all new backups after test.
Parameters: uncleanable (AttrDict) – data structure with skipped resources Returns: function to cleanup backups Return type: function
-
stepler.cinder.conftest.cleanup_snapshots(uncleanable)[source]¶ Callable function fixture to cleanup snapshots after test.
Parameters: uncleanable (AttrDict) – data structure with skipped resources Returns: function to cleanup snapshots Return type: function
-
stepler.cinder.conftest.cleanup_transfers(uncleanable)[source]¶ Callable function fixture to clear created transfers after test.
Parameters: uncleanable (AttrDict) – data structure with skipped resources Returns: function to cleanup transfers Return type: function
-
stepler.cinder.conftest.cleanup_volumes(uncleanable)[source]¶ Callable session fixture to cleanup volumes.
Parameters: uncleanable (AttrDict) – Data structure with resources to skip cleanup.
-
stepler.cinder.conftest.create_backup(backup_steps)[source]¶ Callable function fixture to create single volume backup with options.
Can be called several times during a test. After the test it destroys all created backups.
Parameters: backup_steps (object) – instantiated volume backup steps Returns: function to create volume backup as batch with options Return type: function
-
stepler.cinder.conftest.create_volume_transfer(transfer_steps)[source]¶ Callable function fixture to create volume transfer with options.
Can be called several times during test.
Parameters: transfer_steps (VolumeTransferSteps) – instantiated transfer steps Yields: function – function to create singe volume transfer with options
-
stepler.cinder.conftest.create_volume_type(volume_type_steps)[source]¶ Callable function fixture to create volume types with options.
Can be called several times during test.
Parameters: volume_type_steps (VolumeTypeSteps) – instantiated volume type steps Yields: function – function to create singe volume type with options
-
stepler.cinder.conftest.get_backup_steps(get_cinder_client)[source]¶ Callable session fixture to get volume backup steps.
Parameters: get_cinder_client (object) – function to get cinder client Returns: function to get backup steps Return type: function
-
stepler.cinder.conftest.get_cinder_client(get_session)[source]¶ Callable session fixture to get cinder client.
Parameters: session (object) – authenticated keystone session Returns: instantiated cinder client Return type: cinderclient.client.Client
-
stepler.cinder.conftest.get_cinder_quota_steps(get_cinder_client)[source]¶ Callable session fixture to get cinder quota steps.
Parameters: get_cinder_client (function) – function to get cinder client Returns: function to get cinder quota steps Return type: function
-
stepler.cinder.conftest.get_snapshot_steps(get_cinder_client)[source]¶ Callable session fixture to get snapshot steps.
Parameters: get_cinder_client (function) – function to get cinder client Returns: function to get snapshot steps Return type: function
-
stepler.cinder.conftest.get_transfer_steps(get_cinder_client)[source]¶ Callable session fixture to get volume transfer steps.
Parameters: get_cinder_client (function) – function to get cinder client. Returns: function to get transfer steps. Return type: function
-
stepler.cinder.conftest.get_volume_steps(get_cinder_client)[source]¶ Callable session fixture to get volume steps.
Parameters: get_cinder_client (function) – function to get cinder client Returns: function to get volume steps Return type: function
-
stepler.cinder.conftest.primary_volumes(get_volume_steps, cleanup_volumes, uncleanable)[source]¶ Session fixture to remember primary volumes before tests.
Also optionally in finalization it deletes all unexpected volumes which are remained after tests.
Parameters: - get_volume_steps (function) – Function to get volume steps.
- cleanup_volumes (function) – Function to cleanup volumes.
- uncleanable (AttrDict) – Data structure with skipped resources.
-
stepler.cinder.conftest.snapshot_steps(get_snapshot_steps, cleanup_snapshots)[source]¶ Function fixture to get snapshot steps.
Parameters: - cinder_client (object) – instantiated cinder client
- cleanup_snapshots (function) – function fixture to cleanup snapshots
Yields: stepler.cinder.steps.SnapshotSteps – instantiated snapshot steps
-
stepler.cinder.conftest.transfer_steps(get_transfer_steps, cleanup_transfers)[source]¶ Function fixture to get volume transfer steps.
Parameters: - get_transfer_steps (function) – function to get transfer steps
- cleanup_transfers (function) – function to cleanup transfers after test
Yields: VolumeTransferSteps – instantiated transfer steps.
-
stepler.cinder.conftest.unexpected_volumes_cleanup(primary_volumes, get_volume_steps, cleanup_volumes)[source]¶ Function fixture to clear unexpected volumes.
It provides cleanup before and after test.
-
stepler.cinder.conftest.upload_volume_to_image(volume_steps, glance_steps)[source]¶ Callable function fixture to upload volume to image.
Can be called several times during a test. After the test it destroys all created objects.
Parameters: - volume_steps (VolumeSteps) – instantiated volume steps
- glance_steps (GlanceSteps) – instantiated glance steps
Returns: function to upload volume to image
Return type: function
-
stepler.cinder.conftest.volume(volume_steps)[source]¶ Function fixture to create volume with default options before test.
Parameters: volume_steps (VolumeSteps) – instantiated volume steps Returns: cinder volume Return type: object
-
stepler.cinder.conftest.volume_backups(request, volume, backup_steps)[source]¶ Function fixture to create volume backups with default options.
Parameters: - request (obj) – py.test’s SubRequest instance
- volume (obj) – cinder volume
- backup_steps (VolumeSteps) – instantiated backup steps
Returns: cinder volume backups
Return type:
-
stepler.cinder.conftest.volume_size_quota(current_project, cinder_quota_steps)[source]¶ Function fixture to get cinder volume size quota.
Default value for volume size quota can be too large for some tests. This fixture sets volume size quota for the current project to the value from config and then yields this value. The fixture restores original quota value after test.
Parameters: - current_project (obj) – current project
- cinder_quota_steps (obj) – initialized cinder quota steps
Yields: int – volume size quota value
-
stepler.cinder.conftest.volume_snapshot(volume, snapshot_steps)[source]¶ Function fixture to create snapshot with default options before test.
Parameters: - volume (object) – cinder volume
- snapshot_steps (object) – instantiated snapshot steps
Returns: cinder volume snapshot
Return type: object
-
stepler.cinder.conftest.volume_snapshots(request, volume, snapshot_steps)[source]¶ Function fixture to create volume snapshots with default options.
Parameters: - request (object) – py.test’s SubRequest instance
- volume (object) – cinder volume
- snapshot_steps (SnapshotSteps) – instantiated snapshot steps
Returns: cinder volume snapshots
Return type:
-
stepler.cinder.conftest.volume_steps(unexpected_volumes_cleanup, get_volume_steps, cleanup_volumes)[source]¶ Function fixture to get volume steps.
Parameters: - get_volume_steps (function) – function to get volume steps
- cleanup_volumes (function) – function to cleanup volumes after test
Yields: VolumeSteps – instantiated volume steps
-
stepler.cinder.conftest.volume_type(create_volume_type)[source]¶ Fixture to create volume type with default options before test.
Parameters: create_volume_type (function) – function to create volume type Returns: volume type Return type: object
-
stepler.cinder.conftest.volume_type_steps(cinder_client)[source]¶ Function fixture to get cinder volume types steps.
Parameters: cinder_client (object) – instantiated cinder client Returns: instantiated types steps Return type: stepler.cinder.steps.CinderVolumeTypeSteps
-
stepler.cinder.conftest.volumes(request, volume_steps)[source]¶ Function fixture to create volumes with default options before test.
Parameters: - request (obj) – py.test’s SubRequest instance
- volume_steps (VolumeSteps) – instantiated volume steps
Returns: cinder volumes
Return type:
Cinder steps¶
Contains steps specific for cinder.
-
class
stepler.cinder.steps.VolumeSteps(client)[source]¶ Volume steps.
-
change_volume_type(volume, volume_type, policy, check=True)[source]¶ Step to retype volume.
Parameters: - volume (object) – cinder volume
- volume_type (object) – cinder volume type
- policy (str) – policy for migration during the retype
- check (bool) – flag whether to check step or not
Raises: TimeoutExpired– if check failed after timeout
-
check_cinder_available(must_be=True)[source]¶ Step to check cinder availability.
Parameters: must_be (bool) – flag whether cinder must be available or not Raises: TimeoutExpired– if check failed after timeout
-
check_migration_status(volume, status, timeout=0)[source]¶ Step to check migration status.
Parameters: - volume (object) – cinder volume to check migration status
- status (str) – expected migration status
- timeout (int) – seconds to wait a result of check
Raises: TimeoutExpired– if migration status is not equal to ‘status’ after timeout
-
check_volume_attachments(volume, server_ids=None, timeout=0)[source]¶ Step to check volume attachments.
Parameters: - volume (object) – cinder volume
- server_ids (list) – list of nova servers ids
- timeout (int) – seconds to wait a result of check
Raises: TimeoutExpired– if check failed after timeout
-
check_volume_deletion_with_wrong_id()[source]¶ Step to check negative volume deletion with wrong volume id.
Raises: AssertionError– if NotFound exception is not appeared
-
check_volume_deletion_without_cascading_failed(volume)[source]¶ Step to check negative volume deletion without cascade option.
Parameters: volume (object) – cinder volume Raises: BadRequest– if check failed
-
check_volume_extend_failed_incorrect_size(volume, size)[source]¶ Step to check negative volume extend to incorrect size.
Parameters: - volume (object) – cinder volume
- size (int) – volume size
Raises: AssertionError– if check failed
-
check_volume_extend_failed_size_more_than_limit(volume, size)[source]¶ Step to check negative volume extend to size more than limit.
Parameters: - volume (object) – cinder volume
- size (int) – volume size
Raises: AssertionError– if check failed
-
check_volume_host(volume, host, timeout=0)[source]¶ Step to check volume host.
Parameters: - volume (object) – cinder volume to check host
- host (str) – expected volume host to check
- timeout (int) – seconds to wait a result of check
Raises: TimeoutExpired– if volume host is not changed after timeout
-
check_volume_not_created_with_incorrect_size(size)[source]¶ Step to check negative volume creation with negative/zero size.
Parameters: size (int) – volume size Raises: AssertionError– if check failed
-
check_volume_not_created_with_long_name(name)[source]¶ Step to check volume is not created with long name.
Parameters: name (str) – name for volume. Expected long name in argument Raises: AssertionError– if check triggered an error
-
check_volume_not_created_with_non_exist_volume_type(image)[source]¶ Step to check volume is not created with non-existed volume type.
Parameters: image (obj) – image for volume creation Raises: AssertionError– if check triggered an error
-
check_volume_not_created_with_size_more_than_limit(size)[source]¶ Step to check negative volume creation with size more than limit.
Parameters: size (int) – volume size in gb Raises: AssertionError– if check failed
-
check_volume_not_created_with_wrong_image_id()[source]¶ Step to check volume is not created with wrong image id.
Raises: AssertionError– if check triggered an error
-
check_volume_presence(volume, must_present=True, timeout=0)[source]¶ Check step volume presence status.
Parameters: - volume (object) – cinder volume to check presence status
- must_present (bool) – flag whether volume should present or not
- timeout (int) – seconds to wait a result of check
Raises: TimeoutExpired– if check failed after timeout
-
check_volume_properties(volume, timeout=0, **properties)[source]¶ Step to check volume’s properties.
Parameters: - volume (object) – cinder volume
- timeout (int) – seconds to wait a result of check
- **properties – volume’s properties to check
Raises: TimeoutExpired– if check failed after timeout
-
check_volume_size(volume, size, timeout=0)[source]¶ Step to check volume size.
Parameters: - volume (object) – cinder volume
- size (int) – expected volume size
- timeout (int) – seconds to wait a result of check
Raises: TimeoutExpired– if check failed after timeout
-
check_volume_status(volume, statuses, transit_statuses=(), timeout=0)[source]¶ Check step volume status.
Parameters: - volume (object|str) – cinder volume to check status or its id
- statuses (list) – list of statuses to check
- transit_statuses (tuple) – possible volume transitional statuses
- timeout (int) – seconds to wait a result of check
Raises: TimeoutExpired|AssertionError– if check failed after timeout
-
check_volume_type(volume, volume_type, timeout=0)[source]¶ Step to check volume type.
Parameters: - volume (object) – cinder volume
- volume_type (obj) – expected volume type
- timeout (int) – seconds to wait a result of check
Raises: TimeoutExpired– if check failed after timeout
-
check_volume_update_failed(volume, new_name=None, new_description=None)[source]¶ Step to check negative volume update.
Parameters: - volume (object) – cinder volume
- new_name (str) – new name for volume
- new_description (str) – new description for volume
Raises: BadRequest– if check failed
-
create_volumes(names=None, size=1, image=None, volume_type=None, description=None, snapshot_id=None, source_volid=None, metadata=None, check=True)[source]¶ Step to create volumes.
Parameters: - names (list) – names of created volume, if not specified one volume name will be generated
- size (int) – size of created volume (in GB)
- image (object) – glance image to create volume from
- volume_type (str) – type of volume
- description (str) – description
- snapshot_id (str) – ID of the snapshot
- source_volid (str) – ID of source volume to clone from
- metadata (dict) – volume metadata
- check (bool) – flag whether to check step or not
Returns: cinder volumes
Return type: Raises: TimeoutExpired|AssertionError– if check failed after timeout
-
delete_volumes(volumes, cascade=False, force=False, check=True)[source]¶ Step to delete volumes.
Parameters: - volumes (list) – cinder volumes
- cascade (bool) – flag whether to delete dependent snapshot or not
- force (bool, optional) – attempt forced removal of volume(s), regardless of state
- check (bool) – flag whether to check step or not
-
get_attached_server_ids(volume, check=True)[source]¶ Step to retrieve IDs of servers attached to volume.
Parameters: - volume (object) – cinder volume
- check (bool) – flag whether to check step or not
Returns: attached server ids
Return type: Raises: AssertionError– if no attached server IDs
-
get_volume_by_id(volume_id, check=True)[source]¶ Step to get volume object from cinder using volume id.
Parameters: - volume_id (str) – volume id
- check (bool) – flag whether to check step or not
Returns: volume
Return type: object
Raises: exceptions.NotFound– if volume with volume_id doesn’t existAssertionError– if check failed
-
get_volume_migrate_host(volume, nodes, check=True)[source]¶ Step to get cinder host to migrate volume.
Parameters: - volume (str) – migrating volume
- nodes (iterable) – cinder nodes
- check (bool) – flag whether to check step or not
Returns: host to volume migrate
Return type: str
Raises: LookupError– if no available hosts to migrate
-
get_volumes(name_prefix=None, metadata=None, search_opts=None, check=True)[source]¶ Step to retrieve volumes.
Parameters: - name_prefix (str, optional) – Prefix to filter volumes by name
- metadata (dict, optional) – Data to filter volume by metadata
key: value - (dict (search_opts) – optional): API filter options to retrieve volumes
- check (bool, optional) – Flag whether to check step or not
Returns: Volumes collection
Return type: Raises: AssertionError– If volumes collection is empty
-
migrate_volume(volume, host, force_host_copy=False, lock_volume=False, check=True)[source]¶ Step to migrate volume.
Parameters: - volume (object) – volume to migrate
- host (str) – target host to migrate volume
- force_host_copy (bool) – skip driver optimizations
- lock_volume (bool) – lock the volume
- check (bool) – flag whether to check step or not
Raises: TimeoutExpired– if migration status is not ‘success’ or volume host is not changed after timeout
-
set_volume_bootable(volume, bootable, check=True)[source]¶ Step to set volume bootable.
Parameters: - volume (object) – cinder volume
- bootable (bool) – flag whether to set or unset volume bootable
- check (bool) – flag whether to check step or not
Raises: AssertionError– if check failed
-
update_volume(volume, new_name=None, new_description=None, check=True)[source]¶ Step to update volume.
Parameters: - volume (object) – cinder volume
- new_name (str) –
- new_description (str) – new description for volume
- check (bool) – flag whether to check step or not
Raises: AssertionError– if check failed
-
volume_extend(volume, size, check=True)[source]¶ Step to extend volume to new size.
Parameters: - volume (object) – cinder volume
- size (int) – The new volume size
- check (bool) – flag whether to check step or not
Raises: TimeoutExpired– if check failed after timeout
-
volume_upload_to_image(volume, image_name=None, force=False, container_format='bare', disk_format='raw', check=True)[source]¶ Step to upload volume to image.
Parameters: - volume (object) – The
Volumeto upload - image_name (str) – The new image name
- force (bool) – Enables or disables upload of a volume that is
- to an instance (attached) –
- container_format (str) – Container format type
- disk_format (str) – Disk format type
- check (bool) – flag whether to check step or not
Raises: AssertionError– if check was triggered to FalseReturns: image
Return type: object
- volume (object) – The
-
-
class
stepler.cinder.steps.VolumeTypeSteps(client)[source]¶ Cinder volume types steps.
-
check_volume_type_presence(volume_type, must_present=True, timeout=0)[source]¶ Check step volume type presence status.
Parameters: - volume_type (object) – cinder volume type to check presence status
- must_present (bool|True) – flag whether volume type should present
- not (or) –
- timeout (int) – seconds to wait a result of check
Raises: TimeoutExpired– if check failed after timeout
-
create_volume_type(name, description=None, is_public=True, check=True)[source]¶ Step to create volume type.
Parameters: - name (str) – name of created volume type
- description (str) – description
- is_public (bool|True) – volume type visibility
- check (bool|true) – flag whether to check step or not
Returns: cinder volume type
Return type: object
Raises: AssertionError– if check failed
-
-
class
stepler.cinder.steps.CinderQuotaSteps(client)[source]¶ Cinder quota steps.
-
get_backups_quota(project, check=True)[source]¶ Step to retrieve quota for backups count.
Parameters: - project (obj) – project object
- check (bool|True) – flag whether to check step or not
Returns: current quota value
Return type: int
Raises: AssertionError– if check failed
-
get_snapshots_quota(project, check=True)[source]¶ Step to retrieve quota for snapshots count.
Parameters: - project (obj) – project object
- check (bool|True) – flag whether to check step or not
Returns: current quota value
Return type: int
Raises: AssertionError– if check failed
-
get_volume_size_quota(project, check=True)[source]¶ Step to retrieve quota for volume size.
Parameters: - check (bool|True) – flag whether to check step or not
- project (obj) – project object
Returns: size in gigabytes
Return type: int
Raises: AssertionError– if check failed
-
get_volumes_quota(project, check=True)[source]¶ Step to retrieve quota for volumes count.
Parameters: - project (obj) – project object
- check (bool|True) – flag whether to check step or not
Returns: current quota value
Return type: int
Raises: AssertionError– if check failed
-
set_backups_quota(project, value, check=True)[source]¶ Step to set quota for backups count.
Parameters: - project (obj) – project object
- value (int) – new backups count quota value
- check (bool|True) – flag whether to check step or not
Raises: AssertionError– if check failed
-
set_snapshots_quota(project, value, check=True)[source]¶ Step to retrieve quota for volume size.
Parameters: - project (obj) – project object
- value (int) – new snapshots count quota value
- check (bool|True) – flag whether to check step or not
- No Longer Raises:
- AssertionError: if check failed
-
-
class
stepler.cinder.steps.SnapshotSteps(client)[source]¶ Snapshot steps.
-
check_snapshot_status(snapshot, statuses, timeout=0)[source]¶ Step to check snapshots status.
Parameters: - snapshot (obj) – cinder volume snapshot objects or id to check status
- statuses (list) – list of statuses names to check
- timeout (int) – seconds to wait a result of check
Raises: TimeoutExpired– if check failed after timeout
-
check_snapshots_presence(snapshots, must_present=True, timeout=0)[source]¶ Step to check snapshots presence status.
Parameters: - snapshots (list) – cinder volume snapshots to check presence status
- must_present (bool) – flag whether snapshot should present
- timeout (int) – seconds to wait a result of check
Raises: TimeoutExpired– if check failed after timeout
-
create_snapshots(volume, names=None, description=None, check=True)[source]¶ Step to create snapshots.
Parameters: - volume (object) – volume of the snapshots
- names (list) – name of created snapshots, if not specified one snapshot name will be generated
- description (str) – snapshot description
- check (bool) – flag whether to check step or not
Returns: cinder volume snapshots
Return type: Raises: TimeoutExpired|AssertionError– if check failed after timeout
-
delete_snapshots(snapshots, check=True)[source]¶ Step to delete snapshots.
Parameters: - snapshots (list) – cinder volume snapshots
- check (bool) – flag whether to check step or not
Raises: TimeoutExpired– if check failed after timeout
-
get_snapshot_by_id(snapshot_id, check=True)[source]¶ Step to get snapshot object from cinder using snapshot id.
Parameters: - snapshot_id (str) – volume snapshot id
- check (bool) – flag whether to check step or not
Returns: volume snapshot
Return type: object
Raises: NotFound– if snapshot with snapshot_id doesn’t existAssertionError– if check failed
-
-
class
stepler.cinder.steps.VolumeTransferSteps(client)[source]¶ Cinder volume transfer steps.
-
accept_volume_transfer(transfer, check=True)[source]¶ Step to accept volume transfer.
Parameters: - transfer (obj) – volume transfer object
- check (bool|true) – flag whether to check step or not
Raises: TimeoutExpired– if check failed after timeout
-
check_transfer_not_created_with_long_transfer_name(volume, transfer_name)[source]¶ Step for negative test case of transfer creation with invalid name.
Parameters: - volume (obj) – volume to create transfer
- transfer_name (str) – name of transfer
Raises: AssertionError– if check triggered an error
-
check_volume_transfer_presence(transfer, must_present=True, timeout=0)[source]¶ Check step volume transfer presence status.
Parameters: - transfer (object) – cinder volume transfer to check presence status
- must_present (bool|True) – flag whether volume type should present
- not (or) –
- timeout (int) – seconds to wait a result of check
Raises: TimeoutExpired– if check failed after timeout
-
create_volume_transfer(volume, transfer_name, check=True)[source]¶ Step to create volume transfer.
Parameters: - volume (obj) – volume object
- transfer_name (str) – name of created volume transfer
- check (bool|true) – flag whether to check step or not
Returns: cinder volume transfer
Return type: object
Raises: TimeoutExpired|AssertionError– if check failed after timeout
-
delete_volume_transfer(transfer, check=True)[source]¶ Step to delete(cancel) volume transfer.
Parameters: - transfer (obj) – volume transfer object
- check (bool|true) – flag whether to check step or not
Raises: TimeoutExpired– if check failed after timeout
-
get_transfers(search_opts=None, check=True)[source]¶ Step to retrieve volume transfers.
Parameters: - (dict (search_opts) – optional): API filter options to retrieve transfers
- check (bool|True) – flag whether to check step or not
Returns: volume transfers list
Return type: Raises: AssertionError– if check failed
-
-
class
stepler.cinder.steps.BackupSteps(client)[source]¶ Backup steps.
-
check_backup_not_created_with_long_container_name(volume, container)[source]¶ - Step to check that backup is not created with overlimit container
- name length.
Parameters: - volume (obj) – cinder volume
- container (str) – container name
Raises: AssertionError– if no BadRequest occurs or exception message is unexpected
-
check_backup_presence(backup, must_present=True, timeout=0)[source]¶ Check step volume backup presence status.
Parameters: - backup (object) – volume backup to check presence status
- must_present (bool) – flag whether volume should present or not
- timeout (int) – seconds to wait a result of check
Raises: TimeoutExpired– if check failed after timeout
-
check_backup_status(backup, status, transit_statuses=('creating', ), timeout=0)[source]¶ Check step volume backup status.
Parameters: - backup (object or str) – volume backup object or its id to check status
- status (str) – backup status name to check
- transit_statuses (tuple) – possible backup transitional statuses
- timeout (int) – seconds to wait a result of check
Raises: TimeoutExpired– if check failed after timeout
-
create_backup(volume, name=None, container=None, description=None, snapshot_id=None, check=True)[source]¶ Step to create volume backup.
Parameters: - volume (object) – cinder volume
- name (str) – name of created backup
- container (str) – name of the backup service container
- description (str) – description
- snapshot_id (str) – id of snapshot created from volume
- check (bool) – flag whether to check step or not
Returns: volume backup
Return type: object
Raises: TimeoutExpired– if backup is not available after timeoutAssertionError– if backup attributes are not the same as ones entered during creation
-
delete_backup(backup, check=True)[source]¶ Step to delete volume backup.
Parameters: - backup (object) – volume backup
- check (bool) – flag whether to check step or not
-
get_backup_by_id(backup_id, check=True)[source]¶ Step to get backup object from cinder using backup id.
Parameters: - backup_id (str) – volume backup id
- check (bool) – flag whether to check step or not
Returns: volume backup
Return type: object
Raises: exceptions.NotFound– if backup with backup_id doesn’t existAssertionError– if check was failed
-
get_backups(search_opts=None, check=True)[source]¶ Step to retrieve all backups from cinder.
Parameters: - (dict (search_opts) – optional): API filter options to retrieve backups
- check (bool) – flag whether to check step or not
Returns: backups list
Return type: Raises: AssertionError– if check was failed
-
Cinder tests¶
Backup tests¶
-
stepler.cinder.tests.test_backups.test_create_volume_backup_with_container(volume, create_backup)[source]¶ Scenario: Backup is created with custom container name.
Setup:
- Create volume
Steps:
- Create backup with custom container name
- Check container name of backup
Teardown:
- Delete backup
- Delete volume
-
stepler.cinder.tests.test_backups.test_create_volume_snapshot_backup(volume, volume_snapshot, create_backup)[source]¶ Scenario: Verify ability to create backup from snapshot of volume.
Setup:
- Create volume
- Create volume snapshot
Steps:
- Create backup
Teardown:
- Delete snapshot
- Delete volume
- Delete backup
-
stepler.cinder.tests.test_backups.test_negative_create_backup_long_container_name(volume, backup_steps)[source]¶ Scenario: Backup isn’t created with overlimit container name length.
Setup:
- Create cinder volume
Steps:
- Try to create volume backup with container name length > 255
- Check that BadRequest exception raised
Teardown:
- Delete cinder volume
Volume tests¶
-
stepler.cinder.tests.test_change_volume_type.test_change_volume_type(create_volume_type, volume_steps)[source]¶ Scenario: Verify change volume type.
Steps:
- Create two volume types
- Create volume using first volume type
- Retype volume to another type
Teardown:
- Delete volume
- Delete volume types
-
stepler.cinder.tests.test_change_volume_type.test_change_volume_type_from_empty(volume_type, volume, volume_steps)[source]¶ Scenario: Verify change volume type from empty value.
Setup::
- Create volume type
- Create volume without volume type
Steps:
- Change volume type to newly created type
Teardown:
- Delete volume
- Delete volume type
Volume tests¶
Volume tests¶
Volume tests¶
-
stepler.cinder.tests.test_edit_volume.test_edit_volume_description(volume, volume_steps, new_volume_description)[source]¶ Scenario: Verify ability to change volume description.
Setup:
- Create volume
Steps:
- Change volume description
Teardown:
- Delete volume
-
stepler.cinder.tests.test_edit_volume.test_edit_volume_name(volume, volume_steps, new_volume_name)[source]¶ Scenario: Verify ability to change volume name.
Setup:
- Create volume
Steps:
- Change volume name
Teardown:
- Delete volume
-
stepler.cinder.tests.test_edit_volume.test_negative_edit_volume_name_too_long_name(volume, volume_steps)[source]¶ Scenario: Verify inability to change volume name to name >255 chars.
Setup:
- Create volume
Steps:
- Try to change volume name to name longer than 255 characters
Teardown:
- Delete volume
Volume tests¶
-
stepler.cinder.tests.test_extend_volume.test_negative_extend_volume(volume_steps, size)[source]¶ Scenario: Verify negative cases of volume extend.
Steps:
- Create cinder volume
- Try to extend volume to negative/smaller size
- Check that volume extending was not performed
Teardown:
- Delete cinder volume
-
stepler.cinder.tests.test_extend_volume.test_negative_extend_volume_more_than_limit(volume_size_quota, volume, volume_steps)[source]¶ Scenario: Verify negative cases of volume extend (size > limit).
Setup:
- Set required max volume size quota
- Create cinder volume
Steps:
- Try to extend volume to size which is more than quota
- Check that volume extending was not performed
Teardown:
- Delete cinder volume
- Set max volume size quota to its initial value
Cinder service tests¶
-
stepler.cinder.tests.test_services.test_restart_all_cinder_services(volume, server, floating_ip, attach_volume_to_server, os_faults_steps, server_steps, volume_steps)[source]¶ Scenario: Cinder services work after restart.
Setup:
- Create volume
- Create server
- Create floating IP
Steps:
- Attach floating IP to server
- Check server is pinged via floating IP
- Attach volume to server
- Mount volume inside server
- Create empty file inside volume
- Restart cinder services
- Check cinder services are available
- Create volume_2
- Attache volume_2 to server
- Mount volume_2 inside server
- Copy empty file from volume to volume_2
Teardown:
- Detach volumes from server
- Delete floating IP
- Delete server
- Delete created volumes
-
stepler.cinder.tests.test_services.test_stop_nova_and_cinder_services(server, floating_ip, attach_volume_to_server, detach_volume_from_server, server_steps, volume_steps, os_faults_steps)[source]¶ Scenario: VM with volume is available if nova and cinder disabled.
Setup:
- Create server
- Create floating IP
Steps:
- Attach floating IP to server
- Check server is pinged with floating IP
- Create volume with size 10 Gb
- Attach volume to server
- Via SSH create file on attached volume
- Stop cinder-volume service
- Stop nova-compute service
- Via SSH copy file on attached volume and check that it’s the same
- Start nova-compute service
- Start cinder-volume service
- Detach volume from server
Teardown:
- Delete volume
- Delete floating IP
- Delete server
Snapshots tests¶
-
stepler.cinder.tests.test_volume_snapshots.test_create_multiple_snapshots(volume, snapshot_steps)[source]¶ Scenario: Test creating multiple snapshots
Setup:
- Increase cinder snapshots count quota
- Create volume
Steps:
- Create 5 snapshots from volume
- Delete created snapshots without waiting for deleting
- Create 5 snapshots from volume without waiting for creating
- Delete 5 created snapshots without waiting for deleting
- Check that all 10 snapshots are deleted
Teardown:
- Delete volume
- Restore cinder snapshots count quota
Volume tests¶
-
stepler.cinder.tests.test_volume_transfer.test_accept_volume_transfer(volume, new_user_with_project, get_volume_steps, volume_steps, get_transfer_steps, transfer_steps)[source]¶ Scenario: Verify accept of volume transfer.
Setup:
- Create cinder volume
- Create new project and new user
Steps:
- Create volume transfer
- Accept volume transfer from another user/project
- Check that volume is available under newly created project
- Check that transfer is not available after accept
- Delete cinder volume
-
stepler.cinder.tests.test_volume_transfer.test_create_volume_transfer(volume, create_volume_transfer)[source]¶ Scenario: Verify creation of volume transfer.
Setup:
- Create cinder volume
Steps:
- Create volume transfer
Teardown:
- Delete volume transfer
- Delete cinder volume
-
stepler.cinder.tests.test_volume_transfer.test_negative_create_volume_transfer_long_name(volume, transfer_steps)[source]¶ Scenario: Verify creation of volume transfer with name length > 255.
Setup:
- Create cinder volume
Steps:
- Try to create volume transfer with name length > 255
- Check that BadRequest exception raised
Teardown:
- Delete cinder volume
Volume tests¶
-
stepler.cinder.tests.test_volumes.test_create_delete_many_volumes(volume_steps, volumes_count)[source]¶ Scenario: Verify that 9 cinder volumes can be created and deleted.
Steps:
- Create 9 cinder volumes
- Delete 9 cinder volumes
Teardown:
- Delete volumes
-
stepler.cinder.tests.test_volumes.test_create_volume_description(volume_steps)[source]¶ Scenario: Verify creation of volume with description.
Steps:
- Create volume without name but with description
Teardown:
- Delete volume
-
stepler.cinder.tests.test_volumes.test_create_volume_description_max(volume_steps)[source]¶ Scenario: Verify creation of volume with max description length.
Steps:
- Create volume with description length == max(255)
Teardown:
- Delete volume
-
stepler.cinder.tests.test_volumes.test_create_volume_from_snapshot(volume_snapshot, volume_steps)[source]¶ Scenario: Verify creation volume from snapshot.
Setup:
- Create volume1
- Create snapshot from volume1
Steps:
- Create volume2 from snapshot
- Delete volume2
Teardown:
- Delete snapshot
- Delete volume1
-
stepler.cinder.tests.test_volumes.test_create_volume_from_volume(volume, volume_steps)[source]¶ Scenario: Verify creation of volume from volume.
Setup:
- Create volume
Steps:
- Create volume2 from volume
Teardown:
- Delete volume2
- Delete volume
-
stepler.cinder.tests.test_volumes.test_create_volume_max_size(volume_size_quota, volume_steps)[source]¶ Scenario: Verify creation of volume with max volume size.
Setup:
- Set required max volume size quota
Steps:
- Create volume with max volume size
- Check that volume is available
Teardown:
- Delete volume
- Set max volume size quota to its initial value
-
stepler.cinder.tests.test_volumes.test_create_volume_more_max_size(volume_size_quota, volume_steps)[source]¶ Scenario: Verify creation of volume with size more than max.
Setup:
- Set required max volume size quota
Steps:
- Try to create volume with bigger size than max volume size
- Check that creation is failed
- Check error message
Teardown:
- Set max volume size quota to its initial value
-
stepler.cinder.tests.test_volumes.test_create_volume_without_name(volume_steps)[source]¶ Scenario: Verify creation of volume without name.
Steps:
- Create volume without name
Teardown:
- Delete volume
-
stepler.cinder.tests.test_volumes.test_create_volume_wrong_size(volume_steps, size)[source]¶ Scenario: Verify creation of volume with zero/negative size.
Steps:
- Create volume with size 0/-1 Gbs
- Check that BadRequest occurred
-
stepler.cinder.tests.test_volumes.test_delete_volume_cascade(volume, volume_steps, snapshot_steps)[source]¶ Scenario: Verify volume deletion with cascade option.
Steps:
- Create volume
- Create volume snapshot
- Delete volume with cascade option
- Check that snapshot is deleted too
-
stepler.cinder.tests.test_volumes.test_migrate_volume(volume, volume_steps, os_faults_steps)[source]¶ Scenario: Migrate volume to another host.
Setup:
- Create volume
Steps:
- Find cinder volume host to migrate
- Migrate cinder volume
Teardown:
- Delete volume
-
stepler.cinder.tests.test_volumes.test_negative_create_volume_name_long(volume_steps)[source]¶ Scenario: Verify creation of volume with name length > 255.
Steps:
- Try to create volume with name length > 255
- Check that BadRequest exception raised
-
stepler.cinder.tests.test_volumes.test_negative_create_volume_non_exist_volume_type(cirros_image, volume_steps)[source]¶ Scenario: Can’t create volume from image with fake volume type.
Setup:
- Create cirros image
Steps:
- Try to create volume from image using non existed volume type
- Check that NotFound exception raised
Teardown:
- Delete cirros image
-
stepler.cinder.tests.test_volumes.test_negative_create_volume_wrong_image_id(volume_steps)[source]¶ Scenario: Verify creation of volume with wrong image id.
Steps:
- Try to create volume with wrong image id
- Check that BadRequest exception raised
-
stepler.cinder.tests.test_volumes.test_negative_delete_volume_cascade(volume, volume_snapshot, volume_steps, snapshot_steps)[source]¶ Scenario: Verify volume deletion without cascade option.
Setup:
- Create volume
- Create volume snapshot
Steps:
- Try to delete volume without cascade option
- Check that BadRequest exception raised
- Check that volume is present
- Check that snapshot is present
Teardown:
- Delete snapshot
- Delete volume