Do not run db migration on Icehouse
The neutron-server process performs the db migration on icehouse so check the Openstack version before running it Closes-Bug: 1571782 Change-Id: Ib9a57eea296a3116c69551c057f1cf9093ac93a8
This commit is contained in:
parent
dd5bc11622
commit
7b6e6e9b6e
@ -118,6 +118,10 @@ CONFIGS = register_configs()
|
||||
|
||||
|
||||
def conditional_neutron_migration():
|
||||
if os_release('neutron-server') <= 'icehouse':
|
||||
log('Not running neutron database migration as migrations are handled '
|
||||
'by the neutron-server process.')
|
||||
return
|
||||
if is_elected_leader(CLUSTER_RES):
|
||||
allowed_units = relation_get('allowed_units')
|
||||
if allowed_units and local_unit() in allowed_units.split():
|
||||
|
@ -863,11 +863,21 @@ class NeutronAPIHooksTests(CharmTestCase):
|
||||
})
|
||||
self.local_unit.return_value = 'neutron-api/1'
|
||||
self.is_elected_leader.return_value = True
|
||||
self.os_release.return_value = 'icehouse'
|
||||
self.os_release.return_value = 'kilo'
|
||||
hooks.conditional_neutron_migration()
|
||||
self.migrate_neutron_database.assert_called_with()
|
||||
self.service_restart.assert_called_with('neutron-server')
|
||||
|
||||
def test_conditional_neutron_migration_leader_icehouse(self):
|
||||
self.test_relation.set({
|
||||
'allowed_units': 'neutron-api/0 neutron-api/1 neutron-api/4',
|
||||
})
|
||||
self.local_unit.return_value = 'neutron-api/1'
|
||||
self.is_elected_leader.return_value = True
|
||||
self.os_release.return_value = 'icehouse'
|
||||
hooks.conditional_neutron_migration()
|
||||
self.assertFalse(self.migrate_neutron_database.called)
|
||||
|
||||
def test_conditional_neutron_migration_notleader(self):
|
||||
self.is_elected_leader.return_value = False
|
||||
self.os_release.return_value = 'icehouse'
|
||||
|
Loading…
Reference in New Issue
Block a user