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:
Edward Hope-Morley
2025-08-08 09:32:05 +01:00
committed by Nicolas Bock
parent 43cad9f4b9
commit 33877e8117
2 changed files with 13 additions and 3 deletions

View File

@@ -23,6 +23,7 @@ import charms_openstack.adapters
import charms_openstack.plugins
import charms_openstack.charm.utils
import charmhelpers.contrib.network.ip as ch_net_ip
import charms.reactive as reactive
import charms.reactive.relations as relations
from charmhelpers.core.host import (
cmp_pkgrevno,
@@ -302,10 +303,20 @@ class ManilaGaneshaCharm(charms_openstack.charm.HAOpenStackCharm,
_goal_state = goal_state()
peers = (key for key in _goal_state['units']
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')
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):
res_name = self.service_to_resource_map.get(service_name, None)
if not res_name or not peer_units():

View File

@@ -22,8 +22,7 @@ charm.use_defaults(
'shared-db.connected',
'config.changed',
'update-status',
'upgrade-charm',
# TODO: remove follwoing commented out code.
# TODO: remove following commented out code.
# remove certificates.available as we want to wire in the call ourselves
# directly.
# 'certificates.available',