Moti Asayag has posted comments on this change. Change subject: engine: Add host poller for setup network actions ......................................................................
Patch Set 3: (1 comment) http://gerrit.ovirt.org/#/c/34970/3/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/HostSetupNetworkPoller.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/HostSetupNetworkPoller.java: Line 35: if (System.currentTimeMillis() - timeBeforePoll < POLLING_BREAK) { Line 36: Thread.sleep(POLLING_BREAK); Line 37: } Line 38: } catch (Exception e) { Line 39: // ignore failure. network can go down due to VDSM changing the network > ok, I did not understand the code properly, but still I'm not sure if code will this make the code any clearer (added one comment + extracted a method)? public class HostSetupNetworkPoller { /** Time between polling attempts, to prevent flooding the host/network. */ private static final long POLLING_BREAK = 500; public boolean poll(Guid hostId) { long timeBeforePoll = System.currentTimeMillis(); FutureVDSCall<VDSReturnValue> task = Backend.getInstance() .getResourceManager() .runFutureVdsCommand(FutureVDSCommandType.Poll, new VdsIdVDSCommandParametersBase(hostId)); try { VDSReturnValue returnValue = task.get(Config.<Integer> getValue(ConfigValues.SetupNetworksPollingTimeout), TimeUnit.SECONDS); if (returnValue.getSucceeded()) { return true; } waitBeforeNextPoll(timeBeforePoll); } catch (TimeoutException e) { // ignore failure. network can go down due to VDSM changing the network // no need to suspend between polls, if reached timeout } return false; } public void waitBeforeNextPoll(long timeBeforePoll) { if (System.currentTimeMillis() - timeBeforePoll < POLLING_BREAK) { try { Thread.sleep(POLLING_BREAK); } catch (InterruptedException e) { // ignore. } } } } Line 40: } Line 41: Line 42: return false; Line 43: } -- To view, visit http://gerrit.ovirt.org/34970 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic11e71f0ee4e4ed4d6ae9a1d8fe4e5613da7a48f Gerrit-PatchSet: 3 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Moti Asayag <masa...@redhat.com> Gerrit-Reviewer: Martin Mucha <mmu...@redhat.com> Gerrit-Reviewer: Moti Asayag <masa...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches