Adam Litke has posted comments on this change. Change subject: Fixing vcpuCount periodic error. ......................................................................
Patch Set 1: Code-Review-1 (3 comments) Concept is fine, just needs another round. http://gerrit.ovirt.org/#/c/30486/1/mom/HypervisorInterfaces/vdsmInterface.py File mom/HypervisorInterfaces/vdsmInterface.py: Line 181 Line 182 Line 183 Line 184 Line 185 s/==/is/ Line 184 Line 185 Line 186 Line 187 Line 188 Come to think of it, this whole block is rather clumsy. How about this instead: stats = response['statsList'][0] try: ret['vcpu_user_limit'] = stats.get('vcpuUserLimit', 100) ret['vcpu_quota'] = stats.get('vcpuQuota', 0) ret['vcpu_period'] = stats.get('vcpuPeriod', 0) ret['vcpu_count'] = stats['vcpu_count'] except KeyError: return None Line 180: vcpuPeriod = response['statsList'][0].get('vcpuPeriod', 0) Line 181: ret['vcpu_period'] = vcpuPeriod Line 182: Line 183: #Get num of vCPUs Line 184: vcpuCount = response['statsList'][0].get('vcpuCount', None) The second parameter of get() defaults to None so just write this: vcpuCount = response['statsList'][0].get('vcpuCount') Line 185: if vcpuCount == None: Line 186: return None Line 187: else: Line 188: ret['vcpu_count'] = vcpuCount -- To view, visit http://gerrit.ovirt.org/30486 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie913a68b95f0384dbd573275cd9e70cb6c740ee6 Gerrit-PatchSet: 1 Gerrit-Project: mom Gerrit-Branch: mom-0.4.1 Gerrit-Owner: Kobi Ianko <k...@redhat.com> Gerrit-Reviewer: Adam Litke <ali...@redhat.com> Gerrit-Reviewer: Gilad Chaplik <gchap...@redhat.com> Gerrit-Reviewer: Jiří Moskovčák <jmosk...@redhat.com> Gerrit-Reviewer: Martin Sivák <msi...@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