Unique core name - test update
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
parent
4f0735b503
commit
b73b2857dd
@ -56,7 +56,7 @@ class Core:
|
|||||||
self,
|
self,
|
||||||
device: Volume,
|
device: Volume,
|
||||||
try_add: bool,
|
try_add: bool,
|
||||||
name: str = "",
|
name: str = "core",
|
||||||
core_id: int = DEFAULT_ID,
|
core_id: int = DEFAULT_ID,
|
||||||
seq_cutoff_threshold: int = DEFAULT_SEQ_CUTOFF_THRESHOLD,
|
seq_cutoff_threshold: int = DEFAULT_SEQ_CUTOFF_THRESHOLD,
|
||||||
):
|
):
|
||||||
@ -74,7 +74,7 @@ class Core:
|
|||||||
_size=len(self.device_name) + 1,
|
_size=len(self.device_name) + 1,
|
||||||
),
|
),
|
||||||
_core_id=self.core_id,
|
_core_id=self.core_id,
|
||||||
_name=name.encode("ascii") if name else None,
|
_name=cast(create_string_buffer(name.encode("ascii")), c_char_p),
|
||||||
_volume_type=self.device.type_id,
|
_volume_type=self.device.type_id,
|
||||||
_try_add=try_add,
|
_try_add=try_add,
|
||||||
_seq_cutoff_threshold=seq_cutoff_threshold,
|
_seq_cutoff_threshold=seq_cutoff_threshold,
|
||||||
|
@ -27,7 +27,9 @@ class OcfErrorCode(IntEnum):
|
|||||||
OCF_ERR_NO_FREE_RAM = auto()
|
OCF_ERR_NO_FREE_RAM = auto()
|
||||||
OCF_ERR_START_CACHE_FAIL = auto()
|
OCF_ERR_START_CACHE_FAIL = auto()
|
||||||
OCF_ERR_CACHE_NOT_EXIST = auto()
|
OCF_ERR_CACHE_NOT_EXIST = auto()
|
||||||
|
OCF_ERR_CORE_NOT_EXIST = auto()
|
||||||
OCF_ERR_CACHE_EXIST = auto()
|
OCF_ERR_CACHE_EXIST = auto()
|
||||||
|
OCF_ERR_CORE_EXIST = auto()
|
||||||
OCF_ERR_TOO_MANY_CORES = auto()
|
OCF_ERR_TOO_MANY_CORES = auto()
|
||||||
OCF_ERR_CORE_NOT_AVAIL = auto()
|
OCF_ERR_CORE_NOT_AVAIL = auto()
|
||||||
OCF_ERR_NOT_OPEN_EXC = auto()
|
OCF_ERR_NOT_OPEN_EXC = auto()
|
||||||
|
@ -128,7 +128,7 @@ def test_add_remove_30core(pyocf_ctx):
|
|||||||
stats = cache.get_stats()
|
stats = cache.get_stats()
|
||||||
assert stats["conf"]["core_count"] == i
|
assert stats["conf"]["core_count"] == i
|
||||||
core_device = Volume(S.from_MiB(10))
|
core_device = Volume(S.from_MiB(10))
|
||||||
core = Core.using_device(core_device)
|
core = Core.using_device(core_device, name=f"core{i}")
|
||||||
core_devices.append(core)
|
core_devices.append(core)
|
||||||
cache.add_core(core)
|
cache.add_core(core)
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ def test_adding_to_random_cache(pyocf_ctx):
|
|||||||
# Create 50 core devices and add to random cache
|
# Create 50 core devices and add to random cache
|
||||||
for i in range(0, core_amount):
|
for i in range(0, core_amount):
|
||||||
core_device = Volume(S.from_MiB(10))
|
core_device = Volume(S.from_MiB(10))
|
||||||
core = Core.using_device(core_device)
|
core = Core.using_device(core_device, name=f"core{i}")
|
||||||
core_devices[core] = randint(0, cache_amount - 1)
|
core_devices[core] = randint(0, cache_amount - 1)
|
||||||
cache_devices[core_devices[core]].add_core(core)
|
cache_devices[core_devices[core]].add_core(core)
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ def test_add_remove_incrementally(pyocf_ctx, cache_mode, cls):
|
|||||||
# Create 5 core devices and add to cache
|
# Create 5 core devices and add to cache
|
||||||
for i in range(0, core_amount):
|
for i in range(0, core_amount):
|
||||||
core_device = Volume(S.from_MiB(10))
|
core_device = Volume(S.from_MiB(10))
|
||||||
core = Core.using_device(core_device)
|
core = Core.using_device(core_device, name=f"core{i}")
|
||||||
core_devices.append(core)
|
core_devices.append(core)
|
||||||
cache.add_core(core)
|
cache.add_core(core)
|
||||||
|
|
||||||
|
@ -64,9 +64,9 @@ def test_cache_change_seq_cut_off_policy(pyocf_ctx, cm, cls):
|
|||||||
|
|
||||||
# Create 2 core devices
|
# Create 2 core devices
|
||||||
core_device1 = Volume(S.from_MiB(10))
|
core_device1 = Volume(S.from_MiB(10))
|
||||||
core1 = Core.using_device(core_device1)
|
core1 = Core.using_device(core_device1, name="core1")
|
||||||
core_device2 = Volume(S.from_MiB(10))
|
core_device2 = Volume(S.from_MiB(10))
|
||||||
core2 = Core.using_device(core_device2)
|
core2 = Core.using_device(core_device2, name="core2")
|
||||||
|
|
||||||
# Add cores
|
# Add cores
|
||||||
cache.add_core(core1)
|
cache.add_core(core1)
|
||||||
@ -103,9 +103,9 @@ def test_core_change_seq_cut_off_policy(pyocf_ctx, cm, cls):
|
|||||||
|
|
||||||
# Create 2 core devices
|
# Create 2 core devices
|
||||||
core_device1 = Volume(S.from_MiB(10))
|
core_device1 = Volume(S.from_MiB(10))
|
||||||
core1 = Core.using_device(core_device1)
|
core1 = Core.using_device(core_device1, name="core1")
|
||||||
core_device2 = Volume(S.from_MiB(10))
|
core_device2 = Volume(S.from_MiB(10))
|
||||||
core2 = Core.using_device(core_device2)
|
core2 = Core.using_device(core_device2, name="core2")
|
||||||
|
|
||||||
# Add cores
|
# Add cores
|
||||||
cache.add_core(core1)
|
cache.add_core(core1)
|
||||||
|
Loading…
Reference in New Issue
Block a user