From 66b0bcfd0840a1c0e97c4337db8a8ad2c98f66a7 Mon Sep 17 00:00:00 2001
From: Joanna Taryma <joanna.taryma@intel.com>
Date: Fri, 10 Mar 2017 10:41:27 -0800
Subject: [PATCH] Remove overwriting the default value of db_max_retries.

Remove overwriting the default value of db_max_retries, instead use
default value defined by oslo.db which is 20.
Adjust the default value of db_max_retries in the release note and sample
configuration file.

Closes-Bug: #1671629
Change-Id: I1e5f632d687c1cebab895cc91958d502b9fce884
---
 etc/ironic/ironic.conf.sample                               | 2 +-
 ironic/conf/database.py                                     | 3 ---
 .../notes/add-db-deadlock-handling-6bc10076537f3727.yaml    | 6 ++----
 3 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/etc/ironic/ironic.conf.sample b/etc/ironic/ironic.conf.sample
index 973a6f76f5..d5e1196c27 100644
--- a/etc/ironic/ironic.conf.sample
+++ b/etc/ironic/ironic.conf.sample
@@ -1251,7 +1251,7 @@
 # Maximum retries in case of connection error or deadlock
 # error before error is raised. Set to -1 to specify an
 # infinite retry count. (integer value)
-#db_max_retries = 5
+#db_max_retries = 20
 
 
 [deploy]
diff --git a/ironic/conf/database.py b/ironic/conf/database.py
index b4aa6224b2..fccf2f437d 100644
--- a/ironic/conf/database.py
+++ b/ironic/conf/database.py
@@ -26,6 +26,3 @@ opts = [
 
 def register_opts(conf):
     conf.register_opts(opts, group='database')
-    # Change the oslo_db side default to 5
-    conf.import_opt('db_max_retries', 'ironic.db.api', group='database')
-    conf.set_default('db_max_retries', 5, group='database')
diff --git a/releasenotes/notes/add-db-deadlock-handling-6bc10076537f3727.yaml b/releasenotes/notes/add-db-deadlock-handling-6bc10076537f3727.yaml
index 138b0cea4c..dcf8f49431 100644
--- a/releasenotes/notes/add-db-deadlock-handling-6bc10076537f3727.yaml
+++ b/releasenotes/notes/add-db-deadlock-handling-6bc10076537f3727.yaml
@@ -5,10 +5,8 @@ fixes:
 features:
   - Adds DBDeadlock handling which may improve stability when using Galera.
     See https://bugs.launchpad.net/ironic/+bug/1639338. Number of retries
-    depends on the configuration option ``[database]db_max_retries`` which
-    programmatically defaults to 5.
+    depends on the configuration option ``[database]db_max_retries``.
 upgrade:
   - All DB API methods doing database writes now retry on deadlock. The
     ``[database]db_max_retries`` configuration option specifies the maximum
-    number of times to retry, and can be customised if necessary. It is 5 by
-    default.
+    number of times to retry, and can be customised if necessary.
\ No newline at end of file