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
This commit is contained in:
Kengo Takahara 2017-02-14 20:01:11 +09:00 committed by takahara.kengo
parent b3e4d97467
commit 16245388c4
1 changed files with 9 additions and 0 deletions

View File

@ -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