From 1cac43fadcc6623c7805c715f665346f48fbd521 Mon Sep 17 00:00:00 2001 From: Ionut Balutoiu Date: Thu, 19 Oct 2023 13:40:26 +0300 Subject: [PATCH] Fix scale-out in the multi-site replication scenario If the multi-site relation is established, the `ceph-radosgw` application cannot be scaled out. This is happening because the multi-site functions are part of `check_optional_config_and_relations`, which is called by `assess_status` after every successful hook in the main hook entrypoint: ``` if __name__ == '__main__': try: hooks.execute(sys.argv) except UnregisteredHookError as e: log('Unknown hook {} - skipping.'.format(e)) except ValueError as e: # Handle any invalid configuration values status_set(WORKLOAD_STATES.BLOCKED, str(e)) else: assess_status(CONFIGS) ``` The multi-site functions (for example: `is_multisite_configured` or `check_cluster_has_buckets`) will fail since the unit is not be ready for service. This change ensures that the unit is ready for service before calling any multi-site functions. Closes-Bug: #2062405 Change-Id: I63c21a0b545bb456df9b09d8c16cc43cd7eec2f3 Signed-off-by: Ionut Balutoiu --- hooks/utils.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hooks/utils.py b/hooks/utils.py index 3a7a6d97..8397ac85 100644 --- a/hooks/utils.py +++ b/hooks/utils.py @@ -246,8 +246,9 @@ def check_optional_config_and_relations(configs): # Primary site status check if primary_rids: # Migration: The system is not multisite already. - if not multisite.is_multisite_configured(config('zone'), - config('zonegroup')): + if (ready_for_service(legacy=False) and + not multisite.is_multisite_configured(config('zone'), + config('zonegroup'))): if multisite.check_cluster_has_buckets(): zones, zonegroups = get_zones_zonegroups() status_msg = "Multiple zone or zonegroup configured, " \ @@ -271,8 +272,9 @@ def check_optional_config_and_relations(configs): # Secondary site status check if secondary_rids: # Migration: The system is not multisite already. - if not multisite.is_multisite_configured(config('zone'), - config('zonegroup')): + if (ready_for_service(legacy=False) and + not multisite.is_multisite_configured(config('zone'), + config('zonegroup'))): if multisite.check_cluster_has_buckets(): return ('blocked', "Non-Pristine RGW site can't be used as secondary")