From 277cf6613e64191721d546af38be84b6c8d4ce79 Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Wed, 18 May 2022 16:53:03 +0200 Subject: [PATCH] pyocf: extend trace volume to report I/O type Signed-off-by: Adam Rutkowski --- tests/functional/pyocf/types/volume.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/functional/pyocf/types/volume.py b/tests/functional/pyocf/types/volume.py index dee0d2a5..84181552 100644 --- a/tests/functional/pyocf/types/volume.py +++ b/tests/functional/pyocf/types/volume.py @@ -349,19 +349,35 @@ def reset_stats(self): class TraceDevice(Volume): + class IoType(IntEnum): + Data = 1 + Flush = 2 + Discard = 3 + def __init__(self, size, trace_fcn=None, uuid=None): super().__init__(size, uuid) self.trace_fcn = trace_fcn - def submit_io(self, io): + def _trace(self, io, io_type): submit = True if self.trace_fcn: - submit = self.trace_fcn(self, io) + submit = self.trace_fcn(self, io, io_type) + + return submit + + def submit_io(self, io): + submit = self._trace(io, TraceDevice.IoType.Data) if submit: super().submit_io(io) + def submit_flush(self, io): + submit = self._trace(io, TraceDevice.IoType.Flush) + + if submit: + super().submit_flush(io) + lib = OcfLib.getInstance() lib.ocf_io_get_priv.restype = POINTER(VolumeIoPriv)