Use concurrent.futures instead of multiprocessing
On the environment with enabled SSL the SSLv3_ALERT_BAD_RECORD_MAC error
occurs in fio_setup/fio_cleanup modules, in the section where processes
of creating/deleting VMs are paralleled.
This is due the paralleled processes have to communicate with each other
about the state of the shared SSL connection.
Changing to multithreading resolves the issues.
Related-PROD: #PROD-37187
Change-Id: I4f15ef900c79811db0d807ae2c91779595f497d2
diff --git a/fio/fio_setup.py b/fio/fio_setup.py
index b788b1c..ab4502d 100644
--- a/fio/fio_setup.py
+++ b/fio/fio_setup.py
@@ -1,5 +1,5 @@
import base64
-import multiprocessing as mp
+import concurrent.futures as cex
import os
import random
import sys
@@ -224,9 +224,7 @@
user_data=udata)
# Create fio client VMs in parallel in batches of CONCURRENCY size
- with mp.Pool(processes=CONCURRENCY) as pool:
- results = [
- pool.apply_async(create_fio_client, kwds=vm_kwargs)
- for _ in range(CLIENTS_COUNT)]
+ with cex.ThreadPoolExecutor(max_workers=CONCURRENCY) as executor:
+ futures = [executor.submit(create_fio_client, **vm_kwargs) for _ in range(CLIENTS_COUNT)]
# Wait for batch of fio client VMs to be created
- _ = [r.get() for r in results]
+ _ = [future.result() for future in futures]