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:

list

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:

list

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:

list

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:

list

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:

list

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 exist
  • AssertionError – 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:

list

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 Volume to 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 False

Returns:

image

Return type:

object

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

delete_volume_type(volume_type, check=True)[source]

Step to delete volume type.

Parameters:
  • volume_type (obj) – volume type object
  • check (bool|true) – flag whether to check step or not
Raises:

AssertionError – if check failed

get_volume_types(check=True)[source]

Step to retrieve volume types.

Parameters:check (bool) – flag whether to check step or not
Returns:volume types list
Return type:list
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
set_volume_size_quota(project, value, check=True)[source]

Step to set quota for volume size.

Parameters:
  • project (obj) – project object
  • value (int) – volume size quota value
  • check (bool|True) – flag whether to check step or not
Raises:

AssertionError – if check was False

set_volumes_quota(project, value, check=True)[source]

Step to set quota for volumes count.

Parameters:
  • project (obj) – project object
  • value (int) – new volumes count quota value
  • check (bool|True) – flag whether to check step or not
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:

list

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 exist
  • AssertionError – if check failed
get_snapshots(search_opts=None, check=True)[source]

Step to get snapshots.

Parameters:
  • (dict (search_opts) – optional): API filter options to retrieve snapshots
  • check (bool) – flag whether to check step or not
Returns:

snapshots collection

Return type:

list

Raises:

AssertionError – 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:

list

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 timeout
  • AssertionError – 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 exist
  • AssertionError – 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:

list

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:

  1. Create volume

Steps:

  1. Create backup with custom container name
  2. Check container name of backup

Teardown:

  1. Delete backup
  2. 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:

  1. Create volume
  2. Create volume snapshot

Steps:

  1. Create backup

Teardown:

  1. Delete snapshot
  2. Delete volume
  3. 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:

  1. Create cinder volume

Steps:

  1. Try to create volume backup with container name length > 255
  2. Check that BadRequest exception raised

Teardown:

  1. 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:

  1. Create two volume types
  2. Create volume using first volume type
  3. Retype volume to another type

Teardown:

  1. Delete volume
  2. 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::

  1. Create volume type
  2. Create volume without volume type

Steps:

  1. Change volume type to newly created type

Teardown:

  1. Delete volume
  2. Delete volume type

Volume tests

stepler.cinder.tests.test_create_image_from_volume.test_create_image_from_volume(upload_volume_to_image, disk_format)[source]

Scenario: raw/qcow2/vdi/vmdk image is created from volume.

Steps:

  1. Create cinder volume
  2. Create image from volume
  3. Delete image
  4. Delete cinder volume

Volume tests

stepler.cinder.tests.test_create_volume_from_image.test_create_volume_from_image(glance_steps, volume_steps, disk_format)[source]

Scenario: Verify that volume from raw|qcow2 image is created.

Steps:

  1. Create cinder volume from raw|qcow2 image
  2. Delete cinder volume

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:

  1. Create volume

Steps:

  1. Change volume description

Teardown:

  1. 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:

  1. Create volume

Steps:

  1. Change volume name

Teardown:

  1. 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:

  1. Create volume

Steps:

  1. Try to change volume name to name longer than 255 characters

Teardown:

  1. Delete volume
stepler.cinder.tests.test_edit_volume.test_volume_disable_bootable(glance_steps, volume_steps)[source]

Scenario: Verify ability to disable volume bootable status.

Steps:

  1. Create image
  2. Create volume from image
  3. Disable volume bootable status

Teardown:

  1. Delete volume
  2. Delete image
stepler.cinder.tests.test_edit_volume.test_volume_enable_bootable(volume, volume_steps)[source]

Scenario: Verify ability to enable volume bootable status.

Setup:

  1. Create volume

Steps:

  1. Enable volume bootable status

Teardown:

  1. 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:

  1. Create cinder volume
  2. Try to extend volume to negative/smaller size
  3. Check that volume extending was not performed

Teardown:

  1. 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:

  1. Set required max volume size quota
  2. Create cinder volume

Steps:

  1. Try to extend volume to size which is more than quota
  2. Check that volume extending was not performed

Teardown:

  1. Delete cinder volume
  2. Set max volume size quota to its initial value
stepler.cinder.tests.test_extend_volume.test_positive_extend_volume(volume, volume_steps)[source]

Scenario: Verify nominal volume extend.

Setup:

  1. Create cinder volume

Steps:

  1. Extend volume to correct size
  2. Check that volume extending was performed

Teardown:

  1. Delete cinder volume

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:

  1. Create volume
  2. Create server
  3. Create floating IP

Steps:

  1. Attach floating IP to server
  2. Check server is pinged via floating IP
  3. Attach volume to server
  4. Mount volume inside server
  5. Create empty file inside volume
  6. Restart cinder services
  7. Check cinder services are available
  8. Create volume_2
  9. Attache volume_2 to server
  10. Mount volume_2 inside server
  11. Copy empty file from volume to volume_2

