Signal Neutron service restart on OVN upgrade

Notify principal charm to restart Neutron service
after OVN package upgrade

Change-Id: Iedb9985ae448a7149029168a361e574a41b7ad29
This commit is contained in:
Martin Kalcok 2023-07-13 13:28:18 +02:00
parent 9d0cb6f505
commit 63adc21543
2 changed files with 15 additions and 1 deletions

View File

@ -345,3 +345,8 @@ class UssuriNeutronAPIPluginCharm(BaseNeutronAPIPluginCharm):
'packages.'.format(self.ovn_source))
ch_fetch.add_source(self.ovn_source)
self._upgrade_packages()
neutron_api = reactive.endpoint_from_flag(
'neutron-plugin.connected'
)
if neutron_api is not None:
neutron_api.request_restart()

View File

@ -272,6 +272,15 @@ class TestNeutronAPIPluginOvnCharm(Helper):
'ovn_source',
new_callable=ovn_source_mock
)
self.patch_object(charm_class, '_upgrade_packages')
self.patch_object(neutron_api_plugin_ovn.ch_fetch, 'add_source')
neutron_principal_mock = mock.MagicMock()
self.patch_object(neutron_api_plugin_ovn.reactive,
'endpoint_from_flag',
return_value=neutron_principal_mock)
c = neutron_api_plugin_ovn.UssuriNeutronAPIPluginCharm()
c.upgrade_ovn()
self.add_source.assert_called_once_with(ovn_source_data)
self._upgrade_packages.assert_called_once_with()
neutron_principal_mock.request_restart.assert_called_once_with()