Martin Sivák has posted comments on this change. Change subject: use monotonic time when checking the timeouts ......................................................................
Patch Set 1: Code-Review-1 (1 comment) Please fix the timeout reporting by saving the epoch as described and then using it in the State class where the metadata field is computed. The rest looks good. http://gerrit.ovirt.org/#/c/26384/1/ovirt_hosted_engine_ha/agent/state_machine.py File ovirt_hosted_engine_ha/agent/state_machine.py: Line 66: :rtype: HostedEngineData Line 67: """ Line 68: # Collect stats Line 69: stats = { Line 70: "collect_start": int(monotonic.time()), This breaks printing out the timeout info in human readable form. The solution I propose here is to add another field epoch_start and save the time.time() - monotonic.time() there. In case we are using the time.time() fallback in monotonic, the epoch will be 0. In monotonic case the epoch will signalize what to add to monotonic to get the current time on the machine in the form of unix timestamp. We can then use the addition of monotonic to epoch to compute the human readable date string. The epoch has to be computed here because all computations in states are by design limited to use only the stats structure to make sure we can use fixtures in unit tests. Time shift on the host will change the epoch and that way we still have monotonic time and also the correct unix timestamp that reflects the current time on the host. Line 71: } Line 72: Line 73: # Do not refresh if the time has not changed Line 74: if (old_data.stats is not None and -- To view, visit http://gerrit.ovirt.org/26384 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9794beb4082f52d29835be5b6a182ab448c248f2 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-hosted-engine-ha Gerrit-Branch: master Gerrit-Owner: Jiří Moskovčák <jmosk...@redhat.com> Gerrit-Reviewer: Greg Padgett <gpadg...@redhat.com> Gerrit-Reviewer: Martin Sivák <msi...@redhat.com> Gerrit-Reviewer: Sandro Bonazzola <sbona...@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