Iostat refactor

Signed-off-by: Katarzyna Treder <katarzyna.treder@h-partners.com>
This commit is contained in:
Katarzyna Treder 2024-12-11 17:54:57 +01:00
parent c218f64c81
commit 6dd9c9ca8c

View File

@ -4,7 +4,6 @@
# #
from core.test_run import TestRun from core.test_run import TestRun
from storage_devices.device import Device
from type_def.size import Size, Unit, UnitPerSecond from type_def.size import Size, Unit, UnitPerSecond
from type_def.time import Time from type_def.time import Time
import csv import csv
@ -84,7 +83,7 @@ class IOstatExtended:
@classmethod @classmethod
def get_iostat_list( def get_iostat_list(
cls, cls,
devices_list: [Device], devices_list: [str],
since_boot: bool = True, since_boot: bool = True,
interval: int = 1, interval: int = 1,
): ):
@ -138,7 +137,7 @@ class IOstatBasic:
@classmethod @classmethod
def get_iostat_list( def get_iostat_list(
cls, cls,
devices_list: [Device], devices_list: [str],
since_boot: bool = True, since_boot: bool = True,
interval: int = 1, interval: int = 1,
): ):
@ -150,8 +149,8 @@ class IOstatBasic:
def _get_iostat_list( def _get_iostat_list(
class_type: type, class_type: type(IOstatExtended) | type(IOstatBasic),
devices_list: [Device], devices_list: [str],
since_boot: bool, since_boot: bool,
interval: int, interval: int,
): ):
@ -163,7 +162,7 @@ def _get_iostat_list(
if not since_boot: if not since_boot:
iostat_cmd += f"-y {interval} 1 " iostat_cmd += f"-y {interval} 1 "
iostat_cmd += " ".join([name.get_device_id() for name in devices_list]) iostat_cmd += " ".join(devices_list)
sed_cmd = "sed -n '/^$/d;s/\s\+/,/g;/^Device/,$p'" sed_cmd = "sed -n '/^$/d;s/\s\+/,/g;/^Device/,$p'"