* FIO Testcase addition to LISA

* PR Review changes : added 'unknown' in enum and defaulting it in perf_disk
This commit is contained in:
Smit Gardhariya 2022-10-26 19:33:26 +05:30 коммит произвёл GitHub
Родитель 0e4c81f405
Коммит 451d9759de
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 106 добавлений и 8 удалений

Просмотреть файл

@ -130,6 +130,7 @@ T = TypeVar("T", bound=PerfMessage)
DiskSetupType = Enum(
"DiskSetupType",
[
"unknown",
"raw",
"raid0",
],
@ -139,6 +140,7 @@ DiskSetupType = Enum(
DiskType = Enum(
"DiskType",
[
"unknown",
"nvme",
"premiumssd",
],
@ -250,11 +252,9 @@ def create_perf_message(
assert environment, "fail to get environment from testresult"
data_path: str = ""
assert (
node.capability.network_interface
and node.capability.network_interface.data_path
)
if isinstance(node.capability.network_interface.data_path, NetworkDataPath):
if node.capability.network_interface and isinstance(
node.capability.network_interface.data_path, NetworkDataPath
):
data_path = node.capability.network_interface.data_path.value
message = message_type()
dict_to_fields(environment.get_information(), message)

Просмотреть файл

@ -42,9 +42,9 @@ def perf_disk(
filename: str,
core_count: int,
disk_count: int,
disk_setup_type: DiskSetupType,
disk_type: DiskType,
test_result: TestResult,
disk_setup_type: DiskSetupType = DiskSetupType.unknown,
disk_type: DiskType = DiskType.unknown,
test_name: str = "",
num_jobs: Optional[List[int]] = None,
block_size: int = 4,

Просмотреть файл

@ -2,12 +2,14 @@
# Licensed under the MIT license.
import inspect
from pathlib import PurePosixPath
import uuid
from pathlib import Path, PurePosixPath
from typing import Any, Dict, List, cast
from assertpy import assert_that
from lisa import (
Environment,
Logger,
Node,
TestCaseMetadata,
@ -187,6 +189,102 @@ class StoragePerformance(TestSuite):
def perf_storage_over_nfs_synthetic_udp_4k(self, result: TestResult) -> None:
self._perf_nfs(result, protocol="udp")
@TestCaseMetadata(
description="""
This test case uses fio to test data disk performance.
""",
priority=3,
timeout=TIME_OUT,
)
def perf_storage_generic_fio_test(
self,
log: Logger,
node: Node,
environment: Environment,
log_path: Path,
result: TestResult,
variables: Dict[str, Any],
) -> None:
# Sample for fio_testcase_list variable in runbook
# - name: fio_testcase_list
# value:
# -
# start_iodepth: 1
# max_iodepth: 8
# block_size: 4
# size_mb: 512
# time: 240
# overwrite: False
# -
# start_iodepth: 1
# max_iodepth: 8
# block_size: 4
# size_mb: 4096
# time: 240
# overwrite: False
# is_case_visible: True
testcases = variables.get("fio_testcase_list", None)
if not testcases or len(testcases) == 0:
testcases = [
{
"start_iodepth": 1,
"max_iodepth": 4,
"block_size": 4,
"size_mb": 512,
"time": 240,
},
{
"start_iodepth": 1,
"max_iodepth": 4,
"block_size": 4,
"size_mb": 4096,
"time": 240,
},
]
failed_test_cases = []
for testcase in testcases:
id = str(uuid.uuid4())
try:
start_iodepth = testcase.get("start_iodepth", 1)
max_iodepth = testcase.get("max_iodepth", 1)
num_jobs = []
iodepth_iter = start_iodepth
core_count = node.tools[Lscpu].get_core_count()
while iodepth_iter <= max_iodepth:
num_jobs.append(min(iodepth_iter, core_count))
iodepth_iter = iodepth_iter * 2
time = testcase.get("time", 240)
block_size = testcase.get("block_size", 4)
size_mb = testcase.get("size_mb", 512)
overwrite = testcase.get("overwrite", False)
test_name = f"{size_mb}_MB_{block_size}K"
log.debug(f"Executing the FIO testcase : {test_name}")
perf_disk(
node=node,
start_iodepth=start_iodepth,
max_iodepth=max_iodepth,
filename=f"{size_mb}_MB_FIO_{id}",
test_result=result,
test_name=test_name,
num_jobs=num_jobs,
block_size=block_size,
time=time,
size_mb=size_mb,
overwrite=overwrite,
core_count=core_count,
disk_count=1,
)
except Exception:
failed_test_cases.append(testcase)
assert_that(
failed_test_cases, f"Failed Testcases: {failed_test_cases}"
).is_empty()
def _configure_nfs(
self,
server: RemoteNode,