Skip to content

Commit

Permalink
Merge "Fix pool names in RadosGW charm" into stable/quincy.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Sep 20, 2023
2 parents cab0306 + 354102e commit 004ba8c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
2 changes: 1 addition & 1 deletion actions.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pause:
description: Pause the ceph-radosgw unit.
resume:
descrpition: Resume the ceph-radosgw unit.
description: Resume the ceph-radosgw unit.
promote:
description: Promote the zone associated with the local units to master/default (multi-site).
readonly:
Expand Down
13 changes: 10 additions & 3 deletions hooks/ceph_rgw.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ def import_radosgw_key(key, name=None):
return False


def normalize_pool_name(pool):
return pool[1:] if pool.startswith('.') else pool


def get_create_rgw_pools_rq(prefix=None):
"""Pre-create RGW pools so that they have the correct settings.
Expand All @@ -101,6 +105,8 @@ def _add_light_pool(rq, pool, pg_num, prefix=None):
w = weights.get(pool, 0.10)
if prefix:
pool = "{prefix}{pool}".format(prefix=prefix, pool=pool)

pool = normalize_pool_name(pool)
if pg_num > 0:
rq.add_op_create_pool(name=pool, replica_count=replicas,
pg_num=pg_num, group='objects',
Expand Down Expand Up @@ -162,7 +168,7 @@ def _add_light_pool(rq, pool, pg_num, prefix=None):
# the function arguments. Until then we need to build the dict
# prior to the function call.
kwargs = {
'name': pool,
'name': normalize_pool_name(pool),
'erasure_profile': profile_name,
'weight': bucket_weight,
'group': "objects",
Expand All @@ -178,7 +184,7 @@ def _add_light_pool(rq, pool, pg_num, prefix=None):
# the function arguments. Until then we need to build the dict
# prior to the function call.
kwargs = {
'name': pool,
'name': normalize_pool_name(pool),
'replica_count': replicas,
'weight': bucket_weight,
'group': 'objects',
Expand Down Expand Up @@ -209,7 +215,8 @@ def _add_light_pool(rq, pool, pg_num, prefix=None):
for pool in light:
_add_light_pool(rq, pool, pg_num, prefix)

_add_light_pool(rq, '.rgw.root', pg_num)
# RadosGW creates this pool automatically from Quincy on.
# _add_light_pool(rq, '.rgw.root', pg_num)

if config('restrict-ceph-pools'):
rq.add_op_request_access_to_group(name="objects",
Expand Down
16 changes: 1 addition & 15 deletions unit_tests/test_ceph.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ def test_create_rgw_pools_rq_with_prefix(
call('us-east.rgw.buckets.index', replica_count=3, pg_num=10,
weight=None, group='objects', namespace=None, app_name='rgw',
max_bytes=None, max_objects=None),
call('.rgw.root', replica_count=3, pg_num=10, weight=None,
group='objects', namespace=None, app_name='rgw',
max_bytes=None, max_objects=None),
])

# confirm operation with bluestore compression
Expand Down Expand Up @@ -163,9 +160,6 @@ def test_create_rgw_pools_rq_with_prefix(
call('us-east.rgw.buckets.index', replica_count=3, pg_num=10,
weight=None, group='objects', namespace=None, app_name='rgw',
max_bytes=None, max_objects=None),
call('.rgw.root', replica_count=3, pg_num=10, weight=None,
group='objects', namespace=None, app_name='rgw',
max_bytes=None, max_objects=None),
])

@patch.object(utils.context, 'CephBlueStoreCompressionContext')
Expand Down Expand Up @@ -228,9 +222,6 @@ def test_create_rgw_pools_rq_no_prefix_post_jewel(
call('default.rgw.buckets.index', replica_count=3, pg_num=None,
weight=3.0, group='objects', namespace=None, app_name='rgw',
max_bytes=None, max_objects=None),
call('.rgw.root', replica_count=3, pg_num=None, weight=0.1,
group='objects', namespace=None, app_name='rgw',
max_bytes=None, max_objects=None),
])
mock_request_access.assert_called_with(key_name='radosgw.gateway',
name='objects',
Expand Down Expand Up @@ -287,9 +278,6 @@ def test_create_rgw_pools_rq_no_prefix_post_jewel(
call('default.rgw.buckets.index', replica_count=3, pg_num=None,
weight=3.0, group='objects', namespace=None, app_name='rgw',
max_bytes=None, max_objects=None),
call('.rgw.root', replica_count=3, pg_num=None, weight=0.1,
group='objects', namespace=None, app_name='rgw',
max_bytes=None, max_objects=None),
])

@patch.object(utils.context, 'CephBlueStoreCompressionContext')
Expand Down Expand Up @@ -365,9 +353,7 @@ def test_create_rgw_pools_rq_no_prefix_ec(self, mock_broker,
call(weight=3.00, replica_count=3,
name='default.rgw.buckets.index',
group='objects', app_name='rgw'),
call(weight=0.10, replica_count=3, name='.rgw.root',
group='objects', app_name='rgw')],
)
],)
mock_request_access.assert_called_with(key_name='radosgw.gateway',
name='objects',
permission='rwx')
Expand Down

0 comments on commit 004ba8c

Please sign in to comment.