Add method to get flushing progress
This commit is contained in:
parent
b328f574cf
commit
7654e10c96
@ -7,6 +7,7 @@ import csv
|
|||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
|
from test_utils.output import CmdException
|
||||||
from test_utils.size import parse_unit
|
from test_utils.size import parse_unit
|
||||||
from storage_devices.device import Device
|
from storage_devices.device import Device
|
||||||
from api.cas.cache_config import *
|
from api.cas.cache_config import *
|
||||||
@ -212,6 +213,25 @@ def get_cas_devices_dict():
|
|||||||
return devices
|
return devices
|
||||||
|
|
||||||
|
|
||||||
|
def get_flushing_progress(cache_id: int, core_id: int = None):
|
||||||
|
casadm_output = casadm.list_caches(OutputFormat.csv).stdout.splitlines()
|
||||||
|
for line in casadm_output:
|
||||||
|
line_elements = line.split(',')
|
||||||
|
if core_id is not None and line_elements[0] == "core" \
|
||||||
|
and int(line_elements[1]) == core_id \
|
||||||
|
or core_id is None and line_elements[0] == "cache" \
|
||||||
|
and int(line_elements[1]) == cache_id:
|
||||||
|
try:
|
||||||
|
flush_line_elements = line_elements[3].split()
|
||||||
|
flush_percent = flush_line_elements[1][1:]
|
||||||
|
return float(flush_percent)
|
||||||
|
except Exception:
|
||||||
|
break
|
||||||
|
raise CmdException(f"There is no flushing progress in casadm list output. (cache {cache_id}"
|
||||||
|
f"{' core ' + core_id if core_id is not None else ''})",
|
||||||
|
casadm_output)
|
||||||
|
|
||||||
|
|
||||||
def get_flush_parameters_alru(cache_id: int):
|
def get_flush_parameters_alru(cache_id: int):
|
||||||
casadm_output = casadm.get_param_cleaning_alru(cache_id,
|
casadm_output = casadm.get_param_cleaning_alru(cache_id,
|
||||||
casadm.OutputFormat.csv).stdout.splitlines()
|
casadm.OutputFormat.csv).stdout.splitlines()
|
||||||
|
Loading…
Reference in New Issue
Block a user