Skip to content

Commit

Permalink
Incorporated comments
Browse files Browse the repository at this point in the history
Signed-off-by: Avdhoot <[email protected]>
  • Loading branch information
avd-sagare committed Jan 17, 2025
1 parent d3274d1 commit 1a1cc3d
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import tempfile
import threading
import json
import concurrent.futures
from concurrent.futures.thread import ThreadPoolExecutor
from datetime import datetime
from math import floor
Expand Down Expand Up @@ -7316,13 +7317,14 @@ def factory(namespace=None):

# Use ThreadPoolExecutor to create VMs parallel
with ThreadPoolExecutor() as executor:
futures = []
futures = {}
for vm_config in vm_configs["cnv_vm_configs"]:
# Determine the storage class based on the compression type
if vm_config["sc_compression"] == "default":
storageclass = sc_obj_def_compr.name
elif vm_config["sc_compression"] == "aggressive":
storageclass = sc_obj_aggressive.name
storageclass = (
sc_obj_def_compr.name
if vm_config["sc_compression"] == "default"
else sc_obj_aggressive.name
)
future = executor.submit(
cnv_workload,
volume_interface=vm_config["volume_interface"],
Expand All @@ -7333,16 +7335,17 @@ def factory(namespace=None):
namespace=namespace,
)

futures.append((future, vm_config["sc_compression"]))
for future, sc_compression in futures:
futures[future] = vm_config["sc_compression"]
for future in concurrent.futures.as_completed(futures):
sc_compression = futures[future]
try:
vm_obj = future.result()[0]
if sc_compression == "aggressive":
vm_list_agg_compr.append(vm_obj)
else:
vm_list_default_compr.append(vm_obj)
except Exception as e:
print(f"Error occurred while creating VM: {e}")
log.info(f"Error occurred while creating VM: {e}")

return (
vm_list_default_compr,
Expand Down

0 comments on commit 1a1cc3d

Please sign in to comment.