Artyom Lukianov has uploaded a new change for review. Change subject: Fix calculation of score for gateway and bridge problems. ......................................................................
Fix calculation of score for gateway and bridge problems. Because wrong casting lm['gateway'] and lm['bridge'] always received True value. Change-Id: Id750ef496ae1983be20b9bd61d5757fc37ba39b3 Bug-Url: https://bugzilla.redhat.com/1164557 Signed-off-by: Artyom Lukianov <aluki...@redhat.com> --- M ovirt_hosted_engine_ha/agent/hosted_engine.py M ovirt_hosted_engine_ha/agent/states.py 2 files changed, 9 insertions(+), 8 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-ha refs/changes/03/35203/1 diff --git a/ovirt_hosted_engine_ha/agent/hosted_engine.py b/ovirt_hosted_engine_ha/agent/hosted_engine.py index 7a48774..589446d 100644 --- a/ovirt_hosted_engine_ha/agent/hosted_engine.py +++ b/ovirt_hosted_engine_ha/agent/hosted_engine.py @@ -771,7 +771,9 @@ self._log.debug("Refreshing all submonitors") for field, monitor in self._local_monitors.iteritems(): ret = self._broker.get_monitor_status(monitor['id']) - if monitor['type'] is not None: + if ret == 'False': + ret = False + elif monitor['type'] is not None: ret = monitor['type'](ret) data["local"][field] = ret diff --git a/ovirt_hosted_engine_ha/agent/states.py b/ovirt_hosted_engine_ha/agent/states.py index 71c0540..90446a9 100644 --- a/ovirt_hosted_engine_ha/agent/states.py +++ b/ovirt_hosted_engine_ha/agent/states.py @@ -86,15 +86,14 @@ failed attempts, the host's score is set to 0 to give any lesser- suited hosts a chance. After ENGINE_RETRY_EXPIRATION_SECS seconds, this host's retry count will no longer be factored into the score. - If retries are still occurring amonst the HA hosts at that time, this + If retries are still occurring amongst the HA hosts at that time, this host will again have an opportunity to run the engine VM. Score weights: - 1000 - gateway address is pingable - 800 - host's management network bridge is up + 1600 - gateway address is pingable + 1000 - host's cpu load is less than 90% of capacity + 600 - host's management network bridge is up 400 - host has 4GB of memory free to run the engine VM - 100 - host's cpu load is less than 80% of capacity - 100 - host's memory usage is less than 80% of capacity Adjustments: -50 - subtraction for each failed start-vm retry attempt @@ -112,13 +111,13 @@ score = score_cfg['base-score'] # FIXME score needed for vdsm storage pool connection? # (depending on storage integration, may not be able to report...) - if lm['gateway'] == 'False': + if not lm['gateway']: logger.info("Penalizing score by %d due to gateway status", score_cfg['gateway-score-penalty'], extra=log_filter.lf_args('score-gateway', self.LF_PENALTY_INT)) score -= score_cfg['gateway-score-penalty'] - if lm['bridge'] == 'False': + if not lm['bridge']: logger.info("Penalizing score by %d due to mgmt bridge status", score_cfg['mgmt-bridge-score-penalty'], extra=log_filter.lf_args('score-mgmtbridge', -- To view, visit http://gerrit.ovirt.org/35203 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id750ef496ae1983be20b9bd61d5757fc37ba39b3 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-hosted-engine-ha Gerrit-Branch: master Gerrit-Owner: Artyom Lukianov <aluki...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches