Skip to content

Commit 57a0fce

Browse files
authored
VM run_strategy support (#925)
1 parent 3de6316 commit 57a0fce

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

benchmark_runner/common/template_operations/templates/windows/internal_data/windows_vm_template.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ metadata:
1212
{%- endif %}
1313
namespace: {{ namespace }}
1414
spec:
15+
{% if run_strategy -%}
16+
runStrategy: Always
17+
{%- else -%}
1518
running: false
19+
{%- endif %}
1620
template:
1721
metadata:
1822
labels:

benchmark_runner/main/environment_variables.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ def __init__(self):
8686
self._environment_variables_dict['windows_url'] = EnvironmentVariables.get_env('WINDOWS_URL', '')
8787
# Delete all resources before and after the run, default True
8888
self._environment_variables_dict['delete_all'] = EnvironmentVariables.get_boolean_from_environment('DELETE_ALL', True)
89+
# 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
90+
self._environment_variables_dict['run_strategy'] = EnvironmentVariables.get_boolean_from_environment('RUN_STRATEGY', False)
8991
# Verification only, without running or deleting any resources, default False
9092
self._environment_variables_dict['verification_only'] = EnvironmentVariables.get_boolean_from_environment('VERIFICATION_ONLY', False)
9193
# Verification while upgrade, e.g. 4.15.23

benchmark_runner/workloads/bootstorm_vm.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ def _create_vm_scale(self, vm_num: str):
101101
"""
102102
try:
103103
self._oc.create_async(yaml=os.path.join(f'{self._run_artifacts_path}', f'{self._name}_{vm_num}.yaml'))
104-
self._oc.wait_for_vm_status(vm_name=f'{self._workload_name}-{self._trunc_uuid}-{vm_num}', status=VMStatus.Stopped)
104+
# run_strategy run immediately the vm
105+
if not self._run_strategy:
106+
self._oc.wait_for_vm_status(vm_name=f'{self._workload_name}-{self._trunc_uuid}-{vm_num}', status=VMStatus.Stopped)
105107
except Exception as err:
106108
# save run artifacts logs
107109
self.save_error_logs()
@@ -260,7 +262,9 @@ def _run_vm_scale(self, vm_num: str):
260262
try:
261263
vm_name = f'{self._workload_name}-{self._trunc_uuid}-{vm_num}'
262264
self._set_bootstorm_vm_start_time(vm_name=f'{self._workload_name}-{self._trunc_uuid}-{vm_num}')
263-
self._virtctl.start_vm_async(vm_name=f'{self._workload_name}-{self._trunc_uuid}-{vm_num}')
265+
# run_strategy run immediately the vm
266+
if not self._run_strategy:
267+
self._virtctl.start_vm_async(vm_name=f'{self._workload_name}-{self._trunc_uuid}-{vm_num}')
264268
self._virtctl.wait_for_vm_status(vm_name=vm_name, status=VMStatus.Running)
265269
vm_node = self._wait_ssh_vm(vm_name)
266270
self._data_dict = self._get_bootstorm_vm_elapsed_time(vm_name=vm_name, vm_node=vm_node)

benchmark_runner/workloads/workloads_operations.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ def __init__(self):
119119
google_drive_token=self._google_drive_token,
120120
google_drive_shared_drive_id=self._google_drive_shared_drive_id)
121121
self._upgrade_ocp_version = self._environment_variables_dict.get('upgrade_ocp_version', '')
122+
self._run_strategy = self._environment_variables_dict.get('run_strategy', '')
122123

123124
def _get_workload_file_name(self, workload):
124125
"""

jenkins/PerfCI_Chaos/03_PerfCI_Choas_Windows_VMs_Deployment/Jenkinsfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pipeline {
4444
SAVE_ARTIFACTS_LOCAL = 'False'
4545
ENABLE_PROMETHEUS_SNAPSHOT = 'True'
4646
DELETE_ALL = 'False' // Not delete the running Windows11 VMs
47+
RUN_STRATEGY = 'True' // runStrategy: Always for NHC/ SNR operators
4748
RUN_TYPE = 'perf_ci'
4849
PROVISION_PORT = 22
4950
NUM_ODF_DISK = 6
@@ -212,6 +213,7 @@ END
212213
-e THREADS_LIMIT='${THREADS_LIMIT}' \
213214
-e WINDOWS_URL='${WINDOWS_URL}' \
214215
-e DELETE_ALL=${DELETE_ALL} \
216+
-e RUN_STRATEGY=${RUN_STRATEGY} \
215217
-e LSO_NODE='${LSO_NODE}' \
216218
-e TIMEOUT='${TIMEOUT}' \
217219
-e log_level='INFO' \

0 commit comments

Comments
 (0)