Series Upgrade

Implement the series-upgrade feature allowing to move between Ubuntu
series.

Change-Id: I818c09346928e28b957cf910f1760ecadf91c63a
This commit is contained in:
David Ames 2018-10-23 13:22:15 -07:00
parent 555c706c7a
commit e83f5accfd
4 changed files with 36 additions and 0 deletions

View File

@ -28,6 +28,13 @@ from charmhelpers.fetch import (
apt_install,
)
from charmhelpers.contrib.openstack.utils import (
clear_unit_paused,
clear_unit_upgrading,
set_unit_paused,
set_unit_upgrading,
)
from nova_compute_utils import (
restart_map,
register_configs,
@ -109,6 +116,26 @@ def update_status():
assess_status(CONFIGS)
@hooks.hook('pre-series-upgrade')
def pre_series_upgrade():
log("Running prepare series upgrade hook", "INFO")
# NOTE: In order to indicate the step of the series upgrade process for
# administrators and automated scripts, the charm sets the paused and
# upgrading states.
set_unit_paused()
set_unit_upgrading()
@hooks.hook('post-series-upgrade')
def post_series_upgrade():
log("Running complete series upgrade hook", "INFO")
# In order to indicate the step of the series upgrade process for
# administrators and automated scripts, the charm clears the paused and
# upgrading states.
clear_unit_paused()
clear_unit_upgrading()
if __name__ == '__main__':
try:
hooks.execute(sys.argv)

View File

@ -27,6 +27,7 @@ from charmhelpers.core.host import mkdir
from charmhelpers.contrib.openstack import templating, context
from charmhelpers.contrib.openstack.utils import (
_determine_os_workload_status,
is_unit_upgrading_set,
)
from nova_compute_context import (
@ -191,6 +192,12 @@ def assess_status(configs):
@param configs: a templating.OSConfigRenderer() object
@returns None - this function is executed for its side-effect
"""
if is_unit_upgrading_set():
status_set("blocked",
"Ready for do-release-upgrade and reboot. "
"Set complete when finished.")
return
state, message = _determine_os_workload_status(configs,
REQUIRED_INTERFACES.copy())
if state != 'active':

1
hooks/post-series-upgrade Symbolic link
View File

@ -0,0 +1 @@
nova_compute_hooks.py

1
hooks/pre-series-upgrade Symbolic link
View File

@ -0,0 +1 @@
nova_compute_hooks.py