pyocf: Rename Volume to RamVolume

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski
2021-10-19 14:46:06 +02:00
parent 062f63e4ff
commit 16f9d58f28
22 changed files with 198 additions and 196 deletions

View File

@@ -1,5 +1,5 @@
#
# Copyright(c) 2019-2021 Intel Corporation
# Copyright(c) 2019-2022 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -18,7 +18,7 @@ from pyocf.types.cache import (
ConfValidValues,
)
from pyocf.types.core import Core
from pyocf.types.volume import Volume
from pyocf.types.volume import RamVolume
from pyocf.utils import Size as S
from tests.utils.random import (
Range,
@@ -41,7 +41,7 @@ def test_neg_change_cache_mode(pyocf_ctx, cm, cls):
:param cls: cache line size we start with
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device, cache_mode=cm, cache_line_size=cls)
# Change cache mode to invalid one and check if failed
@@ -65,7 +65,7 @@ def test_neg_set_cleaning_policy(pyocf_ctx, cm, cls):
:return:
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device, cache_mode=cm, cache_line_size=cls)
# Set cleaning policy to invalid one and check if failed
@@ -90,7 +90,7 @@ def test_neg_attach_cls(pyocf_ctx, cm, cls):
:return:
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache(owner=cache_device.owner, cache_mode=cm, cache_line_size=cls)
cache.start_cache()
@@ -115,13 +115,13 @@ def test_neg_cache_set_seq_cut_off_policy(pyocf_ctx, cm, cls):
:return:
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device, cache_mode=cm, cache_line_size=cls)
# Create 2 core devices
core_device1 = Volume(S.from_MiB(10))
core_device1 = RamVolume(S.from_MiB(10))
core1 = Core.using_device(core_device1, name="core1")
core_device2 = Volume(S.from_MiB(10))
core_device2 = RamVolume(S.from_MiB(10))
core2 = Core.using_device(core_device2, name="core2")
# Add cores
@@ -149,13 +149,13 @@ def test_neg_cache_set_seq_cut_off_promotion(pyocf_ctx, cm, cls):
:return:
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device, cache_mode=cm, cache_line_size=cls)
# Create 2 core devices
core_device1 = Volume(S.from_MiB(10))
core_device1 = RamVolume(S.from_MiB(10))
core1 = Core.using_device(core_device1, name="core1")
core_device2 = Volume(S.from_MiB(10))
core_device2 = RamVolume(S.from_MiB(10))
core2 = Core.using_device(core_device2, name="core2")
# Add cores
@@ -185,11 +185,11 @@ def test_neg_core_set_seq_cut_off_promotion(pyocf_ctx, cm, cls):
:return:
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device, cache_mode=cm, cache_line_size=cls)
# Create core device
core_device1 = Volume(S.from_MiB(10))
core_device1 = RamVolume(S.from_MiB(10))
core1 = Core.using_device(core_device1, name="core1")
# Add core
@@ -218,13 +218,13 @@ def test_neg_cache_set_seq_cut_off_threshold(pyocf_ctx, cm, cls):
:return:
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device, cache_mode=cm, cache_line_size=cls)
# Create 2 core devices
core_device1 = Volume(S.from_MiB(10))
core_device1 = RamVolume(S.from_MiB(10))
core1 = Core.using_device(core_device1, name="core1")
core_device2 = Volume(S.from_MiB(10))
core_device2 = RamVolume(S.from_MiB(10))
core2 = Core.using_device(core_device2, name="core2")
# Add cores
@@ -254,11 +254,11 @@ def test_neg_core_set_seq_cut_off_threshold(pyocf_ctx, cm, cls):
:return:
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device, cache_mode=cm, cache_line_size=cls)
# Create core device
core_device = Volume(S.from_MiB(10))
core_device = RamVolume(S.from_MiB(10))
core = Core.using_device(core_device, name="core")
# Add core
@@ -287,11 +287,11 @@ def test_neg_core_set_seq_cut_off_policy(pyocf_ctx, cm, cls):
:return:
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device, cache_mode=cm, cache_line_size=cls)
# Create core device
core_device = Volume(S.from_MiB(10))
core_device = RamVolume(S.from_MiB(10))
core = Core.using_device(core_device)
# Add core
@@ -318,7 +318,7 @@ def test_neg_set_alru_param(pyocf_ctx, cm, cls):
:return:
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device, cache_mode=cm, cache_line_size=cls)
# Change invalid alru param and check if failed
@@ -355,7 +355,7 @@ def test_neg_set_alru_param_value(pyocf_ctx, cm, cls, param):
:return:
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device, cache_mode=cm, cache_line_size=cls)
cache.set_cleaning_policy(CleaningPolicy.ALRU)
@@ -382,7 +382,7 @@ def test_neg_set_acp_param(pyocf_ctx, cm, cls):
:return:
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device, cache_mode=cm, cache_line_size=cls)
# Change invalid acp param and check if failed
@@ -415,7 +415,7 @@ def test_neg_set_acp_param_value(pyocf_ctx, cm, cls, param):
:return:
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device, cache_mode=cm, cache_line_size=cls)
cache.set_cleaning_policy(CleaningPolicy.ACP)
@@ -442,7 +442,7 @@ def test_neg_set_promotion_policy(pyocf_ctx, cm, cls):
:return:
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device, cache_mode=cm, cache_line_size=cls)
# Change to invalid promotion policy and check if failed
@@ -466,7 +466,7 @@ def test_neg_set_nhit_promotion_policy_param(pyocf_ctx, cm, cls):
:return:
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(
cache_device,
cache_mode=cm,
@@ -496,7 +496,7 @@ def test_neg_set_nhit_promotion_policy_param_trigger(pyocf_ctx, cm, cls):
:return:
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(
cache_device,
cache_mode=cm,
@@ -528,7 +528,7 @@ def test_neg_set_nhit_promotion_policy_param_threshold(pyocf_ctx, cm, cls):
:return:
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(
cache_device,
cache_mode=cm,
@@ -559,7 +559,7 @@ def test_neg_set_ioclass_max_size(pyocf_ctx, cm, cls):
:return:
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device, cache_mode=cm, cache_line_size=cls)
# Set invalid max size and check if failed
@@ -589,7 +589,7 @@ def test_neg_set_ioclass_priority(pyocf_ctx, cm, cls):
:return:
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device, cache_mode=cm, cache_line_size=cls)
# Set invalid priority and check if failed
@@ -619,7 +619,7 @@ def test_neg_set_ioclass_cache_mode(pyocf_ctx, cm, cls):
:return:
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device, cache_mode=cm, cache_line_size=cls)
# Set invalid cache mode and check if failed
@@ -644,7 +644,7 @@ def test_neg_set_ioclass_name(pyocf_ctx):
invalid_chars += [",", '"']
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(
cache_device, cache_mode=CacheMode.WT, cache_line_size=CacheLineSize.LINE_4KiB
)
@@ -669,7 +669,7 @@ def test_neg_set_ioclass_name_len(pyocf_ctx):
"""
# Start cache device
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(
cache_device, cache_mode=CacheMode.WT, cache_line_size=CacheLineSize.LINE_4KiB
)

View File

@@ -9,7 +9,7 @@ import pytest
from pyocf.types.cache import Cache, CacheMode, MetadataLayout, PromotionPolicy
from pyocf.types.shared import OcfError, CacheLineSize
from pyocf.types.volume import Volume
from pyocf.types.volume import RamVolume
from pyocf.utils import Size
from tests.utils.random import RandomGenerator, DefaultRanges, Range
@@ -17,7 +17,7 @@ logger = logging.getLogger(__name__)
def try_start_cache(**config):
cache_device = Volume(Size.from_MiB(50))
cache_device = RamVolume(Size.from_MiB(50))
cache = Cache.start_on_device(cache_device, **config)
cache.stop()
@@ -58,7 +58,7 @@ def test_fuzzy_start_name(pyocf_ctx, string_randomize, cm, cls):
:param cm: cache mode value to start cache with
:param cls: cache line size value to start cache with
"""
cache_device = Volume(Size.from_MiB(50))
cache_device = RamVolume(Size.from_MiB(50))
incorrect_values = ['']
try:
cache = Cache.start_on_device(cache_device, name=string_randomize, cache_mode=cm,

View File

@@ -1,5 +1,5 @@
#
# Copyright(c) 2019-2021 Intel Corporation
# Copyright(c) 2019-2022 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -12,7 +12,7 @@ from pyocf.types.cache import Cache, Core
from pyocf.types.data import Data
from pyocf.types.io import IoDir
from pyocf.types.shared import OcfCompletion
from pyocf.types.volume import Volume
from pyocf.types.volume import RamVolume
from pyocf.utils import Size
@@ -183,8 +183,8 @@ def test_neg_io_direction(pyocf_ctx, c_int_randomize):
def prepare_cache_and_core(core_size: Size, cache_size: Size = Size.from_MiB(50)):
cache_device = Volume(cache_size)
core_device = Volume(core_size)
cache_device = RamVolume(cache_size)
core_device = RamVolume(core_size)
cache = Cache.start_on_device(cache_device)
core = Core.using_device(core_device)

View File

@@ -1,5 +1,5 @@
#
# Copyright(c) 2019-2021 Intel Corporation
# Copyright(c) 2019-2022 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -8,7 +8,7 @@ from ctypes import c_int
from pyocf.types.cache import Cache, CacheMode
from pyocf.types.core import Core
from pyocf.types.volume import Volume
from pyocf.types.volume import RamVolume
from pyocf.utils import Size as S
from pyocf.types.data import Data, DataOps
from pyocf.types.ctx import OcfCtx
@@ -75,12 +75,12 @@ def test_secure_erase_simple_io_read_misses(cache_mode):
Cleaner,
)
ctx.register_volume_type(Volume)
ctx.register_volume_type(RamVolume)
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device, cache_mode=cache_mode)
core_device = Volume(S.from_MiB(50))
core_device = RamVolume(S.from_MiB(50))
core = Core.using_device(core_device)
cache.add_core(core)
@@ -168,12 +168,12 @@ def test_secure_erase_simple_io_cleaning():
Cleaner,
)
ctx.register_volume_type(Volume)
ctx.register_volume_type(RamVolume)
cache_device = Volume(S.from_MiB(50))
cache_device = RamVolume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device, cache_mode=CacheMode.WB)
core_device = Volume(S.from_MiB(100))
core_device = RamVolume(S.from_MiB(100))
core = Core.using_device(core_device)
cache.add_core(core)