Merge pull request #723 from jfckm/standby-io-tests
Tests for standby I/O
This commit is contained in:
commit
71e056e662
@ -124,9 +124,9 @@ class Rio:
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
iogen = IoGen(
|
iogen = IoGen(
|
||||||
(self.jobspec.offset, self.jobspec.size),
|
(self.jobspec.offset, self.jobspec.size - self.jobspec.offset),
|
||||||
self.jobspec.bs,
|
self.jobspec.bs,
|
||||||
self.jobspec.randseed,
|
self.jobspec.randseed + hash(self.name),
|
||||||
self.jobspec.readwrite.is_random(),
|
self.jobspec.readwrite.is_random(),
|
||||||
self.jobspec.randommap,
|
self.jobspec.randommap,
|
||||||
)
|
)
|
||||||
@ -150,7 +150,7 @@ class Rio:
|
|||||||
|
|
||||||
while not self.should_finish():
|
while not self.should_finish():
|
||||||
with self.qd_condition:
|
with self.qd_condition:
|
||||||
self.qd_condition.wait_for(lambda: self.qd <= self.jobspec.qd)
|
self.qd_condition.wait_for(lambda: self.qd < self.jobspec.qd)
|
||||||
|
|
||||||
data = Data(self.jobspec.bs) # TODO pattern and verify
|
data = Data(self.jobspec.bs) # TODO pattern and verify
|
||||||
io = self.jobspec.target.new_io(
|
io = self.jobspec.target.new_io(
|
||||||
@ -190,6 +190,10 @@ class Rio:
|
|||||||
self.global_jobspec.randommap = False
|
self.global_jobspec.randommap = False
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
def randseed(self, seed):
|
||||||
|
self.global_jobspec.randseed = seed
|
||||||
|
return self
|
||||||
|
|
||||||
def bs(self, bs: Size):
|
def bs(self, bs: Size):
|
||||||
self.global_jobspec.bs = bs
|
self.global_jobspec.bs = bs
|
||||||
return self
|
return self
|
||||||
|
@ -90,8 +90,8 @@ class Io(Structure):
|
|||||||
except: # noqa E722
|
except: # noqa E722
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self.put()
|
|
||||||
self.del_object()
|
self.del_object()
|
||||||
|
self.put()
|
||||||
|
|
||||||
def submit(self):
|
def submit(self):
|
||||||
return OcfLib.getInstance().ocf_volume_submit_io(byref(self))
|
return OcfLib.getInstance().ocf_volume_submit_io(byref(self))
|
||||||
|
94
tests/functional/tests/failover/test_standby_io.py
Normal file
94
tests/functional/tests/failover/test_standby_io.py
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
#
|
||||||
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
#
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
|
from pyocf.types.volume import RamVolume
|
||||||
|
from pyocf.types.volume_cache import CacheVolume
|
||||||
|
from pyocf.types.cache import Cache
|
||||||
|
from pyocf.types.queue import Queue
|
||||||
|
from pyocf.utils import Size
|
||||||
|
from pyocf.types.shared import CacheLineSize
|
||||||
|
from pyocf.types.ctx import OcfCtx
|
||||||
|
from pyocf.rio import Rio, ReadWrite
|
||||||
|
from pyocf.helpers import (
|
||||||
|
get_collision_segment_page_location,
|
||||||
|
get_collision_segment_size,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("cacheline_size", CacheLineSize)
|
||||||
|
def test_test_standby_io(pyocf_ctx, cacheline_size):
|
||||||
|
num_jobs = 8
|
||||||
|
qd = 16
|
||||||
|
runtime = 5
|
||||||
|
|
||||||
|
vol_size = Size.from_MiB(100)
|
||||||
|
cache_vol = RamVolume(vol_size)
|
||||||
|
|
||||||
|
cache = Cache(owner=OcfCtx.get_default(), cache_line_size=cacheline_size)
|
||||||
|
|
||||||
|
cache.start_cache(init_default_io_queue=False)
|
||||||
|
|
||||||
|
for i in range(num_jobs):
|
||||||
|
cache.add_io_queue(f"io-queue-{i}")
|
||||||
|
|
||||||
|
cache.standby_attach(cache_vol)
|
||||||
|
|
||||||
|
r = (
|
||||||
|
Rio()
|
||||||
|
.target(cache)
|
||||||
|
.njobs(num_jobs)
|
||||||
|
.readwrite(ReadWrite.RANDWRITE)
|
||||||
|
.size(vol_size)
|
||||||
|
.io_size(Size.from_GiB(100))
|
||||||
|
.bs(Size.from_KiB(4))
|
||||||
|
.qd(qd)
|
||||||
|
.time(timedelta(seconds=runtime))
|
||||||
|
.time_based()
|
||||||
|
.run(cache.io_queues)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("cacheline_size", CacheLineSize)
|
||||||
|
def test_test_standby_io_metadata(pyocf_ctx, cacheline_size):
|
||||||
|
num_jobs = 8
|
||||||
|
qd = 16
|
||||||
|
runtime = 10
|
||||||
|
|
||||||
|
vol_size = Size.from_MiB(200)
|
||||||
|
cache_vol = RamVolume(vol_size)
|
||||||
|
|
||||||
|
cache = Cache(owner=OcfCtx.get_default(), cache_line_size=cacheline_size)
|
||||||
|
|
||||||
|
cache.start_cache(init_default_io_queue=False)
|
||||||
|
|
||||||
|
for i in range(num_jobs):
|
||||||
|
cache.add_io_queue(f"io-queue-{i}")
|
||||||
|
|
||||||
|
cache.standby_attach(cache_vol)
|
||||||
|
|
||||||
|
start = get_collision_segment_page_location(cache)
|
||||||
|
count = get_collision_segment_size(cache)
|
||||||
|
io_offset = Size.from_page(start)
|
||||||
|
io_size = Size.from_page(count)
|
||||||
|
|
||||||
|
cache_vol = CacheVolume(cache, open=True)
|
||||||
|
|
||||||
|
r = (
|
||||||
|
Rio()
|
||||||
|
.target(cache_vol)
|
||||||
|
.njobs(num_jobs)
|
||||||
|
.readwrite(ReadWrite.RANDWRITE)
|
||||||
|
.size(io_offset + io_size)
|
||||||
|
.bs(Size.from_KiB(16))
|
||||||
|
.offset(io_offset)
|
||||||
|
.qd(qd)
|
||||||
|
.time(timedelta(seconds=runtime))
|
||||||
|
.time_based()
|
||||||
|
.norandommap()
|
||||||
|
.run(cache.io_queues)
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user