Drop postgresql support
Remove postgresql DB support; This feature is untested as part of the charms, is not in use and was deprecated as part of the 1708 charms release. Change-Id: I866559f519ace3476e0cc85661d99e5f5491227d
This commit is contained in:
parent
0196625084
commit
5c79af1bd1
@ -7,13 +7,6 @@ to the nova-cloud-controller. If running in HA mode then the public vip is used
|
|||||||
to local. Note: The console access protocol is baked into a guest when it is created, if you change it then
|
to local. Note: The console access protocol is baked into a guest when it is created, if you change it then
|
||||||
console access for existing guests will stop working
|
console access for existing guests will stop working
|
||||||
|
|
||||||
**Special considerations to be deployed using Postgresql**
|
|
||||||
|
|
||||||
juju deploy nova-cloud-controller
|
|
||||||
juju deploy postgresql
|
|
||||||
juju add-relation "nova-cloud-controller:pgsql-nova-db" "postgresql:db"
|
|
||||||
juju add-relation "nova-cloud-controller:pgsql-neutron-db" "postgresql:db"
|
|
||||||
|
|
||||||
## HA/Clustering
|
## HA/Clustering
|
||||||
|
|
||||||
There are two mutually exclusive high availability options: using virtual
|
There are two mutually exclusive high availability options: using virtual
|
||||||
|
@ -167,7 +167,7 @@ options:
|
|||||||
.
|
.
|
||||||
For this charm the following relations must be made:
|
For this charm the following relations must be made:
|
||||||
.
|
.
|
||||||
* shared-db or (pgsql-nova-db, pgsql-neutron-db)
|
* shared-db
|
||||||
* amqp
|
* amqp
|
||||||
* identity-service
|
* identity-service
|
||||||
console-access-protocol:
|
console-access-protocol:
|
||||||
|
@ -264,18 +264,6 @@ class IdentityServiceContext(context.IdentityServiceContext):
|
|||||||
return ctxt
|
return ctxt
|
||||||
|
|
||||||
|
|
||||||
class NovaPostgresqlDBContext(context.PostgresqlDBContext):
|
|
||||||
interfaces = ['pgsql-nova-db']
|
|
||||||
|
|
||||||
|
|
||||||
class NeutronPostgresqlDBContext(context.PostgresqlDBContext):
|
|
||||||
interfaces = ['pgsql-neutron-db']
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
super(NeutronPostgresqlDBContext,
|
|
||||||
self).__init__(config('neutron-database'))
|
|
||||||
|
|
||||||
|
|
||||||
class NovaConfigContext(context.WorkerConfigContext):
|
class NovaConfigContext(context.WorkerConfigContext):
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
ctxt = super(NovaConfigContext, self).__call__()
|
ctxt = super(NovaConfigContext, self).__call__()
|
||||||
|
@ -35,7 +35,6 @@ from charmhelpers.core.hookenv import (
|
|||||||
log,
|
log,
|
||||||
local_unit,
|
local_unit,
|
||||||
DEBUG,
|
DEBUG,
|
||||||
ERROR,
|
|
||||||
WARNING,
|
WARNING,
|
||||||
relation_get,
|
relation_get,
|
||||||
relation_ids,
|
relation_ids,
|
||||||
@ -209,16 +208,11 @@ def leader_init_db_if_ready_allowed_units():
|
|||||||
be passed to leader_init_db_if_ready(), enabling use of allowed_units
|
be passed to leader_init_db_if_ready(), enabling use of allowed_units
|
||||||
to determine if this nova-cc unit is allowed to perform db init.
|
to determine if this nova-cc unit is allowed to perform db init.
|
||||||
"""
|
"""
|
||||||
rels = ['shared-db', 'pgsql-nova-db']
|
rels = ['shared-db']
|
||||||
for rname in rels:
|
for rname in rels:
|
||||||
for rid in relation_ids(rname):
|
for rid in relation_ids(rname):
|
||||||
for unit in related_units(rid):
|
for unit in related_units(rid):
|
||||||
if rname == 'pgsql-nova-db':
|
leader_init_db_if_ready(db_rid=rid, unit=unit)
|
||||||
leader_init_db_if_ready(skip_acl_check=True,
|
|
||||||
skip_cells_restarts=True,
|
|
||||||
db_rid=rid, unit=unit)
|
|
||||||
else:
|
|
||||||
leader_init_db_if_ready(db_rid=rid, unit=unit)
|
|
||||||
|
|
||||||
|
|
||||||
def update_cell_db_if_ready(skip_acl_check=False, db_rid=None, unit=None):
|
def update_cell_db_if_ready(skip_acl_check=False, db_rid=None, unit=None):
|
||||||
@ -249,15 +243,11 @@ def update_cell_db_if_ready_allowed_units():
|
|||||||
be passed to update_cell_db_if_ready(), enabling use of allowed_units
|
be passed to update_cell_db_if_ready(), enabling use of allowed_units
|
||||||
to determine if this nova-cc unit is allowed to perform db updates.
|
to determine if this nova-cc unit is allowed to perform db updates.
|
||||||
"""
|
"""
|
||||||
rels = ['shared-db', 'pgsql-nova-db']
|
rels = ['shared-db']
|
||||||
for rname in rels:
|
for rname in rels:
|
||||||
for rid in relation_ids(rname):
|
for rid in relation_ids(rname):
|
||||||
for unit in related_units(rid):
|
for unit in related_units(rid):
|
||||||
if rname == 'pgsql-nova-db':
|
update_cell_db_if_ready(db_rid=rid, unit=unit)
|
||||||
update_cell_db_if_ready(skip_acl_check=True,
|
|
||||||
db_rid=rid, unit=unit)
|
|
||||||
else:
|
|
||||||
update_cell_db_if_ready(db_rid=rid, unit=unit)
|
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('install.real')
|
@hooks.hook('install.real')
|
||||||
@ -393,14 +383,6 @@ def amqp_changed():
|
|||||||
|
|
||||||
@hooks.hook('shared-db-relation-joined')
|
@hooks.hook('shared-db-relation-joined')
|
||||||
def db_joined(relation_id=None):
|
def db_joined(relation_id=None):
|
||||||
if is_relation_made('pgsql-nova-db') or \
|
|
||||||
is_relation_made('pgsql-neutron-db'):
|
|
||||||
# error, postgresql is used
|
|
||||||
e = ('Attempting to associate a mysql database when there is already '
|
|
||||||
'associated a postgresql one')
|
|
||||||
log(e, level=ERROR)
|
|
||||||
raise Exception(e)
|
|
||||||
|
|
||||||
cmp_os_release = CompareOpenStackReleases(os_release('nova-common'))
|
cmp_os_release = CompareOpenStackReleases(os_release('nova-common'))
|
||||||
if config('prefer-ipv6'):
|
if config('prefer-ipv6'):
|
||||||
sync_db_with_multi_ipv6_addresses(config('database'),
|
sync_db_with_multi_ipv6_addresses(config('database'),
|
||||||
@ -448,18 +430,6 @@ def db_joined(relation_id=None):
|
|||||||
relation_id=relation_id)
|
relation_id=relation_id)
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('pgsql-nova-db-relation-joined')
|
|
||||||
def pgsql_nova_db_joined():
|
|
||||||
if is_relation_made('shared-db'):
|
|
||||||
# raise error
|
|
||||||
e = ('Attempting to associate a postgresql database'
|
|
||||||
' when there is already associated a mysql one')
|
|
||||||
log(e, level=ERROR)
|
|
||||||
raise Exception(e)
|
|
||||||
|
|
||||||
relation_set(database=config('database'))
|
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('shared-db-relation-changed')
|
@hooks.hook('shared-db-relation-changed')
|
||||||
@service_guard(guard_map(), CONFIGS,
|
@service_guard(guard_map(), CONFIGS,
|
||||||
active=config('service-guard'))
|
active=config('service-guard'))
|
||||||
@ -477,23 +447,6 @@ def db_changed():
|
|||||||
update_cell_db_if_ready()
|
update_cell_db_if_ready()
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('pgsql-nova-db-relation-changed')
|
|
||||||
@service_guard(guard_map(), CONFIGS,
|
|
||||||
active=config('service-guard'))
|
|
||||||
@restart_on_change(restart_map())
|
|
||||||
def postgresql_nova_db_changed():
|
|
||||||
if 'pgsql-nova-db' not in CONFIGS.complete_contexts():
|
|
||||||
log('pgsql-nova-db relation incomplete. Peer not ready?')
|
|
||||||
return
|
|
||||||
|
|
||||||
CONFIGS.write_all()
|
|
||||||
leader_init_db_if_ready(skip_acl_check=True, skip_cells_restarts=True)
|
|
||||||
update_cell_db_if_ready(skip_acl_check=True)
|
|
||||||
|
|
||||||
for r_id in relation_ids('nova-api'):
|
|
||||||
nova_api_relation_joined(rid=r_id)
|
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('image-service-relation-changed')
|
@hooks.hook('image-service-relation-changed')
|
||||||
@service_guard(guard_map(), CONFIGS,
|
@service_guard(guard_map(), CONFIGS,
|
||||||
active=config('service-guard'))
|
active=config('service-guard'))
|
||||||
@ -922,8 +875,7 @@ def ha_changed():
|
|||||||
update_nova_consoleauth_config()
|
update_nova_consoleauth_config()
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('shared-db-relation-broken',
|
@hooks.hook('shared-db-relation-broken')
|
||||||
'pgsql-nova-db-relation-broken')
|
|
||||||
@service_guard(guard_map(), CONFIGS,
|
@service_guard(guard_map(), CONFIGS,
|
||||||
active=config('service-guard'))
|
active=config('service-guard'))
|
||||||
def db_departed():
|
def db_departed():
|
||||||
@ -940,7 +892,6 @@ def db_departed():
|
|||||||
'identity-service-relation-broken',
|
'identity-service-relation-broken',
|
||||||
'image-service-relation-broken',
|
'image-service-relation-broken',
|
||||||
'nova-volume-service-relation-broken',
|
'nova-volume-service-relation-broken',
|
||||||
'pgsql-neutron-db-relation-broken',
|
|
||||||
'quantum-network-service-relation-broken')
|
'quantum-network-service-relation-broken')
|
||||||
@service_guard(guard_map(), CONFIGS,
|
@service_guard(guard_map(), CONFIGS,
|
||||||
active=config('service-guard'))
|
active=config('service-guard'))
|
||||||
|
@ -122,8 +122,8 @@ CLUSTER_RES = 'grp_nova_vips'
|
|||||||
# The interface is said to be satisfied if anyone of the interfaces in the
|
# The interface is said to be satisfied if anyone of the interfaces in the
|
||||||
# list has a complete context.
|
# list has a complete context.
|
||||||
REQUIRED_INTERFACES = {
|
REQUIRED_INTERFACES = {
|
||||||
'database': ['shared-db', 'pgsql-db'],
|
'database': ['shared-db'],
|
||||||
'messaging': ['amqp', 'zeromq-configuration'],
|
'messaging': ['amqp'],
|
||||||
'identity': ['identity-service'],
|
'identity': ['identity-service'],
|
||||||
'image': ['image-service'],
|
'image': ['image-service'],
|
||||||
'compute': ['nova-compute'],
|
'compute': ['nova-compute'],
|
||||||
@ -244,7 +244,6 @@ BASE_RESOURCE_MAP = OrderedDict([
|
|||||||
context.OSConfigFlagContext(
|
context.OSConfigFlagContext(
|
||||||
charm_flag='nova-alchemy-flags',
|
charm_flag='nova-alchemy-flags',
|
||||||
template_flag='nova_alchemy_flags'),
|
template_flag='nova_alchemy_flags'),
|
||||||
nova_cc_context.NovaPostgresqlDBContext(),
|
|
||||||
context.ImageServiceContext(),
|
context.ImageServiceContext(),
|
||||||
context.OSConfigFlagContext(),
|
context.OSConfigFlagContext(),
|
||||||
context.SubordinateConfigContext(
|
context.SubordinateConfigContext(
|
||||||
@ -1166,10 +1165,7 @@ def guard_map():
|
|||||||
nova_services.append('nova-conductor')
|
nova_services.append('nova-conductor')
|
||||||
|
|
||||||
nova_interfaces = ['identity-service', 'amqp']
|
nova_interfaces = ['identity-service', 'amqp']
|
||||||
if relation_ids('pgsql-nova-db'):
|
nova_interfaces.append('shared-db')
|
||||||
nova_interfaces.append('pgsql-nova-db')
|
|
||||||
else:
|
|
||||||
nova_interfaces.append('shared-db')
|
|
||||||
|
|
||||||
for svc in nova_services:
|
for svc in nova_services:
|
||||||
gmap[svc] = nova_interfaces
|
gmap[svc] = nova_interfaces
|
||||||
|
@ -1 +0,0 @@
|
|||||||
nova_cc_hooks.py
|
|
@ -1 +0,0 @@
|
|||||||
nova_cc_hooks.py
|
|
@ -1 +0,0 @@
|
|||||||
nova_cc_hooks.py
|
|
@ -1 +0,0 @@
|
|||||||
nova_cc_hooks.py
|
|
@ -1 +0,0 @@
|
|||||||
nova_cc_hooks.py
|
|
@ -1 +0,0 @@
|
|||||||
nova_cc_hooks.py
|
|
@ -33,8 +33,6 @@ provides:
|
|||||||
requires:
|
requires:
|
||||||
shared-db:
|
shared-db:
|
||||||
interface: mysql-shared
|
interface: mysql-shared
|
||||||
pgsql-nova-db:
|
|
||||||
interface: pgsql
|
|
||||||
amqp:
|
amqp:
|
||||||
interface: rabbitmq
|
interface: rabbitmq
|
||||||
image-service:
|
image-service:
|
||||||
|
@ -537,29 +537,6 @@ class NovaCCHooksTests(CharmTestCase):
|
|||||||
hooks.identity_joined()
|
hooks.identity_joined()
|
||||||
self.assertFalse(self.relation_set.called)
|
self.assertFalse(self.relation_set.called)
|
||||||
|
|
||||||
def test_postgresql_nova_db_joined(self):
|
|
||||||
self.is_relation_made.return_value = False
|
|
||||||
hooks.pgsql_nova_db_joined()
|
|
||||||
self.relation_set.assert_called_with(database='nova')
|
|
||||||
|
|
||||||
def test_db_joined_with_postgresql(self):
|
|
||||||
self.is_relation_made.return_value = True
|
|
||||||
|
|
||||||
with self.assertRaises(Exception) as context:
|
|
||||||
hooks.db_joined()
|
|
||||||
self.assertEqual(context.exception.message,
|
|
||||||
'Attempting to associate a mysql database when'
|
|
||||||
' there is already associated a postgresql one')
|
|
||||||
|
|
||||||
def test_postgresql_nova_joined_with_db(self):
|
|
||||||
self.is_relation_made.return_value = True
|
|
||||||
|
|
||||||
with self.assertRaises(Exception) as context:
|
|
||||||
hooks.pgsql_nova_db_joined()
|
|
||||||
self.assertEqual(context.exception.message,
|
|
||||||
'Attempting to associate a postgresql database when'
|
|
||||||
' there is already associated a mysql one')
|
|
||||||
|
|
||||||
@patch.object(hooks, 'CONFIGS')
|
@patch.object(hooks, 'CONFIGS')
|
||||||
def test_db_changed_missing_relation_data(self, configs):
|
def test_db_changed_missing_relation_data(self, configs):
|
||||||
configs.complete_contexts = MagicMock()
|
configs.complete_contexts = MagicMock()
|
||||||
@ -569,27 +546,12 @@ class NovaCCHooksTests(CharmTestCase):
|
|||||||
'shared-db relation incomplete. Peer not ready?'
|
'shared-db relation incomplete. Peer not ready?'
|
||||||
)
|
)
|
||||||
|
|
||||||
@patch.object(hooks, 'CONFIGS')
|
|
||||||
def test_postgresql_nova_db_changed_missing_relation_data(self, configs):
|
|
||||||
configs.complete_contexts = MagicMock()
|
|
||||||
configs.complete_contexts.return_value = []
|
|
||||||
hooks.postgresql_nova_db_changed()
|
|
||||||
self.log.assert_called_with(
|
|
||||||
'pgsql-nova-db relation incomplete. Peer not ready?'
|
|
||||||
)
|
|
||||||
|
|
||||||
def _shared_db_test(self, configs):
|
def _shared_db_test(self, configs):
|
||||||
configs.complete_contexts = MagicMock()
|
configs.complete_contexts = MagicMock()
|
||||||
configs.complete_contexts.return_value = ['shared-db']
|
configs.complete_contexts.return_value = ['shared-db']
|
||||||
configs.write = MagicMock()
|
configs.write = MagicMock()
|
||||||
hooks.db_changed()
|
hooks.db_changed()
|
||||||
|
|
||||||
def _postgresql_db_test(self, configs):
|
|
||||||
configs.complete_contexts = MagicMock()
|
|
||||||
configs.complete_contexts.return_value = ['pgsql-nova-db']
|
|
||||||
configs.write = MagicMock()
|
|
||||||
hooks.postgresql_nova_db_changed()
|
|
||||||
|
|
||||||
@patch.object(hooks, 'nova_api_relation_joined')
|
@patch.object(hooks, 'nova_api_relation_joined')
|
||||||
@patch.object(hooks, 'is_db_initialised')
|
@patch.object(hooks, 'is_db_initialised')
|
||||||
@patch.object(hooks, 'CONFIGS')
|
@patch.object(hooks, 'CONFIGS')
|
||||||
@ -637,28 +599,6 @@ class NovaCCHooksTests(CharmTestCase):
|
|||||||
self.assertTrue(configs.write_all.called)
|
self.assertTrue(configs.write_all.called)
|
||||||
self.assertFalse(self.migrate_nova_databases.called)
|
self.assertFalse(self.migrate_nova_databases.called)
|
||||||
|
|
||||||
@patch.object(utils, 'is_leader')
|
|
||||||
@patch.object(utils, 'os_release')
|
|
||||||
@patch.object(hooks, 'quantum_joined')
|
|
||||||
@patch.object(hooks, 'nova_api_relation_joined')
|
|
||||||
@patch.object(hooks, 'is_db_initialised')
|
|
||||||
@patch.object(hooks, 'CONFIGS')
|
|
||||||
def test_postgresql_db_changed(self, configs, mock_is_db_initialised,
|
|
||||||
api_joined, quantum_joined,
|
|
||||||
utils_os_release, utils_is_leader):
|
|
||||||
self.relation_ids.side_effect = [
|
|
||||||
[],
|
|
||||||
['neutron-gateway/0'],
|
|
||||||
['nova-api/0']]
|
|
||||||
mock_is_db_initialised.return_value = False
|
|
||||||
self.os_release.return_value = 'diablo'
|
|
||||||
utils_os_release.return_value = 'diablo'
|
|
||||||
utils_is_leader.return_value = True
|
|
||||||
self._postgresql_db_test(configs)
|
|
||||||
self.assertTrue(configs.write_all.called)
|
|
||||||
self.migrate_nova_databases.assert_called_with()
|
|
||||||
api_joined.assert_called_with(rid='nova-api/0')
|
|
||||||
|
|
||||||
@patch.object(utils, 'is_leader')
|
@patch.object(utils, 'is_leader')
|
||||||
@patch.object(utils, 'os_release')
|
@patch.object(utils, 'os_release')
|
||||||
@patch.object(hooks, 'quantum_joined')
|
@patch.object(hooks, 'quantum_joined')
|
||||||
|
@ -883,24 +883,6 @@ class NovaCCUtilsTests(CharmTestCase):
|
|||||||
utils.guard_map()
|
utils.guard_map()
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_guard_map_pgsql(self):
|
|
||||||
self.relation_ids.return_value = ['pgsql:1']
|
|
||||||
self.os_release.return_value = 'icehouse'
|
|
||||||
self.assertEqual(
|
|
||||||
{'nova-api-ec2': ['identity-service', 'amqp', 'pgsql-nova-db'],
|
|
||||||
'nova-api-os-compute': ['identity-service', 'amqp',
|
|
||||||
'pgsql-nova-db'],
|
|
||||||
'nova-cert': ['identity-service', 'amqp', 'pgsql-nova-db'],
|
|
||||||
'nova-conductor': ['identity-service', 'amqp', 'pgsql-nova-db'],
|
|
||||||
'nova-objectstore': ['identity-service', 'amqp',
|
|
||||||
'pgsql-nova-db'],
|
|
||||||
'nova-placement-api': ['identity-service', 'amqp',
|
|
||||||
'pgsql-nova-db'],
|
|
||||||
'nova-scheduler': ['identity-service', 'amqp',
|
|
||||||
'pgsql-nova-db'], },
|
|
||||||
utils.guard_map()
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_service_guard_inactive(self):
|
def test_service_guard_inactive(self):
|
||||||
'''Ensure that if disabled, service guards nothing'''
|
'''Ensure that if disabled, service guards nothing'''
|
||||||
contexts = MagicMock()
|
contexts = MagicMock()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user