From f0aae6b8bc468ebb136f80374cfd3fce3c65b2d7 Mon Sep 17 00:00:00 2001
From: Pierre Riteau <pierre@stackhpc.com>
Date: Fri, 9 Jul 2021 17:28:46 +0200
Subject: [PATCH] Remove iscsi deploy interface

The iscsi deploy interface was removed from Ironic [1]. Switch to the
direct deploy interface instead, which is the default.

[1] https://review.opendev.org/c/openstack/ironic/+/789382

Depends-On: https://review.opendev.org/c/openstack/kolla-ansible/+/801267
Change-Id: Ia0dcd3d302e0f04adbda4f3abf75a0ca7dd20dee
---
 ansible/group_vars/all/ironic                      |  3 +--
 dev/functions                                      |  4 +---
 playbooks/kayobe-overcloud-upgrade-base/run.yml    | 14 +++++++++++++-
 .../remove-ironic-iscsi-cb15bec4e494b62c.yaml      | 11 +++++++++++
 4 files changed, 26 insertions(+), 6 deletions(-)
 create mode 100644 releasenotes/notes/remove-ironic-iscsi-cb15bec4e494b62c.yaml

diff --git a/ansible/group_vars/all/ironic b/ansible/group_vars/all/ironic
index f9683609..3a50debc 100644
--- a/ansible/group_vars/all/ironic
+++ b/ansible/group_vars/all/ironic
@@ -34,11 +34,10 @@ kolla_ironic_default_console_interface: ipmitool-socat
 # Specify the list of deploy interfaces to load during service initialization.
 kolla_ironic_enabled_deploy_interfaces:
   - direct
-  - iscsi
 
 # Default deploy interface to be used for nodes that do not have
 # deploy_interface field set.
-kolla_ironic_default_deploy_interface: iscsi
+kolla_ironic_default_deploy_interface: direct
 
 # Specify the list of inspect interfaces to load during service initialization.
 kolla_ironic_enabled_inspect_interfaces:
diff --git a/dev/functions b/dev/functions
index 7833a97f..147477a1 100644
--- a/dev/functions
+++ b/dev/functions
@@ -813,9 +813,7 @@ function configure_iptables {
     sudo iptables -I INPUT -d $INTERNAL_VIP -p tcp --dport ${SWIFT_DEFAULT_BIND_PORT:-8080} -j ACCEPT || true
     sudo iptables -I INPUT -d $INTERNAL_VIP -p tcp --dport $GLANCE_SERVICE_PORT -j ACCEPT || true
 
-    if is_ipxe_enabled; then
-        sudo iptables -I INPUT -d $HOST_IP -p tcp --dport $IRONIC_HTTP_PORT -j ACCEPT || true
-    fi
+    sudo iptables -I INPUT -d $HOST_IP -p tcp --dport $IRONIC_HTTP_PORT -j ACCEPT || true
 
     if is_cinder_enabled; then
         sudo iptables -I INPUT -d $HOST_IP -p tcp --dport $ISCSI_SERVICE_PORT -j ACCEPT || true
diff --git a/playbooks/kayobe-overcloud-upgrade-base/run.yml b/playbooks/kayobe-overcloud-upgrade-base/run.yml
index a149215e..23621a19 100644
--- a/playbooks/kayobe-overcloud-upgrade-base/run.yml
+++ b/playbooks/kayobe-overcloud-upgrade-base/run.yml
@@ -16,7 +16,9 @@
           # be run after install.
           shell:
             cmd: dev/configure-firewall.sh
-            chdir: "{{ previous_kayobe_src_dir }}"
+            # TODO(mgoddard): Use the previous repo when the previous release
+            # is no longer Wallaby.
+            chdir: "{{ kayobe_src_dir }}"
 
         - name: Ensure overcloud is deployed
           shell:
@@ -87,6 +89,16 @@
             cmd: "docker image prune --all --force"
           become: true
 
+        # TODO(mgoddard): Remove this task when the previous release is no
+        # longer Wallaby.
+        - name: Switch ironic nodes deploy interface to direct
+          shell:
+            cmd: >-
+              source ~/tenks-venv/bin/activate &&
+              source {{ kayobe_config_src_dir }}/etc/kolla/public-openrc.sh &&
+              openstack baremetal node set tk0 --deploy-interface direct &&
+              openstack baremetal node set tk1 --deploy-interface direct
+
         # Perform a smoke test against the upgraded current release.
 
         - name: Perform testing of VMs in the upgraded overcloud
diff --git a/releasenotes/notes/remove-ironic-iscsi-cb15bec4e494b62c.yaml b/releasenotes/notes/remove-ironic-iscsi-cb15bec4e494b62c.yaml
new file mode 100644
index 00000000..aadb7398
--- /dev/null
+++ b/releasenotes/notes/remove-ironic-iscsi-cb15bec4e494b62c.yaml
@@ -0,0 +1,11 @@
+---
+upgrade:
+  - |
+    Removes the ``iscsi`` interface from
+    ``kolla_ironic_enabled_deploy_interfaces``, and changes
+    ``kolla_ironic_default_deploy_interface`` to ``direct``. This is in line
+    with upstream changes in Ironic during the Xena cycle, in which the
+    ``iscsi`` deploy driver was removed.
+
+    Existing nodes using the ``iscsi`` deploy driver should be updated to an
+    alternative such as ``direct`` before upgrading.
-- 
GitLab