From 972747671cd8897c422d881a37e8e04d1246c76d Mon Sep 17 00:00:00 2001
From: Riccardo Pittau <elfosardo@gmail.com>
Date: Wed, 30 Jan 2019 10:53:05 +0100
Subject: [PATCH] Removing deprecated drac_host property

Removes deprecated ``driver_info["drac_host"]`` property
for ``idrac`` hardware type.

Change-Id: I851f3a231246552a59e8c122c090489459220c74
---
 devstack/lib/ironic                           |  2 +-
 ironic/drivers/modules/drac/common.py         | 21 +---------------
 .../unit/drivers/modules/drac/test_common.py  | 25 -------------------
 ...deprecated-drac_host-865be09c6e8fcb90.yaml |  5 ++++
 4 files changed, 7 insertions(+), 46 deletions(-)
 create mode 100644 releasenotes/notes/remove-deprecated-drac_host-865be09c6e8fcb90.yaml

diff --git a/devstack/lib/ironic b/devstack/lib/ironic
index 6182e3011a..e10ef7e714 100644
--- a/devstack/lib/ironic
+++ b/devstack/lib/ironic
@@ -1945,7 +1945,7 @@ function enroll_nodes {
                     node_options+=" --driver-info ilo_deploy_iso=$IRONIC_DEPLOY_ISO_ID"
                 fi
             elif is_deployed_by_drac; then
-                node_options+=" --driver-info drac_host=$bmc_address \
+                node_options+=" --driver-info drac_address=$bmc_address \
                     --driver-info drac_password=$bmc_passwd \
                     --driver-info drac_username=$bmc_username"
             elif is_deployed_by_redfish; then
diff --git a/ironic/drivers/modules/drac/common.py b/ironic/drivers/modules/drac/common.py
index 3e4205a5a3..be4a3da246 100644
--- a/ironic/drivers/modules/drac/common.py
+++ b/ironic/drivers/modules/drac/common.py
@@ -39,13 +39,9 @@ OPTIONAL_PROPERTIES = {
     'drac_protocol': _('protocol used for WS-Man endpoint; one of http, https;'
                        ' default is "https". Optional.'),
 }
-DEPRECATED_PROPERTIES = {
-    'drac_host': _('IP address or hostname of the DRAC card. DEPRECATED, '
-                   'PLEASE USE "drac_address" INSTEAD.'),
-}
+
 COMMON_PROPERTIES = REQUIRED_PROPERTIES.copy()
 COMMON_PROPERTIES.update(OPTIONAL_PROPERTIES)
-COMMON_PROPERTIES.update(DEPRECATED_PROPERTIES)
 
 
 def parse_driver_info(node):
@@ -63,21 +59,6 @@ def parse_driver_info(node):
     driver_info = node.driver_info
     parsed_driver_info = {}
 
-    if 'drac_host' in driver_info and 'drac_address' not in driver_info:
-        LOG.warning('The driver_info["drac_host"] property is deprecated '
-                    'and will be removed in the Pike release. Please '
-                    'update the node %s driver_info field to use '
-                    '"drac_address" instead', node.uuid)
-        address = driver_info.pop('drac_host', None)
-        if address:
-            driver_info['drac_address'] = address
-    elif 'drac_host' in driver_info and 'drac_address' in driver_info:
-        LOG.warning('Both driver_info["drac_address"] and '
-                    'driver_info["drac_host"] properties are '
-                    'specified for node %s. Please remove the '
-                    '"drac_host" property from the node. Ignoring '
-                    '"drac_host" for now', node.uuid)
-
     error_msgs = []
     for param in REQUIRED_PROPERTIES:
         try:
diff --git a/ironic/tests/unit/drivers/modules/drac/test_common.py b/ironic/tests/unit/drivers/modules/drac/test_common.py
index f8eb47d62b..6863ed564c 100644
--- a/ironic/tests/unit/drivers/modules/drac/test_common.py
+++ b/ironic/tests/unit/drivers/modules/drac/test_common.py
@@ -40,31 +40,6 @@ class DracCommonMethodsTestCase(test_utils.BaseDracTest):
         self.assertEqual(INFO_DICT['drac_username'], info['drac_username'])
         self.assertEqual(INFO_DICT['drac_password'], info['drac_password'])
 
-    @mock.patch.object(drac_common.LOG, 'warning')
-    def test_parse_driver_info_drac_host(self, mock_log):
-        driver_info = db_utils.get_test_drac_info()
-        driver_info['drac_host'] = '4.5.6.7'
-        driver_info.pop('drac_address')
-        node = obj_utils.create_test_node(self.context,
-                                          driver='idrac',
-                                          driver_info=driver_info)
-        info = drac_common.parse_driver_info(node)
-        self.assertEqual('4.5.6.7', info['drac_address'])
-        self.assertNotIn('drac_host', info)
-        self.assertTrue(mock_log.called)
-
-    @mock.patch.object(drac_common.LOG, 'warning')
-    def test_parse_driver_info_drac_host_and_drac_address(self, mock_log):
-        driver_info = db_utils.get_test_drac_info()
-        driver_info['drac_host'] = '4.5.6.7'
-        node = obj_utils.create_test_node(self.context,
-                                          driver='idrac',
-                                          driver_info=driver_info)
-        info = drac_common.parse_driver_info(node)
-        self.assertEqual('4.5.6.7', driver_info['drac_host'])
-        self.assertEqual(driver_info['drac_address'], info['drac_address'])
-        self.assertTrue(mock_log.called)
-
     def test_parse_driver_info_missing_host(self):
         node = obj_utils.create_test_node(self.context,
                                           driver='idrac',
diff --git a/releasenotes/notes/remove-deprecated-drac_host-865be09c6e8fcb90.yaml b/releasenotes/notes/remove-deprecated-drac_host-865be09c6e8fcb90.yaml
new file mode 100644
index 0000000000..4f428b6488
--- /dev/null
+++ b/releasenotes/notes/remove-deprecated-drac_host-865be09c6e8fcb90.yaml
@@ -0,0 +1,5 @@
+---
+upgrade:
+  - Removes deprecated ``driver_info["drac_host"]`` property for
+    ``idrac`` hardware type that was marked for removal in Pike.
+    Please use ``driver_info["drac_address"]`` instead.