From b13eaf757fa25c797aa59e75811a3751f4856765 Mon Sep 17 00:00:00 2001 From: Billy Olsen Date: Wed, 20 Apr 2022 19:22:17 -0700 Subject: [PATCH] Restart nova-conductor on endpoint changes The charm looks for endpoint changes and restarts the nova-scheduler when the endpoint changes. However, the nova-conductor also needs to be restarted in order to pick up new endpoints. Closes-Bug: 1968708 Change-Id: I18dee4eb46bd836805e60427c0afc508e2489111 --- hooks/nova_cc_hooks.py | 3 ++- unit_tests/test_nova_cc_hooks.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hooks/nova_cc_hooks.py b/hooks/nova_cc_hooks.py index cc7741d2..fa3becc5 100755 --- a/hooks/nova_cc_hooks.py +++ b/hooks/nova_cc_hooks.py @@ -485,7 +485,8 @@ def identity_changed(): hookenv.status_set( 'active', 'Restart complete') - ch_host.service_restart('nova-scheduler') + for service in ['nova-scheduler', 'nova-conductor']: + ch_host.service_restart(service) hookenv.log(("Placement endpoint has changed, requesting nova-compute " "restart"), "INFO") diff --git a/unit_tests/test_nova_cc_hooks.py b/unit_tests/test_nova_cc_hooks.py index 90f51621..ceb72b37 100644 --- a/unit_tests/test_nova_cc_hooks.py +++ b/unit_tests/test_nova_cc_hooks.py @@ -1319,7 +1319,8 @@ class NovaCCHooksTests(CharmTestCase): call('ridnapi1'), call('ridnapi3')]) configure_https.assert_called_once_with() sleep.assert_called_once_with(73) - service_restart.assert_called_once_with('nova-scheduler') + service_restart.assert_has_calls([ + call('nova-scheduler'), call('nova-conductor')]) save_endpoint_changed_triggers.assert_called_once_with(['placement']) compute_joined.assert_has_calls([ call(rid='ridcomp7', remote_restart=True),