Minor fixes in CAS API
Add casting to int in few cleaning policy params. Fix few typos. Add equation overload in cleaning policy params' classes. Signed-off-by: Ostrokrzew <ostrokrzew@protonmail.com>
This commit is contained in:
parent
662129aa40
commit
b6028a8787
@ -95,6 +95,12 @@ class FlushParametersAlru:
|
||||
self.staleness_time = staleness_time
|
||||
self.wake_up_time = wake_up_time
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.activity_threshold == other.activity_threshold and \
|
||||
self.flush_max_buffers == other.flush_max_buffers and \
|
||||
self.staleness_time == other.staleness_time and \
|
||||
self.wake_up_time == other.wake_up_time
|
||||
|
||||
@staticmethod
|
||||
def default_alru_params():
|
||||
alru_params = FlushParametersAlru()
|
||||
@ -112,6 +118,10 @@ class FlushParametersAcp:
|
||||
self.flush_max_buffers = flush_max_buffers
|
||||
self.wake_up_time = wake_up_time
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.flush_max_buffers == other.flush_max_buffers and \
|
||||
self.wake_up_time == other.wake_up_time
|
||||
|
||||
@staticmethod
|
||||
def default_acp_params():
|
||||
acp_params = FlushParametersAcp()
|
||||
|
@ -214,7 +214,7 @@ def get_cas_devices_dict():
|
||||
|
||||
def get_flush_parameters_alru(cache_id: int):
|
||||
casadm_output = casadm.get_param_cleaning_alru(cache_id,
|
||||
casadm.OutputFormat.csv).stdout.spltlines()
|
||||
casadm.OutputFormat.csv).stdout.splitlines()
|
||||
flush_parameters = FlushParametersAlru()
|
||||
for line in casadm_output:
|
||||
if 'max buffers' in line:
|
||||
@ -222,7 +222,7 @@ def get_flush_parameters_alru(cache_id: int):
|
||||
if 'Activity threshold' in line:
|
||||
flush_parameters.activity_threshold = Time(milliseconds=int(line.split(',')[1]))
|
||||
if 'Stale buffer time' in line:
|
||||
flush_parameters.staneless_time = Time(seconds=int(line.split(',')[1]))
|
||||
flush_parameters.staleness_time = Time(seconds=int(line.split(',')[1]))
|
||||
if 'Wake up time' in line:
|
||||
flush_parameters.wake_up_time = Time(seconds=int(line.split(',')[1]))
|
||||
return flush_parameters
|
||||
|
Loading…
Reference in New Issue
Block a user