Merge pull request #157 from KamilLepek/management
Added a few management tests (changing configuration)
This commit is contained in:
@@ -549,6 +549,10 @@ lib.ocf_mngt_cache_cleaning_set_policy.argtypes = [c_void_p, c_uint32]
|
||||
lib.ocf_mngt_cache_cleaning_set_policy.restype = c_int
|
||||
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_stats_collect_cache.argtypes = [c_void_p, c_void_p, c_void_p, c_void_p, c_void_p]
|
||||
lib.ocf_stats_collect_cache.restype = c_int
|
||||
lib.ocf_cache_get_info.argtypes = [c_void_p, c_void_p]
|
||||
lib.ocf_cache_get_info.restype = c_int
|
||||
lib.ocf_mngt_cache_cleaning_set_param.argtypes = [
|
||||
c_void_p,
|
||||
c_uint32,
|
||||
|
||||
@@ -112,26 +112,27 @@ class Core:
|
||||
blocks = BlocksStats()
|
||||
errors = ErrorsStats()
|
||||
|
||||
self.cache.get_and_lock(True)
|
||||
|
||||
self.cache.get_and_read_lock()
|
||||
status = self.cache.owner.lib.ocf_stats_collect_core(
|
||||
self.handle, byref(usage), byref(req), byref(blocks), byref(errors)
|
||||
)
|
||||
if status:
|
||||
self.cache.put_and_unlock(True)
|
||||
self.cache.put_and_read_unlock()
|
||||
raise OcfError("Failed collecting core stats", status)
|
||||
|
||||
status = self.cache.owner.lib.ocf_core_get_stats(
|
||||
self.handle, byref(core_stats)
|
||||
)
|
||||
if status:
|
||||
self.cache.put_and_unlock(True)
|
||||
self.cache.put_and_read_unlock()
|
||||
raise OcfError("Failed getting core stats", status)
|
||||
|
||||
self.cache.put_and_unlock(True)
|
||||
self.cache.put_and_read_unlock()
|
||||
return {
|
||||
"size": Size(core_stats.core_size_bytes),
|
||||
"dirty_for": timedelta(seconds=core_stats.dirty_for),
|
||||
"seq_cutoff_policy": SeqCutOffPolicy(core_stats.seq_cutoff_policy),
|
||||
"seq_cutoff_threshold": core_stats.seq_cutoff_threshold,
|
||||
"usage": struct_to_dict(usage),
|
||||
"req": struct_to_dict(req),
|
||||
"blocks": struct_to_dict(blocks),
|
||||
@@ -182,3 +183,7 @@ lib.ocf_core_get_volume.argtypes = [c_void_p]
|
||||
lib.ocf_core_get_volume.restype = c_void_p
|
||||
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_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_stats.argtypes = [c_void_p, c_void_p]
|
||||
lib.ocf_core_get_stats.restype = c_int
|
||||
|
||||
Reference in New Issue
Block a user