From 55c0787d00d678b2fbfc9e99a6e4b4ce5c9a82ca Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Mon, 15 Jun 2020 16:19:49 +0100
Subject: [PATCH] Remove max count from Cinder online schema migration

During an upgrade from Stein to Train, Kolla Ansible fails while running
TASK [cinder : Running Cinder online schema migration]

This is because the `--max_count 10` option is used, which returns 1
while migrations are processed. According to the upgrade documentation,
the command should be rerun while the exit status is 1:
https://docs.openstack.org/cinder/train/upgrade.html

This issue was introduced by a change to the image [1] which fixed a bug
in the way that the max count was interpreted, but exposed an issue in
using the max count.

This change fixes the issue by ceasing to pass MAX_NUMBER, which will
cause all migrations to occur in a single pass.

[1] https://review.opendev.org/#/c/712055

Change-Id: Ia786d037f5484f18294188639c956d4ed5ffbc2a
Closes-Bug: #1880753
---
 ansible/roles/cinder/defaults/main.yml                       | 4 ----
 ansible/roles/cinder/tasks/upgrade.yml                       | 1 -
 .../notes/fix-cinder-upgrade-max-count-ab928f85f224c63d.yaml | 5 +++++
 3 files changed, 5 insertions(+), 5 deletions(-)
 create mode 100644 releasenotes/notes/fix-cinder-upgrade-max-count-ab928f85f224c63d.yaml

diff --git a/ansible/roles/cinder/defaults/main.yml b/ansible/roles/cinder/defaults/main.yml
index b95da8aff..c30f97c98 100644
--- a/ansible/roles/cinder/defaults/main.yml
+++ b/ansible/roles/cinder/defaults/main.yml
@@ -56,10 +56,6 @@ cinder_database_name: "cinder"
 cinder_database_user: "{% if use_preconfigured_databases | bool and use_common_mariadb_user | bool %}{{ database_user }}{% else %}cinder{% endif %}"
 cinder_database_address: "{{ database_address | put_address_in_context('url') }}:{{ database_port }}"
 
-# Max number of object to consider
-# when run online data migration
-# cinder_max_number_osm: ""
-
 ####################
 # Docker
 ####################
diff --git a/ansible/roles/cinder/tasks/upgrade.yml b/ansible/roles/cinder/tasks/upgrade.yml
index 7f267399c..e29184b20 100644
--- a/ansible/roles/cinder/tasks/upgrade.yml
+++ b/ansible/roles/cinder/tasks/upgrade.yml
@@ -22,7 +22,6 @@
     environment:
       KOLLA_OSM:
       KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
-      MAX_NUMBER: "{{ cinder_max_number_osm | default(10) }}"
     image: "{{ cinder_api.image }}"
     labels:
       BOOTSTRAP:
diff --git a/releasenotes/notes/fix-cinder-upgrade-max-count-ab928f85f224c63d.yaml b/releasenotes/notes/fix-cinder-upgrade-max-count-ab928f85f224c63d.yaml
new file mode 100644
index 000000000..525f7e4a7
--- /dev/null
+++ b/releasenotes/notes/fix-cinder-upgrade-max-count-ab928f85f224c63d.yaml
@@ -0,0 +1,5 @@
+---
+fixes:
+  - |
+    Fixes an issue with Cinder upgrades that would cause online schema
+    migration to fail. `LP#1880753 <https://launchpad.net/bugs/1880753>`__
-- 
GitLab