Series Upgrade
Implement the series-upgrade feature allowing to move between Ubuntu series. Change-Id: I77aebf205cb88ae4da4cdbb33b9336b21c31ee32
This commit is contained in:
parent
c45f580211
commit
f104f3625d
@ -186,7 +186,7 @@ SWIFT_CODENAMES = OrderedDict([
|
||||
('queens',
|
||||
['2.16.0', '2.17.0']),
|
||||
('rocky',
|
||||
['2.18.0']),
|
||||
['2.18.0', '2.19.0']),
|
||||
])
|
||||
|
||||
# >= Liberty version->codename mapping
|
||||
@ -1733,3 +1733,31 @@ def is_unit_upgrading_set():
|
||||
return not(not(kv.get('unit-upgrading')))
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
def series_upgrade_prepare(pause_unit_helper=None, configs=None):
|
||||
""" Run common series upgrade prepare tasks.
|
||||
|
||||
:param pause_unit_helper: function: Function to pause unit
|
||||
:param configs: OSConfigRenderer object: Configurations
|
||||
:returns None:
|
||||
"""
|
||||
set_unit_upgrading()
|
||||
if pause_unit_helper and configs:
|
||||
if not is_unit_paused_set():
|
||||
pause_unit_helper(configs)
|
||||
|
||||
|
||||
def series_upgrade_complete(resume_unit_helper=None, configs=None):
|
||||
""" Run common series upgrade complete tasks.
|
||||
|
||||
:param resume_unit_helper: function: Function to resume unit
|
||||
:param configs: OSConfigRenderer object: Configurations
|
||||
:returns None:
|
||||
"""
|
||||
clear_unit_paused()
|
||||
clear_unit_upgrading()
|
||||
if configs:
|
||||
configs.write_all()
|
||||
if resume_unit_helper:
|
||||
resume_unit_helper(configs)
|
||||
|
@ -64,6 +64,8 @@ from charmhelpers.contrib.openstack.utils import (
|
||||
install_os_snaps,
|
||||
get_snaps_install_info_from_origin,
|
||||
enable_memcache,
|
||||
series_upgrade_prepare,
|
||||
series_upgrade_complete,
|
||||
)
|
||||
|
||||
from keystone_context import fernet_enabled
|
||||
@ -106,6 +108,8 @@ from keystone_utils import (
|
||||
key_leader_set,
|
||||
key_setup,
|
||||
key_write,
|
||||
pause_unit_helper,
|
||||
resume_unit_helper,
|
||||
)
|
||||
|
||||
from charmhelpers.contrib.hahelpers.cluster import (
|
||||
@ -185,6 +189,12 @@ def install():
|
||||
@restart_on_change(restart_map(), restart_functions=restart_function_map())
|
||||
@harden()
|
||||
def config_changed():
|
||||
# if we are paused, delay doing any config changed hooks.
|
||||
# It is forced on the resume.
|
||||
if is_unit_paused_set():
|
||||
log("Unit is pause or upgrading. Skipping config_changed", "WARN")
|
||||
return
|
||||
|
||||
if config('prefer-ipv6'):
|
||||
status_set('maintenance', 'configuring ipv6')
|
||||
setup_ipv6()
|
||||
@ -492,6 +502,13 @@ def leader_elected():
|
||||
@hooks.hook('leader-settings-changed')
|
||||
@restart_on_change(restart_map(), stopstart=True)
|
||||
def leader_settings_changed():
|
||||
|
||||
# if we are paused, delay doing any config changed hooks.
|
||||
# It is forced on the resume.
|
||||
if is_unit_paused_set():
|
||||
log("Unit is pause or upgrading. Skipping config_changed", "WARN")
|
||||
return
|
||||
|
||||
# Since minions are notified of a regime change via the
|
||||
# leader-settings-changed hook, rewrite the token flush cron job to make
|
||||
# sure only the leader is running the cron job.
|
||||
@ -807,6 +824,20 @@ def certs_changed(relation_id=None, unit=None):
|
||||
update_all_domain_backends()
|
||||
|
||||
|
||||
@hooks.hook('pre-series-upgrade')
|
||||
def pre_series_upgrade():
|
||||
log("Running prepare series upgrade hook", "INFO")
|
||||
series_upgrade_prepare(
|
||||
pause_unit_helper, CONFIGS)
|
||||
|
||||
|
||||
@hooks.hook('post-series-upgrade')
|
||||
def post_series_upgrade():
|
||||
log("Running complete series upgrade hook", "INFO")
|
||||
series_upgrade_complete(
|
||||
resume_unit_helper, CONFIGS)
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
hooks.execute(sys.argv)
|
||||
|
1
hooks/post-series-upgrade
Symbolic link
1
hooks/post-series-upgrade
Symbolic link
@ -0,0 +1 @@
|
||||
keystone_hooks.py
|
1
hooks/pre-series-upgrade
Symbolic link
1
hooks/pre-series-upgrade
Symbolic link
@ -0,0 +1 @@
|
||||
keystone_hooks.py
|
Loading…
x
Reference in New Issue
Block a user