Francesco Romani has posted comments on this change. Change subject: host stats: Collect stats from online cpu cores only ......................................................................
Patch Set 6: (3 comments) https://gerrit.ovirt.org/#/c/46269/6//COMMIT_MSG Commit Message: Line 29: 'cpuUser': '3.46', Line 30: 'nodeIndex': 0}} Line 31: [...] Line 32: Line 33: When only one CPU out of two has been online before libvird was typo: libvirtd Line 34: started, vdsm reports: Line 35: Line 36: $ vdsClient -s 0 getVdsStats Line 37: [...] Line 40: 'cpuUser': '7.86', Line 41: 'nodeIndex': 0}} Line 42: [...] Line 43: Line 44: When one CPU went offline after libvird has been started, vdsm threw typo: libvirtd Line 45: an exception. With this patch getVdsStats reports only stats from the Line 46: remaining online CPU: Line 47: Line 48: $ vdsClient -s 0 getVdsStats https://gerrit.ovirt.org/#/c/46269/6/vdsm/virt/sampling.py File vdsm/virt/sampling.py: Line 693: for cpu_core in cpu_cores: Line 694: # Do not try to collect cpu core data when no samples are present Line 695: if (not last_sample.cpuCores.getCoreSample(cpu_core) or not Line 696: first_sample.cpuCores.getCoreSample(cpu_core)): Line 697: continue This works, but I'm not sure we want to do this instead of using a try/except block around core_stat handling below. Something like: try: core_stat = { 'nodeIndex': int(node_index), 'cpuUser': compute_cpu_usage(cpu_core, 'user'), 'cpuSys': compute_cpu_usage(cpu_core, 'sys'), } except KeyError: # cpu onlined or offlined recently, not enough samples yet pass else: core_stat['cpuIdle'] = ( "%.2f" % max(0.0, 100.0 - float(core_stat['cpuUser']) - float(core_stat['cpuSys']))) cpu_core_stats[str(cpu_core)] = core_stat Line 698: core_stat = { Line 699: 'nodeIndex': int(node_index), Line 700: 'cpuUser': compute_cpu_usage(cpu_core, 'user'), Line 701: 'cpuSys': compute_cpu_usage(cpu_core, 'sys'), -- To view, visit https://gerrit.ovirt.org/46269 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia9c247f9138e02a9230a0849a04cb2e1705e7fac Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Roman Mohr <rm...@redhat.com> Gerrit-Reviewer: Francesco Romani <from...@redhat.com> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer <nsof...@redhat.com> Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com> Gerrit-Reviewer: Roman Mohr <rm...@redhat.com> Gerrit-Reviewer: Roy Golan <rgo...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches