Federico Simoncelli has posted comments on this change. Change subject: Add the host uptime in seconds to host stats ......................................................................
Patch Set 2: (3 comments) http://gerrit.ovirt.org/#/c/25835/2//COMMIT_MSG Commit Message: Line 3: AuthorDate: 2014-03-18 19:15:23 +0200 Line 4: Commit: Tal Nisan <[email protected]> Line 5: CommitDate: 2014-03-18 19:15:23 +0200 Line 6: Line 7: Add the host uptime in seconds to host stats We should find a component for this, maybe "stats". stats: Add the host uptime in seconds to host stats Line 8: Line 9: Change-Id: I5ebb9c27d99e50dd397db6fc97e03c4215aed456 Line 10: Signed-off-by: Tal Nisan <[email protected]> http://gerrit.ovirt.org/#/c/25835/2/vdsm/API.py File vdsm/API.py: Line 1238: stats['dateTime'] = '%02d-%02d-%02dT%02d:%02d:%02d GMT' % ( Line 1239: tm_year, tm_mon, tm_day, tm_hour, tm_min, tm_sec) Line 1240: with open('/proc/uptime', 'r') as f: Line 1241: uptime = float(f.readline().split()[0]) Line 1242: stats['uptime'] = str(uptime) No need for a double conversion str => float => str. We are confident enough that /proc/uptime won't be empty but if we want to make this safer we can try to catch an IndexError: try: stats['uptime'] = f.readline().split()[0] except IndexError: ...log error and continue... Line 1243: if self._cif.mom: Line 1244: stats['momStatus'] = self._cif.mom.getStatus() Line 1245: stats.update(self._cif.mom.getKsmStats()) Line 1246: else: http://gerrit.ovirt.org/#/c/25835/2/vdsm_api/vdsmapi-schema.json File vdsm_api/vdsmapi-schema.json: Line 1690: # @haStatus: The current status of the Hosted Engine HA system Line 1691: # (new in version 4.14.0) Line 1692: # Line 1693: # @uptime: The host uptime, used for knowing how much time has passed Line 1694: # since the last reboot in units of seconds You should also mention in what version this was added (see previous descriptions). Line 1695: # Since: 4.10.0 Line 1696: ## Line 1697: {'type': 'HostStats', Line 1698: 'data': {'cpuUser': 'float', 'cpuSys': 'float', 'cpuIdle': 'float', -- To view, visit http://gerrit.ovirt.org/25835 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5ebb9c27d99e50dd397db6fc97e03c4215aed456 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Tal Nisan <[email protected]> Gerrit-Reviewer: Allon Mureinik <[email protected]> Gerrit-Reviewer: Dan Kenigsberg <[email protected]> Gerrit-Reviewer: Dima Kuznetsov <[email protected]> Gerrit-Reviewer: Douglas Schilling Landgraf <[email protected]> Gerrit-Reviewer: Federico Simoncelli <[email protected]> Gerrit-Reviewer: Nir Soffer <[email protected]> Gerrit-Reviewer: Tal Nisan <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
