From cbbc3af633484667a128fc8afcbc245fa46aafbf Mon Sep 17 00:00:00 2001 From: Nizamudeen A Date: Fri, 7 Jun 2024 18:43:00 +0530 Subject: [PATCH] mgr/dashboard: get bucket replication info - Show bucket replication status and replication policy in the details view Fixes: https://tracker.ceph.com/issues/66241 Signed-off-by: Nizamudeen A (cherry picked from commit 9cdb55c2d2ed6f6ca4ab51d0cd40943107d90c0d) --- src/pybind/mgr/dashboard/controllers/rgw.py | 5 +++++ .../rgw-bucket-details.component.html | 10 ++++++++++ .../rgw-bucket-details.component.ts | 3 +++ .../rgw-bucket-form/rgw-bucket-form.component.html | 3 ++- .../rgw-bucket-form/rgw-bucket-form.component.ts | 8 ++++++++ src/pybind/mgr/dashboard/services/rgw_client.py | 13 +++++++++++++ 6 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/dashboard/controllers/rgw.py b/src/pybind/mgr/dashboard/controllers/rgw.py index 2240e08aa66..d0831239fbb 100644 --- a/src/pybind/mgr/dashboard/controllers/rgw.py +++ b/src/pybind/mgr/dashboard/controllers/rgw.py @@ -409,6 +409,10 @@ class RgwBucket(RgwRESTController): multisite.create_dashboard_admin_sync_group(zonegroup_name=zonegroup_name) return rgw_client.set_bucket_replication(bucket_name, replication) + def _get_replication(self, bucket_name: str): + rgw_client = RgwClient.admin_instance() + return rgw_client.get_bucket_replication(bucket_name) + @staticmethod def strip_tenant_from_bucket_name(bucket_name): # type (str) -> str @@ -463,6 +467,7 @@ class RgwBucket(RgwRESTController): result['mfa_delete'] = versioning['MfaDelete'] result['bucket_policy'] = self._get_policy(bucket_name) result['acl'] = self._get_acl(bucket_name, daemon_name, result['owner']) + result['replication'] = self._get_replication(bucket_name) # Append the locking configuration. locking = self._get_locking(result['owner'], daemon_name, bucket_name) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.html index a68ea5661e2..f0b5f1872bc 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.html @@ -20,6 +20,11 @@ class="bold">Encryption {{ selection.encryption }} + + Replication + {{ replicationStatus }} + MFA Delete @@ -130,6 +135,11 @@ class="bold w-25">Bucket policy
{{ selection.bucket_policy | json}}
+ + Replication policy +
{{ selection.replication | json}}
+ ACL diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.ts index 451a7dd3811..1a709f8644f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.ts @@ -14,6 +14,7 @@ export class RgwBucketDetailsComponent implements OnChanges { selection: any; aclPermissions: Record = {}; + replicationStatus = $localize`Disabled`; constructor(private rgwBucketService: RgwBucketService) {} @@ -23,6 +24,8 @@ export class RgwBucketDetailsComponent implements OnChanges { bucket['lock_retention_period_days'] = this.rgwBucketService.getLockDays(bucket); this.selection = bucket; this.aclPermissions = this.parseXmlAcl(this.selection.acl, this.selection.owner); + if (this.selection.replication?.['Rule']?.['Status']) + this.replicationStatus = this.selection.replication?.['Rule']?.['Status']; }); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.html index 22b094d6bd5..87dbee26dc2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.html @@ -408,7 +408,8 @@ Enables replication for the objects in the bucket. -
+