Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add read_mbytes and write_mbytes from statistics #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions rtslib/tcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ def _get_status(self):
self._check_self()
return self._parse_info('Status').lower()

def _get_read_mbytes(self):
self._check_self()
return int(fread("%s/statistics/scsi_lu/read_mbytes" % self.path))

def _get_write_mbytes(self):
self._check_self()
return int(fread("%s/statistics/scsi_lu/read_mbytes" % self.path))

def _gen_attached_luns(self):
'''
Fast scan of luns attached to a storage object. This is an order of
Expand Down Expand Up @@ -304,6 +312,12 @@ def is_configured(self):
alua_supported = property(_get_alua_supported,
doc="Returns true if ALUA can be setup. False if not supported.")

read_mbytes = property(_get_read_mbytes,
doc="Get the number of megabytes read from this StorageObject")

write_mbytes = property(_get_write_mbytes,
doc="Get the number of megabytes written to this StorageObject")

def dump(self):
d = super(StorageObject, self).dump()
d['name'] = self.name
Expand Down