Remove databases relation

Since Icehouse nova-compute does not need to access to a database, all
accesses are made through nova-conductor.

This patch removes shared-db relation and their hook handler.

Change-Id: I7c4f6a70785d7dad1727d52cf86508209849ca35
Closes-Bug: 1713807
This commit is contained in:
Felipe Reyes 2017-10-02 17:59:34 -03:00
parent f751b88746
commit 584a8414fe
8 changed files with 2 additions and 106 deletions

View File

@ -261,23 +261,6 @@ def amqp_changed():
CONFIGS.write(NOVA_CONF)
@hooks.hook('shared-db-relation-joined')
def db_joined(rid=None):
relation_set(relation_id=rid,
nova_database=config('database'),
nova_username=config('database-user'),
nova_hostname=get_relation_ip('shared-db'))
@hooks.hook('shared-db-relation-changed')
@restart_on_change(restart_map())
def db_changed():
if 'shared-db' not in CONFIGS.complete_contexts():
log('shared-db relation incomplete. Peer not ready?')
return
CONFIGS.write(NOVA_CONF)
@hooks.hook('image-service-relation-changed')
@restart_on_change(restart_map())
def image_service_changed():
@ -405,9 +388,7 @@ def ceph_broken():
CONFIGS.write_all()
@hooks.hook('amqp-relation-broken',
'image-service-relation-broken',
'shared-db-relation-broken')
@hooks.hook('amqp-relation-broken', 'image-service-relation-broken')
@restart_on_change(restart_map())
def relation_broken():
CONFIGS.write_all()

View File

@ -733,10 +733,9 @@ def get_optional_relations():
optional_interfaces['storage-backend'] = ['ceph']
if relation_ids('neutron-plugin'):
optional_interfaces['neutron-plugin'] = ['neutron-plugin']
if relation_ids('shared-db'):
optional_interfaces['database'] = ['shared-db']
if config('encrypt'):
optional_interfaces['vault'] = ['secrets-storage']
return optional_interfaces

View File

@ -24,8 +24,6 @@ provides:
extra-bindings:
internal:
requires:
shared-db:
interface: mysql-shared
amqp:
interface: rabbitmq
image-service:

View File

@ -31,8 +31,6 @@ auth_strategy=keystone
compute_driver=libvirt.LibvirtDriver
my_ip = {{ host_ip }}
{% include "parts/database" %}
{% include "parts/rabbitmq" %}
{% if glance_api_servers -%}

View File

@ -31,8 +31,6 @@ auth_strategy=keystone
compute_driver=libvirt.LibvirtDriver
my_ip = {{ host_ip }}
{% include "parts/database" %}
{% include "parts/rabbitmq" %}
{% if glance_api_servers -%}

View File

@ -1,3 +0,0 @@
{% if database_host -%}
sql_connection = {{ database_type }}://{{ database_user }}:{{ database_password }}@{{ database_host }}/{{ database }}{% if database_ssl_ca %}?ssl_ca={{ database_ssl_ca }}{% if database_ssl_cert %}&ssl_cert={{ database_ssl_cert }}&ssl_key={{ database_ssl_key }}{% endif %}{% endif %}
{% endif -%}

View File

