Action managed openstack upgrade support

This commit is contained in:
Corey Bryant 2015-09-14 21:02:50 +00:00
parent acca492807
commit 32f60b8742
5 changed files with 56 additions and 2 deletions

4
actions.yaml Normal file
View File

@ -0,0 +1,4 @@
openstack-upgrade:
description: |
Perform openstack upgrades. Config option action-managed-upgrade must be
set to True.

1
actions/openstack-upgrade Symbolic link
View File

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

38
actions/openstack_upgrade.py Executable file
View File

@ -0,0 +1,38 @@
#!/usr/bin/python
import sys
import uuid
sys.path.append('hooks/')
from charmhelpers.contrib.openstack.utils import (
do_action_openstack_upgrade,
)
from ceilometer_hooks import config_changed
from ceilometer_utils import (
do_openstack_upgrade,
register_configs
)
CONFIGS = register_configs()
def openstack_upgrade():
"""Perform action-managed OpenStack upgrade.
Upgrades packages to the configured openstack-origin version and sets
the corresponding action status as a result.
If the charm was installed from source we cannot upgrade it.
For backwards compatibility a config flag (action-managed-upgrade) must
be set for this code to run, otherwise a full service level upgrade will
fire on config-changed."""
if (do_action_openstack_upgrade(do_openstack_upgrade,
CONFIGS, package='ceilometer-common')):
config_changed()
if __name__ == '__main__':
openstack_upgrade()

View File

@ -40,3 +40,13 @@ options:
description: |
A comma-separated list of nagios servicegroups.
If left empty, the nagios_context will be used as the servicegroup
action-managed-upgrade:
type: boolean
default: False
description: |
If True enables openstack upgrades for this charm via juju actions.
You will still need to set openstack-origin to the new repository but
instead of an upgrade running automatically across all units, it will
wait for you to execute the openstack-upgrade action for this charm on
each unit. If False it will revert to existing behavior of upgrading
all units on config change.

View File

@ -61,8 +61,9 @@ def ceilometer_changed():
@hooks.hook('config-changed')
@restart_on_change(restart_map(), stopstart=True)
def config_changed():
if openstack_upgrade_available('ceilometer-common'):
do_openstack_upgrade(CONFIGS)
if not config('action-managed-upgrade'):
if openstack_upgrade_available('ceilometer-common'):
do_openstack_upgrade(CONFIGS)
if is_relation_made('nrpe-external-master'):
update_nrpe_config()
CONFIGS.write_all()