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
This commit is contained in:
James Page 2020-09-28 11:50:28 +01:00
parent 12682da2fc
commit 8e74666ff3
1 changed files with 9 additions and 4 deletions

View File

@ -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)