Merge pull request #173 from katlapinka/cache-config

Add cache config and fix for CAS modules names
This commit is contained in:
Daniel Madej 2019-10-31 16:28:01 +01:00 committed by GitHub
commit be5fbafdde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 6 deletions

View File

@ -140,3 +140,10 @@ class Cache:
alru_params.staleness_time.total_seconds(), alru_params.staleness_time.total_seconds(),
alru_params.flush_max_buffers, alru_params.flush_max_buffers,
alru_params.activity_threshold.total_milliseconds()) alru_params.activity_threshold.total_milliseconds())
def get_cache_config(self):
return CacheConfig(self.get_cache_line_size(),
self.get_cache_mode(),
self.get_cleaning_policy(),
self.get_eviction_policy(),
self.get_metadata_mode())

View File

@ -37,6 +37,7 @@ class EvictionPolicy(Enum):
lru = 0 lru = 0
lmp = 1 lmp = 1
nop = 2 nop = 2
DEFAULT = lru
class MetadataMode(Enum): class MetadataMode(Enum):
@ -110,5 +111,22 @@ class SeqCutOffParameters:
# TODO: Use case for this will be to iterate over configurations (kernel params such as # TODO: Use case for this will be to iterate over configurations (kernel params such as
# TODO: io scheduler, metadata layout) and prepare env before starting cache # TODO: io scheduler, metadata layout) and prepare env before starting cache
class CacheConfig: class CacheConfig:
def __init__(self): def __init__(self,
pass cache_line_size=CacheLineSize.DEFAULT,
cache_mode=CacheMode.DEFAULT,
cleaning_policy=CleaningPolicy.DEFAULT,
eviction_policy=EvictionPolicy.DEFAULT,
metadata_mode=MetadataMode.normal):
self.cache_line_size = cache_line_size
self.cache_mode = cache_mode
self.cleaning_policy = cleaning_policy
self.eviction_policy = eviction_policy
self.metadata_mode = metadata_mode
def __eq__(self, other):
return self.cache_line_size == other.cache_line_size and \
self.cache_mode == other.cache_mode and \
self.cleaning_policy == other.cleaning_policy and \
self.eviction_policy == other.eviction_policy and \
self.metadata_mode == other.metadata_mode

View File

@ -3,14 +3,13 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
from aenum import Enum from aenum import Enum
from config.configuration import cas_kernel_module, disk_kernel_module
from test_utils import os_utils from test_utils import os_utils
from test_utils.os_utils import ModuleRemoveMethod from test_utils.os_utils import ModuleRemoveMethod
class CasModule(Enum): class CasModule(Enum):
cache = cas_kernel_module cache = "cas_cache"
disk = disk_kernel_module disk = "cas_disk"
def reload_all_cas_modules(): def reload_all_cas_modules():

@ -1 +1 @@
Subproject commit de0721eb52fbe548a8e7810913151e2e37c66d1c Subproject commit c00e1f19425e289c281f97b7f6cca1fb88e3f9bc

View File

@ -183,6 +183,8 @@ def base_prepare(item):
elif not installer.check_if_installed(): elif not installer.check_if_installed():
installer.install_opencas() installer.install_opencas()
TestRun.plugins['opencas']['already_updated'] = True TestRun.plugins['opencas']['already_updated'] = True
from api.cas import init_config
init_config.create_default_init_config()
TestRun.LOGGER.add_build_info(f'Commit hash:') TestRun.LOGGER.add_build_info(f'Commit hash:')
TestRun.LOGGER.add_build_info(f"{git.get_current_commit_hash()}") TestRun.LOGGER.add_build_info(f"{git.get_current_commit_hash()}")
TestRun.LOGGER.add_build_info(f'Commit message:') TestRun.LOGGER.add_build_info(f'Commit message:')