Skip to content

Commit d432597

Browse files
authored
Merge pull request ceph#60050 from rhcs-dashboard/non-default-realm-sync-status
mgr/dashboard: show non default realm sync status in rgw overview page Reviewed-by: Afreen Misbah <[email protected]>
2 parents e48735c + ea53ace commit d432597

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

src/pybind/mgr/dashboard/controllers/rgw.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ class RgwMultisiteController(RESTController):
162162
@ReadPermission
163163
@allow_empty_body
164164
# pylint: disable=W0102,W0613
165-
def get_sync_status(self):
165+
def get_sync_status(self, daemon_name=None):
166166
multisite_instance = RgwMultisite()
167-
result = multisite_instance.get_multisite_sync_status()
167+
result = multisite_instance.get_multisite_sync_status(daemon_name)
168168
return result
169169

170170
@Endpoint(path='/sync-policy')

src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-overview-dashboard/rgw-overview-dashboard.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ export class RgwOverviewDashboardComponent implements OnInit, OnDestroy {
9191
this.totalPoolUsedBytes = data['total_pool_bytes_used'];
9292
this.averageObjectSize = data['average_object_size'];
9393
});
94-
this.getSyncStatus();
94+
setTimeout(() => {
95+
this.getSyncStatus();
96+
});
9597
});
9698
this.BucketSub = this.rgwBucketService
9799
.getTotalBucketsAndUsersLength()

src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-multisite.service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ export class RgwMultisiteService {
3232
}
3333

3434
getSyncStatus() {
35-
return this.http.get(`${this.url}/sync_status`);
35+
return this.rgwDaemonService.request((params: HttpParams) => {
36+
return this.http.get(`${this.url}/sync_status`, { params: params });
37+
});
3638
}
3739

3840
status() {

src/pybind/mgr/dashboard/openapi.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11746,7 +11746,12 @@ paths:
1174611746
- RgwMultisite
1174711747
/api/rgw/multisite/sync_status:
1174811748
get:
11749-
parameters: []
11749+
parameters:
11750+
- allowEmptyValue: true
11751+
in: query
11752+
name: daemon_name
11753+
schema:
11754+
type: string
1175011755
responses:
1175111756
'200':
1175211757
content:

src/pybind/mgr/dashboard/services/rgw_client.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1981,8 +1981,16 @@ def get_multisite_status(self):
19811981
is_multisite_configured = False
19821982
return is_multisite_configured
19831983

1984-
def get_multisite_sync_status(self):
1984+
def get_multisite_sync_status(self, daemon_name: str):
19851985
rgw_multisite_sync_status_cmd = ['sync', 'status']
1986+
daemons = _get_daemons()
1987+
try:
1988+
realm_name = daemons[daemon_name].realm_name
1989+
except (KeyError, AttributeError):
1990+
raise DashboardException('Unable to get realm name from daemon',
1991+
http_status_code=500, component='rgw')
1992+
if realm_name:
1993+
rgw_multisite_sync_status_cmd.extend(['--rgw-realm', realm_name])
19861994
try:
19871995
exit_code, out, _ = mgr.send_rgwadmin_command(rgw_multisite_sync_status_cmd, False)
19881996
if exit_code > 0:

0 commit comments

Comments
 (0)