Series Upgrade
Implement the series-upgrade feature allowing to move between Ubuntu series. Change-Id: I9efe27463471fdc99f794931ee03db0bd1e06fbd
This commit is contained in:
parent
a624085341
commit
8692aa9fb6
|
@ -56,6 +56,13 @@ from charmhelpers.fetch import (
|
|||
add_source,
|
||||
)
|
||||
|
||||
from charmhelpers.contrib.openstack.utils import (
|
||||
clear_unit_paused,
|
||||
clear_unit_upgrading,
|
||||
set_unit_paused,
|
||||
set_unit_upgrading,
|
||||
)
|
||||
|
||||
hooks = Hooks()
|
||||
|
||||
|
||||
|
@ -133,6 +140,27 @@ def lxd_migration_relation_changed(rid=None, unit=None):
|
|||
[configure_lxd_remote(settings, u) for u in users]
|
||||
|
||||
|
||||
@hooks.hook('pre-series-upgrade')
|
||||
def pre_series_upgrade():
|
||||
log("Running prepare series upgrade hook", "INFO")
|
||||
# NOTE: The Ceph packages handle the series upgrade gracefully.
|
||||
# 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()
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
hooks.execute(sys.argv)
|
||||
|
@ -140,5 +168,6 @@ def main():
|
|||
log("Unknown hook {} - skipping.".format(e))
|
||||
assess_status()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -50,6 +50,9 @@ from charmhelpers.core.host import (
|
|||
is_container,
|
||||
CompareHostReleases,
|
||||
)
|
||||
from charmhelpers.contrib.openstack.utils import (
|
||||
is_unit_upgrading_set,
|
||||
)
|
||||
from charmhelpers.contrib.storage.linux.utils import (
|
||||
is_block_device,
|
||||
zap_disk,
|
||||
|
@ -543,7 +546,11 @@ def lxd_start():
|
|||
|
||||
def assess_status():
|
||||
'''Determine status of current unit'''
|
||||
if lxd_running():
|
||||
if is_unit_upgrading_set():
|
||||
status_set('blocked',
|
||||
'Ready for do-release-upgrade and reboot. '
|
||||
'Set complete when finished.')
|
||||
elif lxd_running():
|
||||
status_set('active', 'Unit is ready')
|
||||
else:
|
||||
status_set('blocked', 'LXD is not running')
|
||||
|
@ -566,6 +573,7 @@ def zpools():
|
|||
except CalledProcessError:
|
||||
return []
|
||||
|
||||
|
||||
SUBUID = '/etc/subuid'
|
||||
SUBGID = '/etc/subgid'
|
||||
DEFAULT_COUNT = '327680000' # 5000 containers
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
lxd_hooks.py
|
|
@ -0,0 +1 @@
|
|||
lxd_hooks.py
|
Loading…
Reference in New Issue