Change in vdsm[master]: sampling: Handle numa nodes with zero memory assigned

rmohr at redhat.com rmohr at redhat.com
Fri Aug 7 07:32:57 UTC 2015


Roman Mohr has posted comments on this change.

Change subject: sampling: Handle numa nodes with zero memory assigned
......................................................................


Patch Set 2:

(2 comments)

https://gerrit.ovirt.org/#/c/44121/2/vdsm/virt/sampling.py
File vdsm/virt/sampling.py:

Line 181:             nodeMemSample['memFree'] = memInfo['free']
Line 182:             # in case the numa node has zero memory assigned, report the whole
Line 183:             # memory as used
Line 184:             nodeMemSample['memPercent'] = 100
Line 185:             if memInfo['total'] != 0:
> here you check against 0 (as number)...
Done

Good catch, thx. It can indeed be a string too.
Line 186:                 nodeMemSample['memPercent'] = 100 - \
Line 187:                     int(100.0 * int(memInfo['free']) / int(memInfo['total']))
Line 188:             self.nodesMemSample[nodeIndex] = nodeMemSample
Line 189: 


Line 183:             # memory as used
Line 184:             nodeMemSample['memPercent'] = 100
Line 185:             if memInfo['total'] != 0:
Line 186:                 nodeMemSample['memPercent'] = 100 - \
Line 187:                     int(100.0 * int(memInfo['free']) / int(memInfo['total']))
> ...but here you explicitely convert as int(), to make sure it is indeed int
Currently the underlying methods are reading memory values as int and convert it from KiB to MiB in integer granularity as well. So converting to int here should be ok.
Line 188:             self.nodesMemSample[nodeIndex] = nodeMemSample
Line 189: 
Line 190: 
Line 191: class PidCpuSample(object):


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I6be69e715e9b4a0cc8ded744b0bcc192a466c6c8
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Roman Mohr <rmohr at redhat.com>
Gerrit-Reviewer: Andrej Krejcir <akrejcir at redhat.com>
Gerrit-Reviewer: Artyom Lukianov <alukiano at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Dudi Maroshi <dudi at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Roman Mohr <rmohr at redhat.com>
Gerrit-Reviewer: Roy Golan <rgolan at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list