-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathwindows_vm.py
More file actions
55 lines (50 loc) · 2.37 KB
/
windows_vm.py
File metadata and controls
55 lines (50 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import os
import sys
import time
from multiprocessing import Process
from benchmark_runner.common.logger.logger_time_stamp import logger_time_stamp, logger
from benchmark_runner.common.elasticsearch.elasticsearch_exceptions import ElasticSearchDataNotUploaded
from benchmark_runner.workloads.bootstorm_vm import BootstormVM
class WindowsVM(BootstormVM):
"""
This class runs Windows vm
"""
def __init__(self):
super().__init__()
if not self._windows_url:
raise ValueError('Missing Windows DV URL')
@logger_time_stamp
def run(self):
"""
This method runs the workload
:return:
"""
try:
if self._run_type in ('test_ci', 'chaos_ci', 'func_ci'):
self._es_index = f"windows-{self._run_type.replace('_', '-')}-results"
else:
self._es_index = 'windows-results'
self._initialize_run()
if not self._verification_only:
# create windows dv
self._oc.create_async(yaml=os.path.join(f'{self._run_artifacts_path}', 'windows_dv.yaml'))
self._oc.wait_for_dv_status(status='Succeeded')
self.run_vm_workload()
if self._delete_all:
# delete windows dv
self._oc.delete_async(yaml=os.path.join(f'{self._run_artifacts_path}', 'windows_dv.yaml'))
# delete namespace
self._oc.delete_async(yaml=os.path.join(f'{self._run_artifacts_path}', 'namespace.yaml'))
except ElasticSearchDataNotUploaded as err:
self._oc.delete_vm_sync(
yaml=os.path.join(f'{self._run_artifacts_path}', f'{self._name}.yaml'),
vm_name=self._vm_name)
raise err
except Exception as err:
# save run artifacts logs
if self._es_host:
self._data_dict['run_artifacts_url'] = os.path.join(self._run_artifacts_url, f'{self._get_run_artifacts_hierarchy(workload_name=self._workload_name, is_file=True)}-{self._time_stamp_format}.tar.gz')
self._upload_to_elasticsearch(index=self._es_index, kind=self._kind, status='failed', result=self._data_dict)
# verify that data upload to elastic search according to unique uuid
self._verify_elasticsearch_data_uploaded(index=self._es_index, uuid=self._uuid)
raise err