Start libvirt in post-series-upgrade
A recent change (commit ceab1e91dc2e3948f6ba7c121c1801ad1641643c) removed libvirt from the pause/resume list of services. This affected series upgrade. Libvirt stayed down and did not start back up on resume. This change checks the hook being executed and if it is post-series-upgrade it includes libvirt as a service to start on resume. Closes-Bug: #1839495 Change-Id: Ibfa24b678c1077b441464da8c38114ce23d14963
This commit is contained in:
parent
c0607560ba
commit
6a1e3a799e
@ -641,7 +641,7 @@ def pre_series_upgrade():
|
||||
def post_series_upgrade():
|
||||
log("Running complete series upgrade hook", "INFO")
|
||||
service_stop('nova-compute')
|
||||
service_stop('libvirt-bin')
|
||||
service_stop(libvirt_daemon())
|
||||
# After package upgrade the service is broken and leaves behind a
|
||||
# PID file which causes the service to fail to start.
|
||||
# Remove this before restart
|
||||
|
@ -62,6 +62,7 @@ from charmhelpers.core.hookenv import (
|
||||
WARNING,
|
||||
storage_list,
|
||||
storage_get,
|
||||
hook_name,
|
||||
)
|
||||
|
||||
from charmhelpers.core.decorators import retry_on_exception
|
||||
@ -908,6 +909,9 @@ def resume_unit_helper(configs):
|
||||
|
||||
|
||||
def services_to_pause_or_resume():
|
||||
if "post-series-upgrade" in hook_name():
|
||||
return services()
|
||||
else:
|
||||
return list(set(services()) - {libvirt_daemon()})
|
||||
|
||||
|
||||
|
@ -1110,3 +1110,21 @@ class NovaComputeUtilsTests(CharmTestCase):
|
||||
os_environ_get_mock.side_effect = os_environ_get_side_effect
|
||||
az = utils.get_availability_zone()
|
||||
self.assertEqual('nova', az)
|
||||
|
||||
@patch.object(utils, "libvirt_daemon")
|
||||
@patch.object(utils, "hook_name")
|
||||
@patch.object(utils, "services")
|
||||
def test_services_to_pause_or_resume(
|
||||
self, _services, _hook_name, _libvirt_daemon):
|
||||
_no_libvirt = ["nova-compute"]
|
||||
_full = _no_libvirt + ["libvirtd"]
|
||||
_services.return_value = _full
|
||||
_libvirt_daemon.return_value = "libvirtd"
|
||||
|
||||
_hook_name.return_value = "config-changed"
|
||||
self.assertEqual(_no_libvirt,
|
||||
utils.services_to_pause_or_resume())
|
||||
|
||||
_hook_name.return_value = "post-series-upgrade"
|
||||
self.assertEqual(_full,
|
||||
utils.services_to_pause_or_resume())
|
||||
|
Loading…
x
Reference in New Issue
Block a user