Teardown:

  1. Detach volumes from server
  2. Delete floating IP
  3. Delete server
  4. 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:

  1. Create server
  2. Create floating IP

Steps:

  1. Attach floating IP to server
  2. Check server is pinged with floating IP
  3. Create volume with size 10 Gb
  4. Attach volume to server
  5. Via SSH create file on attached volume
  6. Stop cinder-volume service
  7. Stop nova-compute service
  8. Via SSH copy file on attached volume and check that it’s the same
  9. Start nova-compute service
  10. Start cinder-volume service
  11. Detach volume from server

Teardown:

  1. Delete volume
  2. Delete floating IP
  3. Delete server

Snapshots tests

stepler.cinder.tests.test_volume_snapshots.test_create_multiple_snapshots(volume, snapshot_steps)[source]

Scenario: Test creating multiple snapshots

Setup:

  1. Increase cinder snapshots count quota
  2. Create volume

Steps:

  1. Create 5 snapshots from volume
  2. Delete created snapshots without waiting for deleting
  3. Create 5 snapshots from volume without waiting for creating
  4. Delete 5 created snapshots without waiting for deleting
  5. Check that all 10 snapshots are deleted

Teardown:

  1. Delete volume
  2. Restore cinder snapshots count quota
stepler.cinder.tests.test_volume_snapshots.test_snapshot_list(snapshot_steps)[source]

Scenario: Request list of snapshots.

Steps:

  1. Get list of snapshots

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:

  1. Create cinder volume
  2. Create new project and new user

Steps:

  1. Create volume transfer
  2. Accept volume transfer from another user/project
  3. Check that volume is available under newly created project
  4. Check that transfer is not available after accept
  5. 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:

  1. Create cinder volume

Steps:

  1. Create volume transfer

Teardown:

  1. Delete volume transfer
  2. 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:

  1. Create cinder volume

Steps:

  1. Try to create volume transfer with name length > 255
  2. Check that BadRequest exception raised

Teardown:

  1. 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:

  1. Create 9 cinder volumes
  2. Delete 9 cinder volumes

Teardown:

  1. Delete volumes
stepler.cinder.tests.test_volumes.test_create_volume_description(volume_steps)[source]

Scenario: Verify creation of volume with description.

Steps:

  1. Create volume without name but with description

Teardown:

  1. 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:

  1. Create volume with description length == max(255)

Teardown:

  1. Delete volume
stepler.cinder.tests.test_volumes.test_create_volume_from_snapshot(volume_snapshot, volume_steps)[source]

Scenario: Verify creation volume from snapshot.

Setup:

  1. Create volume1
  2. Create snapshot from volume1

Steps:

  1. Create volume2 from snapshot
  2. Delete volume2

Teardown:

  1. Delete snapshot
  2. Delete volume1
stepler.cinder.tests.test_volumes.test_create_volume_from_volume(volume, volume_steps)[source]

Scenario: Verify creation of volume from volume.

Setup:

  1. Create volume

Steps:

  1. Create volume2 from volume

Teardown:

  1. Delete volume2
  2. 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:

  1. Set required max volume size quota

Steps:

  1. Create volume with max volume size
  2. Check that volume is available

Teardown:

  1. Delete volume
  2. 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:

  1. Set required max volume size quota

Steps:

  1. Try to create volume with bigger size than max volume size
  2. Check that creation is failed
  3. Check error message

Teardown:

  1. 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:

  1. Create volume without name

Teardown:

  1. 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:

  1. Create volume with size 0/-1 Gbs
  2. 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:

  1. Create volume
  2. Create volume snapshot
  3. Delete volume with cascade option
  4. 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:

  1. Create volume

Steps:

  1. Find cinder volume host to migrate
  2. Migrate cinder volume

Teardown:

  1. 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:

  1. Try to create volume with name length > 255
  2. 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:

  1. Create cirros image

Steps:

  1. Try to create volume from image using non existed volume type
  2. Check that NotFound exception raised

Teardown:

  1. 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:

  1. Try to create volume with wrong image id
  2. 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:

  1. Create volume
  2. Create volume snapshot

Steps:

  1. Try to delete volume without cascade option
  2. Check that BadRequest exception raised
  3. Check that volume is present
  4. Check that snapshot is present

Teardown:

  1. Delete snapshot
  2. Delete volume
stepler.cinder.tests.test_volumes.test_negative_delete_volume_wrong_id(volume_steps)[source]

Scenario: Verify volume deletion with wrong volume id.

Steps:

  1. Try to delete volume with wrong volume id
  2. Check that NotFound exception raised
stepler.cinder.tests.test_volumes.test_volumes_list(volume_steps)[source]

Scenario: Request list of volumes.

Steps:

  1. Get list of volumes