Greg Padgett has posted comments on this change.

Change subject: stats: return HA agent score when applicable
......................................................................


Patch Set 4:

(7 comments)

....................................................
File vdsm/API.py
Line 51: try:
Line 52:     import ovirt_hosted_engine_ha.client.client as ha_client
Line 53:     ha_agent = True
Line 54: except ImportError:
Line 55:     ha_agent = False
Can you provide a reference/example?  In the python docs [1], ImportError is 
rasied when a module cannot be found; for issues within the imported module you 
may see something like a SyntaxError instead.

[1] http://docs.python.org/2/library/exceptions.html
Line 56: 
Line 57: # default message for system shutdown, will be displayed in guest
Line 58: USER_SHUTDOWN_MESSAGE = 'System going down'
Line 59: 


Line 1187: 
Line 1188:         def _getHaScore():
Line 1189:             if ha_agent:
Line 1190:                 try:
Line 1191:                     return 
ha_client.HAClient().get_local_host_score()
The client library class needs to be instantiated to work properly.
Line 1192:                 except:
Line 1193:                     pass
Line 1194:             return False
Line 1195: 


Line 1188:         def _getHaScore():
Line 1189:             if ha_agent:
Line 1190:                 try:
Line 1191:                     return 
ha_client.HAClient().get_local_host_score()
Line 1192:                 except:
Currently anything in Exception but not BaseException, I'll amend it 
accordingly.
Line 1193:                     pass
Line 1194:             return False
Line 1195: 
Line 1196:         def _readSwapTotalFree():


Line 1190:                 try:
Line 1191:                     return 
ha_client.HAClient().get_local_host_score()
Line 1192:                 except:
Line 1193:                     pass
Line 1194:             return False
... inlining this as recommended below, so the "PHP" is going away.
Line 1195: 
Line 1196:         def _readSwapTotalFree():
Line 1197:             meminfo = utils.readMemInfo()
Line 1198:             return meminfo['SwapTotal'] / 1024, meminfo['SwapFree'] 
/ 1024


Line 1225:         stats['generationID'] = self._cif._generationID
Line 1226: 
Line 1227:         haScore = _getHaScore()
Line 1228:         if haScore is not False:
Line 1229:             stats['haScore'] = haScore
Inlined.
Line 1230: 
Line 1231:         return {'status': doneCode, 'info': stats}
Line 1232: 
Line 1233:     def setLogLevel(self, level):


....................................................
File vdsm_api/vdsmapi-schema.json
Line 1617: #
Line 1618: # @momStatus:       The current status of the MOM policy engine
Line 1619: #
Line 1620: # @haScore:         #optional The host score according to the HA 
agent,
Line 1621: #                   if installed
Done.  Is 4.13.0 still the right version to list?
Line 1622: #
Line 1623: # Since: 4.10.0
Line 1624: ##
Line 1625: {'type': 'HostStats',


Line 1636:            'memCommitted': 'int', 'swapTotal': 'int', 'swapFree': 
'int',
Line 1637:            'vmCount': 'int', 'vmActive': 'int', 'vmMigrating': 'int',
Line 1638:            'dateTime': 'str', 'ksmState': 'bool', 'ksmPages': 'int',
Line 1639:            'ksmCpu': 'float', 'netConfigDirty': 'bool', 
'generationID': 'UUID',
Line 1640:            'momStatus': 'MOMStatus', 'haScore': 'uint'}}
Done
Line 1641: 
Line 1642: ##
Line 1643: # @Host.getStats:
Line 1644: #


-- 
To view, visit http://gerrit.ovirt.org/20126
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibdad8accb0660dbdcc8b6e1b83f491c2f89c2d30
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Greg Padgett <gpadg...@redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com>
Gerrit-Reviewer: Doron Fediuck <dfedi...@redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimo...@redhat.com>
Gerrit-Reviewer: Greg Padgett <gpadg...@redhat.com>
Gerrit-Reviewer: Martin Sivák <msi...@redhat.com>
Gerrit-Reviewer: Nir Soffer <nsof...@redhat.com>
Gerrit-Reviewer: Oved Ourfali <oourf...@redhat.com>
Gerrit-Reviewer: Sandro Bonazzola <sbona...@redhat.com>
Gerrit-Reviewer: Vinzenz Feenstra <vfeen...@redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to