Change in vdsm[master]: WIP vdsStats: return HA agent score when applicable

2013-10-14 Thread sbonazzo
Sandro Bonazzola has posted comments on this change.

Change subject: WIP vdsStats: return HA agent score when applicable
..


Patch Set 1: Code-Review+1

-- 
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: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Greg Padgett gpadg...@redhat.com
Gerrit-Reviewer: Doron Fediuck dfedi...@redhat.com
Gerrit-Reviewer: Greg Padgett gpadg...@redhat.com
Gerrit-Reviewer: Martin Sivák msi...@redhat.com
Gerrit-Reviewer: Oved Ourfali oourf...@redhat.com
Gerrit-Reviewer: Sandro Bonazzola sbona...@redhat.com
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: WIP vdsStats: return HA agent score when applicable

2013-10-11 Thread gpadgett
Greg Padgett has uploaded a new change for review.

Change subject: WIP vdsStats: return HA agent score when applicable
..

WIP vdsStats: return HA agent score when applicable

When the Hosted Engine HA Agent is installed, it can provide information
useful to the engine about the host's suitability to run the engine VM.
Provide this information to the engine through the vdsStats interface.

Change-Id: Ibdad8accb0660dbdcc8b6e1b83f491c2f89c2d30
Bug-Url: https://bugzilla.redhat.com/??
Signed-off-by: Greg Padgett gpadg...@redhat.com
---
M vdsm/API.py
M vdsm_api/vdsmapi-schema.json
2 files changed, 28 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/26/20126/1

diff --git a/vdsm/API.py b/vdsm/API.py
index 37bb908..8ca5a0b 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -48,6 +48,13 @@
 
 import supervdsm
 
+try:
+import ovirt_hosted_engine_ha.client.client as ha_client
+ha_agent = True
+except ImportError:
+ha_agent = False
+
+
 # default message for system shutdown, will be displayed in guest
 USER_SHUTDOWN_MESSAGE = 'System going down'
 
@@ -1209,6 +1216,11 @@
 
 stats['netConfigDirty'] = str(self._cif._netConfigDirty)
 stats['generationID'] = self._cif._generationID
+
+haScore = self._getHaScore()
+if haScore is not False:
+stats['haScore'] = haScore
+
 return {'status': doneCode, 'info': stats}
 
 def setLogLevel(self, level):
@@ -1493,6 +1505,18 @@
 self.log.error(vmId + ': Lost connection to VM')
 return count, active, migrating
 
+def _getHaScore(self):
+
+Return the hosted engine HA score for this host,
+or False if unavailable.
+
+if ha_agent:
+try:
+return ha_client.HAClient().get_local_host_score()
+except:
+pass
+return False
+
 @staticmethod
 def translateNetOptionsToNew(options):
 _translationMap = {
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index aae6c6e..47f7114 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -1613,6 +1613,9 @@
 #
 # @momStatus:   The current status of the MOM policy engine
 #
+# @haScore: #optional The host score according to the HA agent,
+# if installed
+#
 # Since: 4.10.0
 ##
 {'type': 'HostStats',
@@ -1630,7 +1633,7 @@
'vmCount': 'int', 'vmActive': 'int', 'vmMigrating': 'int',
'dateTime': 'str', 'ksmState': 'bool', 'ksmPages': 'int',
'ksmCpu': 'float', 'netConfigDirty': 'bool', 'generationID': 'UUID',
-   'momStatus': 'MOMStatus'}}
+   'momStatus': 'MOMStatus', 'haScore': 'uint'}}
 
 ##
 # @Host.getStats:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibdad8accb0660dbdcc8b6e1b83f491c2f89c2d30
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Greg Padgett gpadg...@redhat.com
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: WIP vdsStats: return HA agent score when applicable

2013-10-11 Thread gpadgett
Greg Padgett has posted comments on this change.

Change subject: WIP vdsStats: return HA agent score when applicable
..


Patch Set 1: Verified+1

-- 
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: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Greg Padgett gpadg...@redhat.com
Gerrit-Reviewer: Doron Fediuck dfedi...@redhat.com
Gerrit-Reviewer: Greg Padgett gpadg...@redhat.com
Gerrit-Reviewer: Martin Sivák msi...@redhat.com
Gerrit-Reviewer: Oved Ourfali oourf...@redhat.com
Gerrit-Reviewer: Sandro Bonazzola sbona...@redhat.com
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: WIP vdsStats: return HA agent score when applicable

2013-10-11 Thread oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.

Change subject: WIP vdsStats: return HA agent score when applicable
..


Patch Set 1: Verified-1

Build Failed 

http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/4943/ : ABORTED

http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/4057/ : SUCCESS

http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/4867/ : SUCCESS

-- 
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: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Greg Padgett gpadg...@redhat.com
Gerrit-Reviewer: Doron Fediuck dfedi...@redhat.com
Gerrit-Reviewer: Greg Padgett gpadg...@redhat.com
Gerrit-Reviewer: Martin Sivák msi...@redhat.com
Gerrit-Reviewer: Oved Ourfali oourf...@redhat.com
Gerrit-Reviewer: Sandro Bonazzola sbona...@redhat.com
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches