From 16245388c480d7d297d98df810a0aa8ea3a88438 Mon Sep 17 00:00:00 2001 From: Kengo Takahara Date: Tue, 14 Feb 2017 20:01:11 +0900 Subject: [PATCH] Skip notification retry processing when HTTP status is 409 If the HTTP status of the notification is 409, monitors should not retry notification processing. This patch modified to skip the notification retry processing if the monitors receives 409 HTTP status. Since this problem exists only in the monitors implemented with python, no need to modify the monitors implemented with bash shell script. Change-Id: I267c5676a5057d5d7a8e0ef718ea01c914c9a99d Closes-Bug: #1664498 --- masakarimonitors/ha/masakari.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/masakarimonitors/ha/masakari.py b/masakarimonitors/ha/masakari.py index c9f2079..8516b6f 100644 --- a/masakarimonitors/ha/masakari.py +++ b/masakarimonitors/ha/masakari.py @@ -14,6 +14,7 @@ import eventlet from openstack import connection +from openstack import exceptions from openstack import profile from oslo_log import log as oslo_logging @@ -96,6 +97,14 @@ class SendNotification(object): break except Exception as e: + if isinstance(e, exceptions.HttpException): + # If http_status is 409, skip the retry processing. + if e.http_status == 409: + msg = ("Stop retrying to send a notification because " + "same notification have been already sent.") + LOG.info(_LI("%s"), msg) + break + if retry_count < api_retry_max: LOG.warning(_LW("Retry sending a notification. (%s)"), e) retry_count = retry_count + 1