diff --git a/charms/neutron-k8s/CONTRIBUTING.md b/charms/neutron-k8s/CONTRIBUTING.md index 4729b4a2..2d17024d 100644 --- a/charms/neutron-k8s/CONTRIBUTING.md +++ b/charms/neutron-k8s/CONTRIBUTING.md @@ -48,7 +48,7 @@ run: To deploy the local test instance: - juju deploy ./neutron-k8s_ubuntu-20.04-amd64.charm --trust --resource neutron-server-image=kolla/ubuntu-binary-neutron-server:yoga + juju deploy ./neutron-k8s_ubuntu-20.04-amd64.charm --trust --resource neutron-server-image=ghcr.io/openstack-snaps/neutron-server:2023.1 diff --git a/charms/neutron-k8s/README.md b/charms/neutron-k8s/README.md index 7a55e4b1..ac13e3dc 100644 --- a/charms/neutron-k8s/README.md +++ b/charms/neutron-k8s/README.md @@ -50,7 +50,7 @@ neutron-k8s requires the following relations: ## OCI Images -The charm by default uses `docker.io/kolla/ubuntu-binary-neutron-server:yoga` image. +The charm by default uses `ghcr.io/openstack-snaps/neutron-server:2023.1` image. ## Contributing diff --git a/charms/neutron-k8s/metadata.yaml b/charms/neutron-k8s/metadata.yaml index 6628ceb4..0ae5d44e 100644 --- a/charms/neutron-k8s/metadata.yaml +++ b/charms/neutron-k8s/metadata.yaml @@ -25,8 +25,8 @@ resources: neutron-server-image: type: oci-image description: OCI image for OpenStack Neutron API - # docker.io/kolla/ubuntu-binary-neutron-server:yoga - upstream-source: docker.io/kolla/ubuntu-binary-neutron-server@sha256:b473d7e2ecf9b3e9ec5be06cd8df3a06db80a50c629773ed388c2a253d7f3ca5 + # ghcr.io/openstack-snaps/neutron-server:2023.1 + upstream-source: ghcr.io/openstack-snaps/neutron-server:2023.1 provides: neutron-api: diff --git a/charms/neutron-k8s/osci.yaml b/charms/neutron-k8s/osci.yaml index bdd84e18..ec00d331 100644 --- a/charms/neutron-k8s/osci.yaml +++ b/charms/neutron-k8s/osci.yaml @@ -7,4 +7,4 @@ build_type: charmcraft publish_charm: true charmcraft_channel: 2.0/stable - publish_channel: yoga/edge + publish_channel: 2023.1/edge diff --git a/charms/neutron-k8s/src/charm.py b/charms/neutron-k8s/src/charm.py index bd01e81c..9a444b88 100755 --- a/charms/neutron-k8s/src/charm.py +++ b/charms/neutron-k8s/src/charm.py @@ -28,6 +28,8 @@ import ops_sunbeam.charm as sunbeam_charm import ops_sunbeam.config_contexts as sunbeam_ctxts import ops_sunbeam.container_handlers as sunbeam_chandlers import ops_sunbeam.core as sunbeam_core +import ops_sunbeam.guard as sunbeam_guard +import ops_sunbeam.job_ctrl as sunbeam_job_ctrl import ops_sunbeam.ovn.relation_handlers as ovn_rhandlers import ops_sunbeam.relation_handlers as sunbeam_rhandlers from ops.framework import ( @@ -276,6 +278,28 @@ class NeutronOVNOperatorCharm(NeutronOperatorCharm): handlers = super().get_relation_handlers(handlers) return handlers + @sunbeam_job_ctrl.run_once_per_unit("post-db-sync-restart") + def _post_db_sync_restart(self) -> None: + # If neutron-server is running prior to the db-sync the + # hash ring job can wedge communication with ovn so restart + # neutron-server. Note that the run_once_per_unit decorator + # ensure this is only run once. + handler = self.get_named_pebble_handler("neutron-server") + logger.debug("Restarting neutron-server after db sync") + handler.start_all(restart=True) + + @sunbeam_job_ctrl.run_once_per_unit("db-sync") + def run_db_sync(self) -> None: + """Run db sync and restart neutron-server.""" + super().run_db_sync() + self._post_db_sync_restart() + + def configure_app_non_leader(self, event): + """Setup steps for a non-leader after leader has bootstrapped.""" + if not self.bootstrapped: + raise sunbeam_guard.WaitingExceptionError("Leader not ready") + self._post_db_sync_restart() + if __name__ == "__main__": main(NeutronOVNOperatorCharm) diff --git a/charms/neutron-k8s/src/templates/api-paste.ini.j2 b/charms/neutron-k8s/src/templates/api-paste.ini.j2 index 92a4d7c3..cf3c8602 100644 --- a/charms/neutron-k8s/src/templates/api-paste.ini.j2 +++ b/charms/neutron-k8s/src/templates/api-paste.ini.j2 @@ -1,4 +1,4 @@ -[composite:neutron] [6/10808] +[composite:neutron] use = egg:Paste#urlmap /: neutronversions_composite /healthcheck: healthcheck diff --git a/charms/neutron-k8s/src/templates/neutron.conf.j2 b/charms/neutron-k8s/src/templates/neutron.conf.j2 index bd277608..9a347daa 100644 --- a/charms/neutron-k8s/src/templates/neutron.conf.j2 +++ b/charms/neutron-k8s/src/templates/neutron.conf.j2 @@ -2,6 +2,7 @@ core_plugin = ml2 debug = {{ options.debug }} log_dir = /var/log/neutron +state_path = /var/lib/neutron router_distributed = False @@ -28,6 +29,9 @@ global_physnet_mtu = 1500 transport_url = {{ amqp.transport_url }} +[oslo_concurrency] +lock_path = $state_path/lock + [agent] root_helper = "sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf" diff --git a/charms/neutron-k8s/tests/bundles/smoke.yaml b/charms/neutron-k8s/tests/bundles/smoke.yaml index 07afe674..a12076f8 100644 --- a/charms/neutron-k8s/tests/bundles/smoke.yaml +++ b/charms/neutron-k8s/tests/bundles/smoke.yaml @@ -33,33 +33,17 @@ applications: storage: fernet-keys: 5M credential-keys: 5M - glance: - charm: ch:glance-k8s - channel: yoga/edge - scale: 1 - trust: true - storage: - local-repository: 5G - nova: - charm: ch:nova-k8s - channel: yoga/edge - scale: 1 - trust: true - placement: - charm: ch:placement-k8s - channel: yoga/edge - scale: 1 - trust: true neutron: - charm: ch:neutron-k8s charm: ../../neutron-k8s.charm scale: 1 trust: true + options: + debug: true resources: - neutron-server-image: kolla/ubuntu-binary-neutron-server:yoga + neutron-server-image: ghcr.io/openstack-snaps/neutron-server:2023.1 ovn-central: charm: ch:ovn-central-k8s - channel: 22.03/edge + channel: 23.03/edge scale: 1 trust: true tls-operator: @@ -78,41 +62,6 @@ relations: - - traefik-public:ingress - keystone:ingress-public -- - mysql:database - - glance:database -- - rabbitmq:amqp - - glance:amqp -- - keystone:identity-service - - glance:identity-service -- - traefik:ingress - - glance:ingress-internal -- - traefik-public:ingress - - glance:ingress-public - -- - mysql:database - - nova:database -- - mysql:database - - nova:api-database -- - mysql:database - - nova:cell-database -- - rabbitmq:amqp - - nova:amqp -- - keystone:identity-service - - nova:identity-service -- - traefik:ingress - - nova:ingress-internal -- - traefik-public:ingress - - nova:ingress-public - -- - mysql:database - - placement:database -- - keystone:identity-service - - placement:identity-service -- - traefik:ingress - - placement:ingress-internal -- - traefik-public:ingress - - placement:ingress-public - - - mysql:database - neutron:database - - rabbitmq:amqp diff --git a/charms/neutron-k8s/tests/tests.yaml b/charms/neutron-k8s/tests/tests.yaml index a21f9725..2825a144 100644 --- a/charms/neutron-k8s/tests/tests.yaml +++ b/charms/neutron-k8s/tests/tests.yaml @@ -5,8 +5,6 @@ smoke_bundles: configure: - zaza.openstack.charm_tests.keystone.setup.wait_for_all_endpoints - zaza.openstack.charm_tests.keystone.setup.add_tempest_roles - - zaza.openstack.charm_tests.nova.setup.create_flavors - - zaza.openstack.charm_tests.nova.setup.manage_ssh_key tests: - zaza.openstack.charm_tests.neutron.tests.NeutronTempestTestK8S tests_options: @@ -41,12 +39,6 @@ target_deploy_status: rabbitmq: workload-status: active workload-status-message-regex: '^$' - nova: - workload-status: active - workload-status-message-regex: '^$' - glance: - workload-status: active - workload-status-message-regex: '^$' neutron: workload-status: active workload-status-message-regex: '^$' @@ -59,9 +51,6 @@ target_deploy_status: mysql: workload-status: active workload-status-message-regex: '^.*$' - placement: - workload-status: active - workload-status-message-regex: '^$' tls-operator: workload-status: active workload-status-message-regex: '^$'