Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
oVirt Jenkins CI Server has posted comments on this change. Change subject: utils: janitorial: refactor utils.readMemInfo .. Patch Set 6: Build Successful http://jenkins.ovirt.org/job/vdsm_master_install_rpm_sanity_gerrit/131/ : SUCCESS -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Antoni Segura Puimedon Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
Dan Kenigsberg has posted comments on this change. Change subject: utils: janitorial: refactor utils.readMemInfo .. Patch Set 5: Code-Review+2 Maybe you can publish a request on ovirt-users, for people to grep for the empty /proc/meminfo log message. If no one has it nowadays, it's good to go. The issue was confirmed on el5 hosts, and was rumored to remain in early el6. Time to check again. -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Antoni Segura Puimedon Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
Dan Kenigsberg has submitted this change and it was merged. Change subject: utils: janitorial: refactor utils.readMemInfo .. utils: janitorial: refactor utils.readMemInfo minor cleanup in readMemInfo: - split the actual parsing logic in a separate function; - modernized readMemInfo, switching from file() to with/open(). - added a couple of unit tests to be sure everything still works. PatchSet V2: address the comments about V1: - parseMemInfo is now _parseMemInfo, as it is not expected to be used outside the utils.py (and its tests) - use os.path.dirname() to find the test data PatchSet V3: - registered mem_info.out as test data. PatchSet V4: - register mem_info.out in vdsm.spec.in and in the debian install file. PatchSet V5: - drop stray blank line. Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Signed-off-by: Francesco Romani Reviewed-on: http://gerrit.ovirt.org/22041 Reviewed-by: Antoni Segura Puimedon Reviewed-by: Dan Kenigsberg --- M debian/vdsm-tests.install M lib/vdsm/utils.py M tests/Makefile.am A tests/mem_info.out M tests/utilsTests.py M vdsm.spec.in 6 files changed, 86 insertions(+), 7 deletions(-) Approvals: Antoni Segura Puimedon: Looks good to me, but someone else must approve Dan Kenigsberg: Looks good to me, approved Francesco Romani: Verified -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Antoni Segura Puimedon Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: oVirt Jenkins CI Server ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
Francesco Romani has posted comments on this change. Change subject: utils: janitorial: refactor utils.readMemInfo .. Patch Set 5: Verified+1 (repasted from patchset 4) did some research about the empty /proc/meminfo issue. No luck so far neither in the kernel nor in the python bugzillas. also verified the changeset into a running vdsm instance, alongside with http://gerrit.ovirt.org/#/c/22219/ and http://gerrit.ovirt.org/#/c/22195/ mem usage reporting in engine and general behaviour seem fine, so also marking as verified. -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Antoni Segura Puimedon Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
Antoni Segura Puimedon has posted comments on this change. Change subject: utils: janitorial: refactor utils.readMemInfo .. Patch Set 5: Code-Review+1 -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Antoni Segura Puimedon Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
oVirt Jenkins CI Server has posted comments on this change. Change subject: utils: janitorial: refactor utils.readMemInfo .. Patch Set 5: Build Successful http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/6052/ : SUCCESS http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5265/ : SUCCESS http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6155/ : SUCCESS http://jenkins.ovirt.org/job/vdsm_master_install_rpm_sanity_gerrit/130/ : SUCCESS -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Antoni Segura Puimedon Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
Antoni Segura Puimedon has posted comments on this change. Change subject: utils: janitorial: refactor utils.readMemInfo .. Patch Set 4: Code-Review-1 (1 comment) pep8 issue in the comment. File tests/utilsTests.py Line 130:('a', 'b', 'c', 'd', 'e')] Line 131: self.assertEquals(list(utils.grouper(iterable, 5)), grouped) Line 132: Line 133: Line 134: This extra blank line should go. Line 135: class AsyncProcessOperationTests(TestCaseBase): Line 136: def _echo(self, text): Line 137: proc = misc.execCmd(["echo", "-n", "test"], sync=False) Line 138: -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Antoni Segura Puimedon Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
Francesco Romani has posted comments on this change. Change subject: utils: janitorial: refactor utils.readMemInfo .. Patch Set 4: Verified+1 did some research about the empty /proc/meminfo issue. No luck so far neither in the kernel nor in the python bugzillas. also verified the changeset into a running vdsm instance, alongside with http://gerrit.ovirt.org/#/c/22219/ and http://gerrit.ovirt.org/#/c/22195/ mem usage reporting in engine and general behaviour seem fine, so also marking as verified. -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Antoni Segura Puimedon Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
oVirt Jenkins CI Server has posted comments on this change. Change subject: utils: janitorial: refactor utils.readMemInfo .. Patch Set 4: Code-Review-1 Verified-1 Build Failed http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/6051/ : UNSTABLE http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5264/ : FAILURE http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6154/ : FAILURE http://jenkins.ovirt.org/job/vdsm_master_install_rpm_sanity_gerrit/129/ : FAILURE -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Antoni Segura Puimedon Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
Antoni Segura Puimedon has posted comments on this change. Change subject: utils: janitorial: refactor utils.readMemInfo .. Patch Set 4: Code-Review+1 -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Antoni Segura Puimedon Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
Antoni Segura Puimedon has posted comments on this change. Change subject: utils: janitorial: refactor utils.readMemInfo .. Patch Set 3: Code-Review+1 -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Antoni Segura Puimedon Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
Francesco Romani has posted comments on this change. Change subject: utils: janitorial: refactor utils.readMemInfo .. Patch Set 3: (1 comment) File lib/vdsm/utils.py Line 194: with open('/proc/meminfo') as f: Line 195: lines = f.readlines() Line 196: return _parseMemInfo(lines) Line 197: except: Line 198: logging.warning(lines, exc_info=True) Yes, I will investigate about that. Line 199: if tries <= 0: Line 200: raise Line 201: time.sleep(0.1) Line 202: -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Antoni Segura Puimedon Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
Dan Kenigsberg has posted comments on this change. Change subject: utils: janitorial: refactor utils.readMemInfo .. Patch Set 3: Code-Review+2 (1 comment) File lib/vdsm/utils.py Line 194: with open('/proc/meminfo') as f: Line 195: lines = f.readlines() Line 196: return _parseMemInfo(lines) Line 197: except: Line 198: logging.warning(lines, exc_info=True) Could you see if we ever get this error nowadays? (Unrelated to patch) Line 199: if tries <= 0: Line 200: raise Line 201: time.sleep(0.1) Line 202: -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Antoni Segura Puimedon Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
oVirt Jenkins CI Server has posted comments on this change. Change subject: utils: janitorial: refactor utils.readMemInfo .. Patch Set 3: Build Successful http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/5936/ : SUCCESS http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5140/ : SUCCESS http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6028/ : SUCCESS -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Antoni Segura Puimedon Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
Francesco Romani has posted comments on this change. Change subject: utils: janitorial: refactor utils.readMemInfo .. Patch Set 2: Verified+1 -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Antoni Segura Puimedon Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
Antoni Segura Puimedon has posted comments on this change. Change subject: utils: janitorial: refactor utils.readMemInfo .. Patch Set 2: Code-Review+1 -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Antoni Segura Puimedon Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
oVirt Jenkins CI Server has posted comments on this change. Change subject: utils: janitorial: refactor utils.readMemInfo .. Patch Set 2: Build Successful http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/5910/ : SUCCESS http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5114/ : SUCCESS http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6002/ : SUCCESS -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Antoni Segura Puimedon Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
Francesco Romani has posted comments on this change. Change subject: utils: janitorial: refactor utils.readMemInfo .. Patch Set 1: (1 comment) File tests/utilsTests.py Line 102: self.assertTrue(isinstance(meminfo[field], int)) Line 103: Line 104: def testParseMemInfo(self): Line 105: testPath = os.path.realpath(__file__) Line 106: dirName = os.path.split(testPath)[0] Yep, would be better. Will do. Line 107: path = os.path.join(dirName, "mem_info.out") Line 108: with open(path) as f: Line 109: meminfo = utils.parseMemInfo(f.readlines()) Line 110: # testing some random fields -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Antoni Segura Puimedon Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
Antoni Segura Puimedon has posted comments on this change. Change subject: utils: janitorial: refactor utils.readMemInfo .. Patch Set 1: Code-Review-1 (2 comments) Some minor nits. File lib/vdsm/utils.py Line 163: IPXMLRPCServer): Line 164: allow_reuse_address = True Line 165: Line 166: Line 167: def parseMemInfo(lines): I'd probably make this _parseMemInfo. If we see that we need it outside this module we can always drop the leading underscore. Line 168: """ Line 169: Parse the content of ``/proc/meminfo`` as list of strings Line 170: and return its content as a dictionary. Line 171: """ File tests/utilsTests.py Line 102: self.assertTrue(isinstance(meminfo[field], int)) Line 103: Line 104: def testParseMemInfo(self): Line 105: testPath = os.path.realpath(__file__) Line 106: dirName = os.path.split(testPath)[0] shouldn't this be os.path.dirname? Line 107: path = os.path.join(dirName, "mem_info.out") Line 108: with open(path) as f: Line 109: meminfo = utils.parseMemInfo(f.readlines()) Line 110: # testing some random fields -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: Antoni Segura Puimedon Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
oVirt Jenkins CI Server has posted comments on this change. Change subject: utils: janitorial: refactor utils.readMemInfo .. Patch Set 1: Build Successful http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/5898/ : SUCCESS http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5102/ : SUCCESS http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/5990/ : SUCCESS -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: utils: janitorial: refactor utils.readMemInfo
Francesco Romani has uploaded a new change for review. Change subject: utils: janitorial: refactor utils.readMemInfo .. utils: janitorial: refactor utils.readMemInfo minor cleanup in readMemInfo: - split the actual parsing logic in a separate function; - modernized readMemInfo, switching from file() to with/open(). - added a couple of unit tests to be sure everything still works. Change-Id: Ife98134e4512613fb9812f3162c7cd6a4af8fc89 Signed-off-by: Francesco Romani --- M lib/vdsm/utils.py A tests/mem_info.out M tests/utilsTests.py 3 files changed, 83 insertions(+), 7 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/22041/1 diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py index ebd36b8..1e6640c 100644 --- a/lib/vdsm/utils.py +++ b/lib/vdsm/utils.py @@ -164,6 +164,18 @@ allow_reuse_address = True +def parseMemInfo(lines): +""" +Parse the content of ``/proc/meminfo`` as list of strings +and return its content as a dictionary. +""" +meminfo = {} +for line in lines: +var, val = line.split()[0:2] +meminfo[var[:-1]] = int(val) +return meminfo + + def readMemInfo(): """ Parse ``/proc/meminfo`` and return its content as a dictionary. @@ -176,16 +188,12 @@ """ # FIXME the root cause for these retries should be found and fixed tries = 3 -meminfo = {} while True: tries -= 1 try: -lines = [] -lines = file('/proc/meminfo').readlines() -for line in lines: -var, val = line.split()[0:2] -meminfo[var[:-1]] = int(val) -return meminfo +with open('/proc/meminfo') as f: +lines = f.readlines() +return parseMemInfo(lines) except: logging.warning(lines, exc_info=True) if tries <= 0: diff --git a/tests/mem_info.out b/tests/mem_info.out new file mode 100644 index 000..a3d63cf --- /dev/null +++ b/tests/mem_info.out @@ -0,0 +1,43 @@ +MemTotal:3533548 kB +MemFree: 898860 kB +Buffers: 63096 kB +Cached: 1204380 kB +SwapCached:18716 kB +Active: 967220 kB +Inactive:1432748 kB +Active(anon): 684704 kB +Inactive(anon): 472932 kB +Active(file): 282516 kB +Inactive(file): 959816 kB +Unevictable: 64 kB +Mlocked: 64 kB +SwapTotal: 8191996 kB +SwapFree:8149840 kB +Dirty: 404 kB +Writeback: 0 kB +AnonPages: 1120160 kB +Mapped: 112044 kB +Shmem: 25136 kB +Slab: 122516 kB +SReclaimable: 70108 kB +SUnreclaim:52408 kB +KernelStack:2760 kB +PageTables:35708 kB +NFS_Unstable: 0 kB +Bounce:0 kB +WritebackTmp: 0 kB +CommitLimit: 9958768 kB +Committed_AS:2743708 kB +VmallocTotal: 34359738367 kB +VmallocUsed: 348452 kB +VmallocChunk: 34359385688 kB +HardwareCorrupted: 0 kB +AnonHugePages:116736 kB +HugePages_Total: 0 +HugePages_Free:0 +HugePages_Rsvd:0 +HugePages_Surp:0 +Hugepagesize: 2048 kB +DirectMap4k: 126528 kB +DirectMap2M: 3543040 kB +DirectMap1G: 0 kB diff --git a/tests/utilsTests.py b/tests/utilsTests.py index 28fdd6c..de1561d 100644 --- a/tests/utilsTests.py +++ b/tests/utilsTests.py @@ -17,6 +17,8 @@ # # Refer to the README and COPYING files for full details of the license # + +import os.path import contextlib import errno import logging @@ -87,6 +89,29 @@ def testAnyFnmatch(self): self.assertTrue(utils.anyFnmatch('test1', ['test0', 'test1'])) +def testReadMemInfo(self): +meminfo = utils.readMemInfo() +# most common fields as per man 5 proc +# add your own here +fields = ('MemTotal', 'MemFree', 'Buffers', 'Cached', 'SwapCached', + 'Active', 'Inactive', 'SwapTotal', 'SwapFree', 'Dirty', + 'Writeback', 'Mapped', 'Slab', 'VmallocTotal', + 'VmallocUsed', 'VmallocChunk') +for field in fields: +self.assertTrue(field in meminfo) +self.assertTrue(isinstance(meminfo[field], int)) + +def testParseMemInfo(self): +testPath = os.path.realpath(__file__) +dirName = os.path.split(testPath)[0] +path = os.path.join(dirName, "mem_info.out") +with open(path) as f: +meminfo = utils.parseMemInfo(f.readlines()) +# testing some random fields +self.assertEquals(meminfo['NFS_Unstable'], 0) +self.assertEquals(meminfo['KernelStack'], 2760) +self.assertEquals(meminfo['Inactive'], 1432748) + class AsyncProcessOperationTests(TestCaseBase): def _echo(self, text): -- To view, visit http://gerrit.ovirt.org/22041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-Me