Do not pause manila-share during upgrades
The upgrade-charm hook calls install() which by default will pause manila-share if there are peer units. We cant do this on upgrade as it will block active shares and never be resumed. Closes-Bug: #2111818 Change-Id: I982e60e4ddbbdd92d8e471318408bb29394e04a3 Signed-off-by: Edward Hope-Morley <edward.hope-morley@canonical.com> Signed-off-by: Nicolas Bock <nicolas.bock@canonical.com>
This commit is contained in:

committed by
Nicolas Bock

parent
43cad9f4b9
commit
33877e8117
@@ -23,6 +23,7 @@ import charms_openstack.adapters
|
|||||||
import charms_openstack.plugins
|
import charms_openstack.plugins
|
||||||
import charms_openstack.charm.utils
|
import charms_openstack.charm.utils
|
||||||
import charmhelpers.contrib.network.ip as ch_net_ip
|
import charmhelpers.contrib.network.ip as ch_net_ip
|
||||||
|
import charms.reactive as reactive
|
||||||
import charms.reactive.relations as relations
|
import charms.reactive.relations as relations
|
||||||
from charmhelpers.core.host import (
|
from charmhelpers.core.host import (
|
||||||
cmp_pkgrevno,
|
cmp_pkgrevno,
|
||||||
@@ -302,10 +303,20 @@ class ManilaGaneshaCharm(charms_openstack.charm.HAOpenStackCharm,
|
|||||||
_goal_state = goal_state()
|
_goal_state = goal_state()
|
||||||
peers = (key for key in _goal_state['units']
|
peers = (key for key in _goal_state['units']
|
||||||
if '/' in key and key != local_unit())
|
if '/' in key and key != local_unit())
|
||||||
if len(list(peers)) > 0:
|
if (not reactive.is_flag_set('is-upgrade-charm') and
|
||||||
|
len(list(peers)) > 0):
|
||||||
service_pause('manila-share')
|
service_pause('manila-share')
|
||||||
|
|
||||||
super().install()
|
super().install()
|
||||||
|
|
||||||
|
def upgrade_charm(self):
|
||||||
|
""" Override the default so we can set a flag before it runs. """
|
||||||
|
reactive.set_flag('is-upgrade-charm')
|
||||||
|
try:
|
||||||
|
super().upgrade_charm()
|
||||||
|
finally:
|
||||||
|
reactive.clear_flag('is-upgrade-charm')
|
||||||
|
|
||||||
def service_restart(self, service_name):
|
def service_restart(self, service_name):
|
||||||
res_name = self.service_to_resource_map.get(service_name, None)
|
res_name = self.service_to_resource_map.get(service_name, None)
|
||||||
if not res_name or not peer_units():
|
if not res_name or not peer_units():
|
||||||
|
@@ -22,8 +22,7 @@ charm.use_defaults(
|
|||||||
'shared-db.connected',
|
'shared-db.connected',
|
||||||
'config.changed',
|
'config.changed',
|
||||||
'update-status',
|
'update-status',
|
||||||
'upgrade-charm',
|
# TODO: remove following commented out code.
|
||||||
# TODO: remove follwoing commented out code.
|
|
||||||
# remove certificates.available as we want to wire in the call ourselves
|
# remove certificates.available as we want to wire in the call ourselves
|
||||||
# directly.
|
# directly.
|
||||||
# 'certificates.available',
|
# 'certificates.available',
|
||||||
|
Reference in New Issue
Block a user