Adam Litke has posted comments on this change. Change subject: GuestMemory fields should be optional ......................................................................
Patch Set 4: Code-Review-1 (3 comments) http://gerrit.ovirt.org/#/c/34528/4/mom/Collectors/GuestMemory.py File mom/Collectors/GuestMemory.py: Line 26 Line 27 Line 28 Line 29 Line 30 You ignored my comment about having getStatsFields return 'swap_total' and 'swap_usage' if the hypervisorInterface plans to supply them. http://gerrit.ovirt.org/#/c/34528/4/mom/Entity.py File mom/Entity.py: Line 90: Get the most-recently recorded value of a statistic Line 91: Returns None if no statistics are available Line 92: """ Line 93: if len(self.statistics) > 0: Line 94: return self.statistics[-1].get('name', default) oops. you want name, not 'name'. Line 95: else: Line 96: return None Line 97: Line 98: def StatAvg(self, name): Line 106: if x.get(name, None) is not None] Line 107: for row in nonEmptyStats: Line 108: total = total + row[name] Line 109: if (len(nonEmptyStats) == 0): Line 110: return float(0) > I debugged the code and if values are missing we still get 0 and not None. I'd prefer that we use the same logic as for Stat(). That is, we add a default arg to the call and if this scenario occurs then we return the policy-specified default (or None if nothing was passed). Line 111: else: Line 112: return float(total / len(nonEmptyStats)) Line 113: Line 114: def SetVar(self, name, val): -- To view, visit http://gerrit.ovirt.org/34528 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I631056568b5a69e18f6ed02730c41ab59f460aad Gerrit-PatchSet: 4 Gerrit-Project: mom Gerrit-Branch: master Gerrit-Owner: Roy Golan <rgo...@redhat.com> Gerrit-Reviewer: Adam Litke <ali...@redhat.com> Gerrit-Reviewer: Martin Sivák <msi...@redhat.com> Gerrit-Reviewer: Roy Golan <rgo...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches