Skip to content

Commit

Permalink
Test bucket sync status in a multi-site environment.
Browse files Browse the repository at this point in the history
Signed-off-by: root <root@folio08.ceph.redhat.com>
  • Loading branch information
root committed May 22, 2022
1 parent 82a2db9 commit 6998293
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions rgw/v2/lib/resource_op.py
Expand Up @@ -231,6 +231,7 @@ def read(self):
self.ceph_conf = self.doc["config"].get("ceph_conf")
self.gc_verification = self.doc["config"].get("gc_verification", False)
self.bucket_sync_crash = self.doc["config"].get("bucket_sync_crash", False)
self.bucket_sync_status = self.doc["config"].get("bucket_sync_status", False)
self.bucket_sync_run = self.doc["config"].get("bucket_sync_run", False)
self.bucket_stats = self.doc["config"].get("bucket_stats", False)
self.header_size = self.doc["config"].get("header_size", False)
Expand Down
@@ -0,0 +1,21 @@
# upload type: non multipart
# script: test_Mbuckets_with_Nobjects.py
config:
user_count: 1
bucket_count: 1
objects_count: 2
objects_size_range:
min: 5M
max: 15M
bucket_sync_status: true
test_ops:
create_bucket: true
create_object: true
download_object: false
delete_bucket_object: false
sharding:
enable: false
max_shards: 0
compression:
enable: false
type: zlib
11 changes: 11 additions & 0 deletions rgw/v2/tests/s3_swift/test_Mbuckets_with_Nobjects.py
Expand Up @@ -332,6 +332,17 @@ def test_exec(config):
raise TestExecError(
"Command failed....Bucket is not added into reshard queue"
)
if config.bucket_sync_status:
out = utils.bucket_sync_status(bucket.name)
if out is False:
log.info("Bucket sync is not caught up with source. Try bucket sync run to update bucket sync status.")
time.sleep(5)
out = utils.check_bucket_sync(bucket.name)
if out is False:
raise TestExecError(
"Bucket sync is not caught up with source even after a bucket sync run"
)

if config.bucket_sync_run:
out = utils.check_bucket_sync(bucket.name)
if out is False:
Expand Down
10 changes: 10 additions & 0 deletions rgw/v2/utils/utils.py
Expand Up @@ -553,6 +553,16 @@ def check_bucket_sync(name):
out = exec_shell_cmd(cmd)
return out

def bucket_sync_status(name):
cmd = f"radosgw-admin bucket sync status --bucket={name}"
out = exec_shell_cmd(cmd)
if "bucket is caught up with source" in out:
log.info("bucket sync status is caught up with the other site")
return True
else:
log.info("bucket is few behind shards")
return False


def get_hostname_ip():
try:
Expand Down

0 comments on commit 6998293

Please sign in to comment.