qa/rgw: don't duplicate 'user list' commands for default zone

some commands during setup expect the zone to exist already, so run
'radosgw-admin user list' to make sure a default zone/zonegroup are
created. avoid duplicating this in several subtasks by moving this to
its own subtask that runs when a realm is not configured

Signed-off-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
Casey Bodley 2026-03-23 10:34:38 -04:00
parent 9b8a9d14da
commit 863a5f2dcb

View File

@ -337,6 +337,14 @@ def create_realm(ctx, clients):
check_status=True)
yield
@contextlib.contextmanager
def init_default_zone(ctx, clients):
for client in clients:
# XXX: the 'default' zone and zonegroup aren't created until we run RGWRados::init_complete().
# issue a 'radosgw-admin user list' command to trigger this
rgwadmin(ctx, client, cmd=['user', 'list'])
yield
@contextlib.contextmanager
def create_pools(ctx, clients):
"""Create replicated or erasure coded data pools for rgw."""
@ -368,11 +376,6 @@ def configure_compression(ctx, clients, compression):
""" set a compression type in the default zone placement """
log.info('Configuring compression type = %s', compression)
for client in clients:
if not ctx.rgw.realm:
# XXX: the 'default' zone and zonegroup aren't created until we run RGWRados::init_complete().
# issue a 'radosgw-admin user list' command to trigger this
rgwadmin(ctx, client, cmd=['user', 'list'], check_status=True)
rgwadmin(ctx, client,
cmd=['zone', 'placement', 'modify', '--rgw-zone', ctx.rgw.zone,
'--placement-id', 'default-placement',
@ -383,11 +386,6 @@ def configure_compression(ctx, clients, compression):
@contextlib.contextmanager
def disable_inline_data(ctx, clients):
for client in clients:
if not ctx.rgw.realm:
# XXX: the 'default' zone and zonegroup aren't created until we run RGWRados::init_complete().
# issue a 'radosgw-admin user list' command to trigger this
rgwadmin(ctx, client, cmd=['user', 'list'], check_status=True)
rgwadmin(ctx, client,
cmd=['zone', 'placement', 'modify', '--rgw-zone', ctx.rgw.zone,
'--placement-id', 'default-placement',
@ -411,11 +409,6 @@ def configure_datacache(ctx, clients, datacache_path):
def configure_storage_classes(ctx, clients, storage_classes):
""" create additional storage classes in the default zone placement """
for client in clients:
if not ctx.rgw.realm:
# XXX: the 'default' zone and zonegroup aren't created until we run RGWRados::init_complete().
# issue a 'radosgw-admin user list' command to trigger this
rgwadmin(ctx, client, cmd=['user', 'list'], check_status=True)
for name, args in storage_classes.items():
log.info('Configuring storage class = %s', name)
rgwadmin(ctx, client,
@ -526,6 +519,10 @@ def task(ctx, config):
subtasks.extend([
lambda: create_realm(ctx=ctx, clients=clients),
])
else:
subtasks.extend([
lambda: init_default_zone(ctx=ctx, clients=clients)
])
if ctx.rgw.compression_type:
subtasks.extend([
lambda: configure_compression(ctx=ctx, clients=clients,