Change in vdsm[master]: virt: stats: make _disk_iops_bytes more robust

nsoffer at redhat.com nsoffer at redhat.com
Sat Jan 16 21:15:48 UTC 2016


Nir Soffer has posted comments on this change.

Change subject: virt: stats: make _disk_iops_bytes more robust
......................................................................


Patch Set 8:

(2 comments)

https://gerrit.ovirt.org/#/c/50594/8/vdsm/virt/vmstats.py
File vdsm/virt/vmstats.py:

Line 355: 
Line 356: def _disk_iops_bytes(first_sample, first_index, last_sample, last_index):
Line 357:     stats = {}
Line 358: 
Line 359:     for (name, suffix) in (('readOps', 'rd.reqs'),
Parenthesis not needed
Line 360:                            ('writeOps', 'wr.reqs'),
Line 361:                            ('readBytes', 'rd.bytes'),
Line 362:                            ('writtenBytes', 'wr.bytes')):
Line 363:         try:


Line 363:         try:
Line 364:             stats[name] = str(
Line 365:                 last_sample['block.%d.%s' % (last_index, suffix)])
Line 366:         except KeyError:
Line 367:             pass
Better separate getting the value (and handling missing value) from setting the result:

    key = 'block.%d.%s' % (last_index, suffix)
    try:
        value = last_sample[key]
    except KeyError:
        continue
    stats[name] = str(value)
Line 368:     return stats
Line 369: 
Line 370: 
Line 371: def _diff(prev, curr, val):


-- 
To view, visit https://gerrit.ovirt.org/50594
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I341779e2629a1122e4c0fa55206ad404f3eb2f48
Gerrit-PatchSet: 8
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Polednik <mpolednik at redhat.com>
Gerrit-Reviewer: Milan Zamazal <mzamazal at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Vinzenz Feenstra <vfeenstr at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list