Change in vdsm[master]: Add the host uptime in seconds to host stats

Federico Simoncelli fsimonce at redhat.com
Wed Mar 19 08:59:15 UTC 2014


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 <tnisan at redhat.com>
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 <tnisan at redhat.com>


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 <tnisan at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Dima Kuznetsov <dkuznets at redhat.com>
Gerrit-Reviewer: Douglas Schilling Landgraf <dougsland at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Tal Nisan <tnisan at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list