@ -100,7 +100,6 @@ class NovaBasicDeployment(OpenStackAmuletDeployment):
"""Add all of the relations for the services."""
relations = {
'nova-compute:image-service': 'glance:image-service',
'nova-compute:shared-db': 'percona-cluster:shared-db',
'nova-compute:amqp': 'rabbitmq-server:amqp',
'nova-cloud-controller:shared-db': 'percona-cluster:shared-db',
'nova-cloud-controller:identity-service': 'keystone:'
@ -395,40 +394,6 @@ class NovaBasicDeployment(OpenStackAmuletDeployment):
message = 'S3 endpoint: {}'.format(ret)
amulet.raise_status(amulet.FAIL, msg=message)
def test_200_nova_shared_db_relation(self):
"""Verify the nova-compute to mysql shared-db relation data"""
u.log.debug('Checking n-c:mysql db relation data...')
unit = self.nova_compute_sentry
relation = ['shared-db', 'percona-cluster:shared-db']
expected = {
'private-address': u.valid_ip,
'nova_database': 'nova',
'nova_username': 'nova',
'nova_hostname': u.valid_ip
}
ret = u.validate_relation_data(unit, relation, expected)
if ret:
message = u.relation_error('nova-compute shared-db', ret)
amulet.raise_status(amulet.FAIL, msg=message)
def test_202_mysql_shared_db_relation(self):
"""Verify the mysql to nova-compute shared-db relation data"""
u.log.debug('Checking mysql:n-c db relation data...')
unit = self.pxc_sentry
relation = ['shared-db', 'nova-compute:shared-db']
expected = {
'private-address': u.valid_ip,
'nova_password': u.not_null,
'db_host': u.valid_ip
}
ret = u.validate_relation_data(unit, relation, expected)
if ret:
message = u.relation_error('mysql shared-db', ret)
amulet.raise_status(amulet.FAIL, msg=message)
def test_204_nova_amqp_relation(self):
"""Verify the nova-compute to rabbitmq-server amqp relation data"""
u.log.debug('Checking n-c:rmq amqp relation data...')
@ -506,12 +471,6 @@ class NovaBasicDeployment(OpenStackAmuletDeployment):
'nova-compute:amqp')
gl_nc_rel = self.glance_sentry.relation('image-service',
'nova-compute:image-service')
db_nc_rel = self.pxc_sentry.relation('shared-db',
'nova-compute:shared-db')
db_uri = "mysql://{}:{}@{}/{}".format('nova',
db_nc_rel['nova_password'],
db_nc_rel['db_host'],
'nova')
# Common conf across all releases
expected = {
'DEFAULT': {
@ -538,7 +497,6 @@ class NovaBasicDeployment(OpenStackAmuletDeployment):
'lock_path': '/var/lock/nova',
'libvirt_use_virtio_for_bridges': 'True',
'compute_driver': 'libvirt.LibvirtDriver',
'sql_connection': db_uri,
'rabbit_userid': 'nova',
'rabbit_virtual_host': 'openstack',
'rabbit_password': rmq_nc_rel['password'],
@ -551,9 +509,6 @@ class NovaBasicDeployment(OpenStackAmuletDeployment):
'oslo_concurrency': {
'lock_path': '/var/lock/nova'
},
'database': {
'connection': db_uri
},
'oslo_messaging_rabbit': {
'rabbit_userid': 'nova',
'rabbit_virtual_host': 'openstack',

View File

@ -294,36 +294,6 @@ class NovaComputeRelationsTests(CharmTestCase):
self.assertEqual([call('/etc/nova/nova.conf')],
configs.write.call_args_list)
def test_db_joined(self):
self.is_relation_made.return_value = False
hooks.db_joined()
self.relation_set.assert_called_with(relation_id=None,
nova_database='nova',
nova_username='nova',
nova_hostname='10.0.0.50')
self.get_relation_ip.assert_called_with('shared-db')
@patch.object(hooks, 'CONFIGS')
def test_db_changed_missing_relation_data(self, configs):
configs.complete_contexts = MagicMock()
configs.complete_contexts.return_value = []
hooks.db_changed()
self.log.assert_called_with(
'shared-db relation incomplete. Peer not ready?'
)
def _shared_db_test(self, configs):
configs.complete_contexts = MagicMock()
configs.complete_contexts.return_value = ['shared-db']
configs.write = MagicMock()
hooks.db_changed()
@patch.object(hooks, 'CONFIGS')
def test_db_changed_with_data(self, configs):
self._shared_db_test(configs)
self.assertEqual([call('/etc/nova/nova.conf')],
configs.write.call_args_list)
@patch.object(hooks, 'CONFIGS')
def test_image_service_missing_relation_data(self, configs):
configs.complete_contexts = MagicMock()