-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(ArtifactsTest): IOTune parameters validation
This commits adds a new subtest inside Artifacts test, that does the check of machine image io_properties.yaml by comparing them to the actual machine values and showing the deviation Fixes scylladb/qa-tasks#1787
- Loading branch information
Showing
3 changed files
with
155 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from copy import deepcopy | ||
import logging | ||
from typing import TypedDict | ||
import yaml | ||
from sdcm.cluster import BaseNode | ||
from sdcm.remote.remote_file import remote_file | ||
|
||
LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
class IOTuneDiskParams(TypedDict): | ||
mountpoint: str | ||
read_iops: int | ||
read_bandwidth: int | ||
write_iops: int | ||
write_bandwidth: int | ||
|
||
|
||
class IOProperties(TypedDict): | ||
disks: list[IOTuneDiskParams] | ||
|
||
|
||
class IOTuneValidator: | ||
def __init__(self, node: BaseNode): | ||
self.node = node | ||
self.node_io_properties: IOProperties = {} | ||
self.preset_io_properties: IOProperties = {} | ||
|
||
def validate(self): | ||
self._run_io_tune() | ||
self._format_results_to_console() | ||
|
||
def _read_io_properties(self, io_props_path="/etc/scylla.d/io_properties.yaml") -> IOProperties: | ||
with remote_file(self.node.remoter, io_props_path) as f: | ||
return yaml.safe_load(f) | ||
|
||
def _run_io_tune(self, temp_props_path="/tmp/io_properties.yaml") -> IOProperties: | ||
self.node.remoter.sudo(f"iotune --evaluation-directory /var/lib/scylla --properties-file {temp_props_path}") | ||
self.node_io_properties = self._read_io_properties(temp_props_path) | ||
self.preset_io_properties = self._read_io_properties() | ||
|
||
return self.node_io_properties | ||
|
||
def _format_results_to_console(self): | ||
preset_properties = deepcopy(self.preset_io_properties) | ||
preset_disk = next(iter(preset_properties.get("disks"))) | ||
|
||
for disk in self.node_io_properties.get("disks"): | ||
disk_copy = {**disk} | ||
mountpoint = disk_copy.pop("mountpoint") | ||
LOGGER.info("Disk performance values validation - testing %s", mountpoint) | ||
for key, val in disk_copy.items(): | ||
preset_val = preset_disk.get(key) | ||
diff = (val / preset_val - 1) * 100 | ||
LOGGER.info("[%s] %s: %s (%.0f)", mountpoint, key, val, diff) |