Skip to content

Commit

Permalink
Rgw granular sync policy changes
Browse files Browse the repository at this point in the history
Signed-off-by: Anuchaithra <[email protected]>
  • Loading branch information
anrao19 committed Nov 3, 2023
1 parent 165af6b commit ca7fdc2
Show file tree
Hide file tree
Showing 3 changed files with 271 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@
config:
user_count: 1
bucket_count: 2
objects_count: 10
objects_size_range:
min: 5K
max: 2M
multisite_global_sync_policy: true
multisite_sync_policy: true
test_ops:
create_bucket: true
create_object: true
group_create: true
group_remove: false
flow_create: true
flow_remove: false
pipe_create: true
pipe_remove: false
group_status: allowed # Enable , Allowed, Forbidden
group_status: enabled # Enable , Allowed, Forbidden
bucket_group_status: enabled
flow_type: symmetrical # symmetrical , directional
49 changes: 45 additions & 4 deletions rgw/v2/tests/s3_swift/reusable.py
Original file line number Diff line number Diff line change
Expand Up @@ -1700,23 +1700,64 @@ def group_operation(group_id, group_op, group_status="enabled", bucket_name=None
utils.exec_shell_cmd(cmd)


def flow_operation(group_id, flow_op, flow_type="symmetrical"):
def get_sync_policy(bucket_name=None):
if bucket_name is not None:
bkt = f" --bucket={bucket_name}"
else:
bkt = ""
sync_policy_resp = json.loads(
utils.exec_shell_cmd(f"radosgw-admin sync policy get" + bkt)
)
return sync_policy_resp


def flow_operation(
group_id,
flow_op,
flow_type="symmetrical",
bucket_name=None,
source_zone=None,
dest_zone=None,
):
flow_id = group_id + "flow"
bkt = ""
if bucket_name is not None:
bkt = f" --bucket={bucket_name}"
zone_names, _ = get_multisite_info()
cmd = f"radosgw-admin sync group flow {flow_op} --group-id={group_id} --flow-id={flow_id} --flow-type={flow_type} --zones={zone_names}"
cmd = f"radosgw-admin sync group flow {flow_op} --group-id={group_id} --flow-id={flow_id} --flow-type={flow_type}"
if flow_type == "directional":
cmd += f" --source-zone={source_zone} --dest-zone={dest_zone}" + bkt
else:
cmd += f" --zones={zone_names}" + bkt
utils.exec_shell_cmd(cmd)
return zone_names


def pipe_operation(
group_id, pipe_op, zone_names=None, bucket_name=None, policy_detail=None
group_id,
pipe_op,
zone_names=None,
bucket_name=None,
policy_detail=None,
source_zones=None,
dest_zones=None,
):
pipe_id = group_id + "pipe"
if zone_names is not None:
zone_name = zone_names.split(",")
zn = f" --source-zones='{zone_name[0]}','{zone_name[1]}' --dest-zones='{zone_name[0]}','{zone_name[1]}'"
if source_zones is not None:
zn = f" --source-zones={source_zones}"
if dest_zones is not None:
zn += f" --dest-zones={dest_zones}"
else:
zn += " --dest-zones='*'"
else:
zn = " --source-zones='*' --dest-zones='*'"
zn = " --source-zones='*'"
if dest_zones is not None:
zn += f" --dest-zones={dest_zones}"
else:
zn += " --dest-zones='*'"
if bucket_name is not None:
bkt = f" --bucket={bucket_name}"
else:
Expand Down
Loading

0 comments on commit ca7fdc2

Please sign in to comment.