Zhou Zheng Sheng has posted comments on this change.
Change subject: Add callback to the plethora of retry halting possibilities ......................................................................
Patch Set 2: I would prefer that you didn't submit this
(2 inline comments)
.................................................... File tests/miscTests.py Line 694: Line 695: self.assertRaises(RuntimeError, misc.retry, foo, tries=limit, Line 696: sleep=0, stopCallback=stopCallback) Line 697: # Make sure we had the proper amount of iterations before failing Line 698: self.assertEquals(counter[0], (limit - 1)) It seems that this test for testing "retry" hits the "limit" without calling "stopCallback".
To test an early halt from "stopCallback", "tries" shout be larger than "limit", and at last "aseertEquals(counter[0], limit)".
Maybe there can be two tests, one for hitting the "limit" before "stopCallback", one for early halt from "stopCallback". Line 699: Line 700: Line 701: class ValidateDDBytes(TestCaseBase): Line 702: def testValidInputTrue(self):
.................................................... File vdsm/storage/misc.py Line 743: the method. It will just not run it if it ended after the Line 744: timeout. Line 745: :param sleep: Time to sleep between calls in seconds. Line 746: :param stopCallback: A function that takes no parameters and invokes a Line 747: bail-out when it returns with a positive value. The explanation for stopCallback is very cryptic to me non-English speaker...
I have to read the code to get the meaning. Line 748: """ Line 749: if tries in [0, None]: Line 750: tries = -1 Line 751:
-- To view, visit http://gerrit.ovirt.org/8093 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Idb5a2158f008b41133352dcfb4926ad21dcceea1 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Eduardo ewarszaw@redhat.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com