ocs_ci.workloads package

Submodules

ocs_ci.workloads.rgw_workload module

RGW Workload Module for Krkn Chaos Testing

This module provides RGW (RADOS Gateway) workload management for stress and chaos testing in OpenShift Data Foundation. It uses the existing mcg_stress_helper utilities to perform intensive S3 operations on RGW buckets.

class ocs_ci.workloads.rgw_workload.RGWWorkload(rgw_bucket, awscli_pod, namespace=None, workload_config=None, delete_bucket_on_cleanup=True)

Bases: object

RGW Workload class for Krkn chaos testing.

This class manages S3 workload operations on RGW buckets, providing: - Continuous upload/download/delete operations - Metadata-intensive operations - Workload validation and health checks - Integration with Krkn chaos testing framework

Parameters:
  • rgw_bucket (ObjectBucket) – RGW bucket object

  • awscli_pod (Pod) – Pod with AWS CLI for operations

  • namespace (str) – Kubernetes namespace

  • workload_config (dict) – Configuration for workload operations

cleanup_workload()

Cleanup all workload resources.

This method: 1. Stops workload if running 2. Cleans up test directories 3. Optionally deletes the bucket

get_workload_status()

Get detailed workload status.

Returns:

Workload status information

Return type:

dict

is_workload_running()

Check if workload is currently running.

Returns:

True if workload is running, False otherwise

Return type:

bool

pause_workload()

Pause the RGW workload.

Signals the workload to pause operations.

resume_workload()

Resume the RGW workload.

Resumes paused workload operations.

start_workload()

Start the RGW workload in a background thread.

This method: 1. Validates workload is not already running 2. Creates test objects in awscli pod if needed 3. Starts background workload thread 4. Performs continuous S3 operations

Raises:

UnexpectedBehaviour – If workload fails to start

stop_workload()

Stop the RGW workload.

This method: 1. Signals the workload thread to stop 2. Waits for thread to complete 3. Updates workload state

ocs_ci.workloads.vdbench module

class ocs_ci.workloads.vdbench.VdbenchWorkload(pvc, vdbench_config_file, namespace=None, image=None)

Bases: object

Vdbench workload implementation supporting both Block and Filesystem PVCs.

This class provides comprehensive Vdbench workload automation with support for: - User-provided PVC with configurable access modes - Vdbench configuration from YAML files using Jinja2 templates - Dynamic scaling operations - Pause/resume functionality - Error handling and logging

Parameters:
  • pvc (OCS) – PVC object to attach the workload to

  • vdbench_config_file (str) – Path to YAML configuration file for Vdbench

  • namespace (str, optional) – Kubernetes namespace (defaults to PVC namespace)

  • image (str, optional) – Container image for Vdbench workload

cleanup_workload()

Clean up all resources associated with the Vdbench workload.

This includes deployments, ConfigMaps, and temporary files.

Returns:

True if cleanup was successful, False otherwise

Return type:

bool

get_all_deployment_pod_logs()

Get logs from all pods belonging to the Vdbench workload deployment.

Returns:

Combined log output from all related pods

Return type:

str

get_workload_status()

Get current status of the Vdbench workload.

Returns:

Workload status information

Return type:

dict

pause_workload()

Pause the Vdbench workload by scaling to 0 replicas.

Raises:

UnexpectedBehaviour – If pause operation fails

resume_workload()

Resume the Vdbench workload by scaling back to previous replica count.

Raises:

UnexpectedBehaviour – If resume operation fails

scale_down_pods(desired_count)

Scale down the Vdbench workload to the desired number of replicas.

Parameters:

desired_count (int) – Target number of replicas

Raises:

UnexpectedBehaviour – If scaling operation fails

scale_up_pods(desired_count)

Scale up the Vdbench workload to the desired number of replicas.

Parameters:

desired_count (int) – Target number of replicas

Raises:

UnexpectedBehaviour – If scaling operation fails

start_workload()

Start the Vdbench workload by creating ConfigMap and Deployment.

Raises:

Exception – If workload fails to start or pods don’t become ready

stop_workload()

Stop the Vdbench workload by deleting the deployment.

Raises:

UnexpectedBehaviour – If stop operation fails

validate_data_integrity()

Validate data integrity by parsing Vdbench logs for validation errors.

Checks for the data validation summary line: “Total amount of key blocks read and validated: X; key blocks marked in error: Y”

Raises:

AssertionError – If any key blocks are marked in error (data corruption detected)

Module contents