From 8e74666ff3b61df27f03b8ceffbec274617b1485 Mon Sep 17 00:00:00 2001 From: James Page Date: Mon, 28 Sep 2020 11:50:28 +0100 Subject: [PATCH] Make EC profiles immutable Changing an existing EC profile can have some nasty side effects including crashing OSD's (which is why its guarded with a --force). Update the ceph helper to log a warning and return if an EC profile already exists, effectively making them immutable and avoiding any related issues. Reconfiguration of a pool would be undertaking using actions: - create new EC profile - create new pool using new EC profile - copy data from old pool to new pool - rename old pool - rename new pool to original pool name this obviously requires an outage in the consuming application. Change-Id: I630f6b6c5e3c6dd252a85cd373d7e204b9e77245 Closes-Bug: 1897517 --- charmhelpers/contrib/storage/linux/ceph.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/charmhelpers/contrib/storage/linux/ceph.py b/charmhelpers/contrib/storage/linux/ceph.py index 526b95a..7882e2c 100644 --- a/charmhelpers/contrib/storage/linux/ceph.py +++ b/charmhelpers/contrib/storage/linux/ceph.py @@ -1074,7 +1074,10 @@ def create_erasure_profile(service, profile_name, erasure_plugin_technique=None): """Create a new erasure code profile if one does not already exist for it. - Updates the profile if it exists. Please refer to [0] for more details. + Profiles are considered immutable so will not be updated if the named + profile already exists. + + Please refer to [0] for more details. 0: http://docs.ceph.com/docs/master/rados/operations/erasure-code-profile/ @@ -1110,6 +1113,11 @@ def create_erasure_profile(service, profile_name, :type erasure_plugin_technique: str :return: None. Can raise CalledProcessError, ValueError or AssertionError """ + if erasure_profile_exists(service, profile_name): + log('EC profile {} exists, skipping update'.format(profile_name), + level=WARNING) + return + plugin_techniques = { 'jerasure': [ 'reed_sol_van', @@ -1209,9 +1217,6 @@ def create_erasure_profile(service, profile_name, if scalar_mds: cmd.append('scalar-mds={}'.format(scalar_mds)) - if erasure_profile_exists(service, profile_name): - cmd.append('--force') - check_call(cmd)