Skip to content

Commit

Permalink
pyocf: extend trace volume to report I/O type
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
  • Loading branch information
Adam Rutkowski committed May 19, 2022
1 parent 9684f07 commit 277cf66
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions tests/functional/pyocf/types/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 277cf66

Please # to comment.