diff --git a/hooks/nova_compute_hooks.py b/hooks/nova_compute_hooks.py index 94be738a..4264a0a1 100755 --- a/hooks/nova_compute_hooks.py +++ b/hooks/nova_compute_hooks.py @@ -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() diff --git a/hooks/nova_compute_utils.py b/hooks/nova_compute_utils.py index 749a4941..ac86cafc 100644 --- a/hooks/nova_compute_utils.py +++ b/hooks/nova_compute_utils.py @@ -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 diff --git a/metadata.yaml b/metadata.yaml index b759a7d2..572f08e8 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -24,8 +24,6 @@ provides: extra-bindings: internal: requires: - shared-db: - interface: mysql-shared amqp: interface: rabbitmq image-service: diff --git a/templates/icehouse/nova.conf b/templates/icehouse/nova.conf index 53581604..cde954bd 100644 --- a/templates/icehouse/nova.conf +++ b/templates/icehouse/nova.conf @@ -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 -%} diff --git a/templates/juno/nova.conf b/templates/juno/nova.conf index 35cc8176..c04af571 100644 --- a/templates/juno/nova.conf +++ b/templates/juno/nova.conf @@ -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 -%} diff --git a/templates/parts/database b/templates/parts/database deleted file mode 100644 index aa194b73..00000000 --- a/templates/parts/database +++ /dev/null @@ -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 -%} diff --git a/tests/basic_deployment.py b/tests/basic_deployment.py index de0ba2ee..0bdd3037 100644 --- a/tests/basic_deployment.py +++ b/tests/basic_deployment.py @@ -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', diff --git a/unit_tests/test_nova_compute_hooks.py b/unit_tests/test_nova_compute_hooks.py index c8ab8ff1..3a5d7697 100644 --- a/unit_tests/test_nova_compute_hooks.py +++ b/unit_tests/test_nova_compute_hooks.py @@ -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()