From 950bcb165f76897f4314cb2b857af9a97a528864 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Mon, 24 Dec 2018 14:35:31 +0000 Subject: [PATCH] Perform ironic online data migrations prior to seed upgrade Bifrost does not perform ironic online data migrations after upgrading. This can lead to the following error during kayobe seed service upgrade: The database is not compatible with this release of ironic (10.1.7). Please run "ironic-dbsync online_data_migrations" using the previous release. As a workaround, perform the migrations in kayobe, prior to performing the upgrade. Change-Id: I8951242ba40158c26e85377254d19085d85cf753 Story: 2004308 Task: 28657 --- ansible/seed-service-upgrade-prep.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ansible/seed-service-upgrade-prep.yml b/ansible/seed-service-upgrade-prep.yml index acdb515e7..ce7001e94 100644 --- a/ansible/seed-service-upgrade-prep.yml +++ b/ansible/seed-service-upgrade-prep.yml @@ -30,3 +30,19 @@ become: true when: not ipa_build_images | bool + + # Bifrost does not perform ironic's online data migrations, which can + # prevent upgrading the database. If the upgrade fails early on, then the + # ironic config file may not exist. On subsequent attempts, this would + # cause the migrations to fail, so skip online migrations if ironic.conf + # doesn't exist. + # TODO: If the ironic config file does exist, we need to check + # the return code, since 2 means that the DB is not compatible + - name: Perform ironic online data migrations + command: > + docker exec bifrost_deploy + bash -c ' + if [[ -f /etc/ironic/ironic.conf ]]; then + ironic-dbsync online_data_migrations + fi' + changed_when: true