pyocf: Seq-cutoff promotion count security tests

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk
2021-04-13 16:14:14 +02:00
parent 7dcf90ef6a
commit 0bfa9ed870
3 changed files with 109 additions and 8 deletions

View File

@@ -85,6 +85,7 @@ class ConfValidValues:
cleaning_acp_flush_max_buffers_range = range(1, 10000)
seq_cutoff_threshold_rage = range(1, 4194181)
seq_cutoff_promotion_range = range(1, 65535)
ioclass_id_range = range(0, 32)
ioclass_priority_range = range(-1, 255)
@@ -319,6 +320,18 @@ class Cache:
if status:
raise OcfError("Error setting cache seq cut off policy threshold", status)
def set_seq_cut_off_promotion(self, count: int):
self.write_lock()
status = self.owner.lib.ocf_mngt_core_set_seq_cutoff_promotion_count_all(
self.cache_handle, count
)
self.write_unlock()
if status:
raise OcfError("Error setting cache seq cut off policy promotion count", status)
def get_partition_info(self, part_id: int):
ioclass_info = IoClassInfo()
self.read_lock()
@@ -707,6 +720,8 @@ lib.ocf_mngt_core_set_seq_cutoff_policy_all.argtypes = [c_void_p, c_uint32]
lib.ocf_mngt_core_set_seq_cutoff_policy_all.restype = c_int
lib.ocf_mngt_core_set_seq_cutoff_threshold_all.argtypes = [c_void_p, c_uint32]
lib.ocf_mngt_core_set_seq_cutoff_threshold_all.restype = c_int
lib.ocf_mngt_core_set_seq_cutoff_promotion_count_all.argtypes = [c_void_p, c_uint32]
lib.ocf_mngt_core_set_seq_cutoff_promotion_count_all.restype = c_int
lib.ocf_stats_collect_cache.argtypes = [
c_void_p,
c_void_p,

View File

@@ -160,11 +160,9 @@ class Core:
status = self.cache.owner.lib.ocf_mngt_core_set_seq_cutoff_policy(
self.handle, policy
)
if status:
self.cache.write_unlock()
raise OcfError("Error setting core seq cut off policy", status)
self.cache.write_unlock()
if status:
raise OcfError("Error setting core seq cut off policy", status)
def set_seq_cut_off_threshold(self, threshold):
self.cache.write_lock()
@@ -172,11 +170,19 @@ class Core:
status = self.cache.owner.lib.ocf_mngt_core_set_seq_cutoff_threshold(
self.handle, threshold
)
self.cache.write_unlock()
if status:
self.cache.write_unlock()
raise OcfError("Error setting core seq cut off policy threshold", status)
def set_seq_cut_off_promotion(self, count):
self.cache.write_lock()
status = self.cache.owner.lib.ocf_mngt_core_set_seq_cutoff_promotion_count(
self.handle, count
)
self.cache.write_unlock()
if status:
raise OcfError("Error setting core seq cut off policy promotion count", status)
def reset_stats(self):
self.cache.owner.lib.ocf_core_stats_initialize(self.handle)
@@ -229,6 +235,8 @@ lib.ocf_mngt_core_set_seq_cutoff_policy.argtypes = [c_void_p, c_uint32]
lib.ocf_mngt_core_set_seq_cutoff_policy.restype = c_int
lib.ocf_mngt_core_set_seq_cutoff_threshold.argtypes = [c_void_p, c_uint32]
lib.ocf_mngt_core_set_seq_cutoff_threshold.restype = c_int
lib.ocf_mngt_core_set_seq_cutoff_promotion_count.argtypes = [c_void_p, c_uint32]
lib.ocf_mngt_core_set_seq_cutoff_promotion_count.restype = c_int
lib.ocf_stats_collect_core.argtypes = [c_void_p, c_void_p, c_void_p, c_void_p, c_void_p]
lib.ocf_stats_collect_core.restype = c_int
lib.ocf_core_get_info.argtypes = [c_void_p, c_void_p]