From dd5bc11622d66e1d9c669c35ef5770247ff37e37 Mon Sep 17 00:00:00 2001 From: Liam Young Date: Mon, 18 Apr 2016 12:27:35 +0000 Subject: [PATCH] No db stamp for upgrade from Liberty Stamping the Neutron db for Liberty fails and appears to be unneccesary. Change-Id: I93ff69db57bc3418a4c73e79e884f5c85d533f99 Closes-Bug: 1536675 --- hooks/neutron_api_utils.py | 4 +++- unit_tests/test_neutron_api_utils.py | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/hooks/neutron_api_utils.py b/hooks/neutron_api_utils.py index fd1a6695..02120d60 100755 --- a/hooks/neutron_api_utils.py +++ b/hooks/neutron_api_utils.py @@ -426,7 +426,9 @@ def do_openstack_upgrade(configs): configs.set_release(openstack_release=new_os_rel) # Before kilo it's nova-cloud-controllers job if is_elected_leader(CLUSTER_RES): - stamp_neutron_database(cur_os_rel) + # Stamping seems broken and unnecessary in liberty (Bug #1536675) + if os_release('neutron-common') < 'liberty': + stamp_neutron_database(cur_os_rel) migrate_neutron_database() diff --git a/unit_tests/test_neutron_api_utils.py b/unit_tests/test_neutron_api_utils.py index 1acad2af..345058ae 100644 --- a/unit_tests/test_neutron_api_utils.py +++ b/unit_tests/test_neutron_api_utils.py @@ -292,6 +292,25 @@ class TestNeutronAPIUtils(CharmTestCase): stamp_neutron_db.assert_called_with('icehouse') migrate_neutron_db.assert_called_with() + @patch.object(charmhelpers.contrib.openstack.utils, + 'get_os_codename_install_source') + @patch.object(nutils, 'migrate_neutron_database') + @patch.object(nutils, 'stamp_neutron_database') + @patch.object(nutils, 'git_install_requested') + def test_do_openstack_upgrade_liberty(self, git_requested, + stamp_neutron_db, migrate_neutron_db, + gsrc): + git_requested.return_value = False + self.is_elected_leader.return_value = True + self.os_release.return_value = 'liberty' + self.config.side_effect = self.test_config.get + self.test_config.set('openstack-origin', 'cloud:trusty-mitaka') + gsrc.return_value = 'mitaka' + self.get_os_codename_install_source.return_value = 'mitaka' + configs = MagicMock() + nutils.do_openstack_upgrade(configs) + self.assertFalse(stamp_neutron_db.called) + @patch.object(charmhelpers.contrib.openstack.utils, 'get_os_codename_install_source') @patch.object(nutils, 'migrate_neutron_database')