Skip to content

Commit

Permalink
VM run_strategy support (#925)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebattat authored Nov 11, 2024
1 parent 3de6316 commit 57a0fce
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ metadata:
{%- endif %}
namespace: {{ namespace }}
spec:
{% if run_strategy -%}
runStrategy: Always
{%- else -%}
running: false
{%- endif %}
template:
metadata:
labels:
Expand Down
2 changes: 2 additions & 0 deletions benchmark_runner/main/environment_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ def __init__(self):
self._environment_variables_dict['windows_url'] = EnvironmentVariables.get_env('WINDOWS_URL', '')
# Delete all resources before and after the run, default True
self._environment_variables_dict['delete_all'] = EnvironmentVariables.get_boolean_from_environment('DELETE_ALL', True)
# Run RunStrategy: Always can be set to True or False (default: False). Set it to True for VMs that need to start in a running state
self._environment_variables_dict['run_strategy'] = EnvironmentVariables.get_boolean_from_environment('RUN_STRATEGY', False)
# Verification only, without running or deleting any resources, default False
self._environment_variables_dict['verification_only'] = EnvironmentVariables.get_boolean_from_environment('VERIFICATION_ONLY', False)
# Verification while upgrade, e.g. 4.15.23
Expand Down
8 changes: 6 additions & 2 deletions benchmark_runner/workloads/bootstorm_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ def _create_vm_scale(self, vm_num: str):
"""
try:
self._oc.create_async(yaml=os.path.join(f'{self._run_artifacts_path}', f'{self._name}_{vm_num}.yaml'))
self._oc.wait_for_vm_status(vm_name=f'{self._workload_name}-{self._trunc_uuid}-{vm_num}', status=VMStatus.Stopped)
# run_strategy run immediately the vm
if not self._run_strategy:
self._oc.wait_for_vm_status(vm_name=f'{self._workload_name}-{self._trunc_uuid}-{vm_num}', status=VMStatus.Stopped)
except Exception as err:
# save run artifacts logs
self.save_error_logs()
Expand Down Expand Up @@ -260,7 +262,9 @@ def _run_vm_scale(self, vm_num: str):
try:
vm_name = f'{self._workload_name}-{self._trunc_uuid}-{vm_num}'
self._set_bootstorm_vm_start_time(vm_name=f'{self._workload_name}-{self._trunc_uuid}-{vm_num}')
self._virtctl.start_vm_async(vm_name=f'{self._workload_name}-{self._trunc_uuid}-{vm_num}')
# run_strategy run immediately the vm
if not self._run_strategy:
self._virtctl.start_vm_async(vm_name=f'{self._workload_name}-{self._trunc_uuid}-{vm_num}')
self._virtctl.wait_for_vm_status(vm_name=vm_name, status=VMStatus.Running)
vm_node = self._wait_ssh_vm(vm_name)
self._data_dict = self._get_bootstorm_vm_elapsed_time(vm_name=vm_name, vm_node=vm_node)
Expand Down
1 change: 1 addition & 0 deletions benchmark_runner/workloads/workloads_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def __init__(self):
google_drive_token=self._google_drive_token,
google_drive_shared_drive_id=self._google_drive_shared_drive_id)
self._upgrade_ocp_version = self._environment_variables_dict.get('upgrade_ocp_version', '')
self._run_strategy = self._environment_variables_dict.get('run_strategy', '')

def _get_workload_file_name(self, workload):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pipeline {
SAVE_ARTIFACTS_LOCAL = 'False'
ENABLE_PROMETHEUS_SNAPSHOT = 'True'
DELETE_ALL = 'False' // Not delete the running Windows11 VMs
RUN_STRATEGY = 'True' // runStrategy: Always for NHC/ SNR operators
RUN_TYPE = 'perf_ci'
PROVISION_PORT = 22
NUM_ODF_DISK = 6
Expand Down Expand Up @@ -212,6 +213,7 @@ END
-e THREADS_LIMIT='${THREADS_LIMIT}' \
-e WINDOWS_URL='${WINDOWS_URL}' \
-e DELETE_ALL=${DELETE_ALL} \
-e RUN_STRATEGY=${RUN_STRATEGY} \
-e LSO_NODE='${LSO_NODE}' \
-e TIMEOUT='${TIMEOUT}' \
-e log_level='INFO' \
Expand Down

0 comments on commit 57a0fce

Please sign in to comment.