]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: replace sync status bar with last synced timestamp in rgw multisite... 53272/head
authorAashish Sharma <aasharma@li-e74156cc-2f67-11b2-a85c-e98659a63c5c.ibm.com>
Mon, 4 Sep 2023 09:12:46 +0000 (14:42 +0530)
committerAashish Sharma <aasharma@li-e74156cc-2f67-11b2-a85c-e98659a63c5c.ibm.com>
Wed, 6 Sep 2023 05:41:53 +0000 (11:11 +0530)
Fixes: https://tracker.ceph.com/issues/62684
Signed-off-by: Aashish Sharma <aasharma@redhat.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-sync-data-info/rgw-sync-data-info.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-sync-metadata-info/rgw-sync-metadata-info.component.html
src/pybind/mgr/dashboard/services/rgw_client.py

index f6e247983db4ba9f2e57d19d314555eab76aa620..03f079c9c85dfd2a214b13a4961f8b278569c4ff 100644 (file)
@@ -17,6 +17,9 @@
   </ul>
 </ng-template>
 <ul class="me-2">
+  <ng-template #upToDateTpl>
+    <li class="badge badge-success">Up to Date</li>
+  </ng-template>
   <ng-template #showStatus>
     <a *ngIf="zone.syncstatus !== 'Not Syncing From Zone'"
        class="lead text-primary"
        placement="top"
        popoverClass="rgw-overview-card-popover"
        i18n>Error</a></li>
-  <li class="mt-4 w-100 text-center"
-      *ngIf="zone.syncstatus === 'preparing for full sync'">
-    <b>Full sync progress:</b>
-    <cd-usage-bar *ngIf="zone.fullSync"
-                  [total]="zone.fullSync[1]"
-                  [showMultisiteTooltip]="true"
-                  [used]="zone.fullSync[0]"
-                  [title]="shards"
-                  decimals="2">
-    </cd-usage-bar></li>
-  <li class="mt-4 w-100 text-center"
-      *ngIf="zone.incrementalSync">
-  <b>Sync Progress:</b>
-  <cd-usage-bar *ngIf="zone.incrementalSync"
-                [total]="zone.totalShards"
-                [showMultisiteTooltip]="true"
-                [used]="zone.usedShards"
-                [title]="shards"
-                decimals="2">
-  </cd-usage-bar></li>
+  <li class="mt-4 fw-bold">
+    Last Synced:
+  </li>
+  <li class="badge badge-info"
+      *ngIf="zone.timestamp; else upToDateTpl">{{ zone.timestamp | relativeDate }}</li>
 </ul>
index cf095c6ebf5a093848b9eb7d42d6165a9d53b2a4..9b489e124bfdb7ee485edbed1b8cffd0805a4a06 100644 (file)
@@ -7,6 +7,7 @@
 <span *ngIf="metadataSyncInfo !== 'no sync (zone is master)'">
   <ng-template #metadataSyncPopover>
     <ul class="text-center">
+      <li><h5><b>Metadata Sync Status:</b></h5></li>
       <li *ngFor="let status of metadataSyncInfo.fullSyncStatus">
         <span *ngIf="!status?.includes(metadataSyncInfo.syncstatus) && !status?.includes('failed') && !status?.includes('error')">
           <span *ngIf="status?.includes(':')">
@@ -23,6 +24,9 @@
     </ul>
   </ng-template>
   <ul class="me-2">
+    <ng-template #upToDateTpl>
+      <li class="badge badge-success">Up to Date</li>
+    </ng-template>
     <ng-template #showMetadataStatus>
       <a *ngIf="metadataSyncInfo.syncstatus !== 'Not Syncing From Zone'"
          class="lead text-primary"
          placement="top"
          popoverClass="rgw-overview-card-popover"
          i18n>Error</a></li>
-    <li class="mt-4 setwidth text-center"
-        *ngIf="metadataSyncInfo.syncstatus === 'preparing for full sync'">
-      <b>Full sync progress:</b>
-    <cd-usage-bar *ngIf="metadataSyncInfo.fullSync"
-                  [total]="metadataSyncInfo.fullSync[1]"
-                  [showMultisiteTooltip]="true"
-                  [used]="metadataSyncInfo.fullSync[0]"
-                  [title]="shards"
-                  decimals="2">
-    </cd-usage-bar></li>
-    <li class="mt-4 setwidth text-center"
-        *ngIf="metadataSyncInfo.incrementalSync">
-    <b>Sync Progress:</b>
-    <cd-usage-bar *ngIf="metadataSyncInfo.incrementalSync"
-                  [total]="metadataSyncInfo.totalShards"
-                  [showMultisiteTooltip]="true"
-                  [used]="metadataSyncInfo.usedShards"
-                  [title]="shards"
-                  decimals="2">
-    </cd-usage-bar></li>
+    <li class="mt-4 fw-bold">
+      Last Synced:
+    </li>
+    <li class="badge badge-info"
+        *ngIf="metadataSyncInfo.timestamp; else upToDateTpl">{{ metadataSyncInfo.timestamp | relativeDate }}</li>
   </ul>
 </span>
index 58496f9a487820f18a715fd7b41f1e411332fd9e..641392f9261becd323eb54a3cb95b1f659bd52f0 100644 (file)
@@ -1593,25 +1593,17 @@ class RgwMultisite:
 
         metadata_sync_data = {}
         metadata_sync_info_array = metadata_sync_info.split('\n') if metadata_sync_info else []
-        metadata_sync_data['syncstatus'] = metadata_sync_info_array[1].strip() if len(metadata_sync_info_array) > 1 else None  # noqa E501  #pylint: disable=line-too-long
+        metadata_sync_data['syncstatus'] = metadata_sync_info_array[0].strip() if len(metadata_sync_info_array) > 0 else None  # noqa E501  #pylint: disable=line-too-long
 
         for item in metadata_sync_info_array:
             self.extract_metadata_sync_info(metadata_sync_data, item)
 
-        metadata_sync_data['totalShards'] = metadata_sync_data['incrementalSync'][1] if len(metadata_sync_data['incrementalSync']) > 1 else 0  # noqa E501  #pylint: disable=line-too-long
-        metadata_sync_data['usedShards'] = int(metadata_sync_data['incrementalSync'][1]) - int(metadata_sync_data['behindShards'])  # noqa E501  #pylint: disable=line-too-long
+        metadata_sync_data['fullSyncStatus'] = metadata_sync_info_array
         return metadata_sync_data
 
     def extract_metadata_sync_info(self, metadata_sync_data, item):
-        if 'full sync' in item and item.endswith('shards'):
-            metadata_sync_data['fullSync'] = self.get_shards_info(item.strip()).split('/')
-        elif 'incremental sync' in item:
-            metadata_sync_data['incrementalSync'] = self.get_shards_info(item.strip()).split('/')
-        elif 'data is behind' in item or 'data is caught up' in item:
-            metadata_sync_data['dataSyncStatus'] = item.strip()
-
-            if 'data is behind' in item:
-                metadata_sync_data['behindShards'] = self.get_behind_shards(item)
+        if 'oldest incremental change not applied:' in item:
+            metadata_sync_data['timestamp'] = item.split('applied:')[1].split()[0].strip()
 
     def extract_datasync_info(self, data):
         metadata_sync_infoormation = data.split('metadata sync')[1] if 'metadata sync' in data else None  # noqa E501  #pylint: disable=line-too-long
@@ -1629,15 +1621,6 @@ class RgwMultisite:
         replica_zone_data['fullSyncStatus'] = datasync_info_array
         for item in datasync_info_array:
             self.extract_metadata_sync_info(replica_zone_data, item)
-
-        if 'incrementalSync' in replica_zone_data:
-            replica_zone_data['totalShards'] = int(replica_zone_data['incrementalSync'][1]) if len(replica_zone_data['incrementalSync']) > 1 else 0  # noqa E501  #pylint: disable=line-too-long
-
-            if 'behindShards' in replica_zone_data:
-                replica_zone_data['usedShards'] = (int(replica_zone_data['incrementalSync'][1]) - int(replica_zone_data['behindShards'])) if len(replica_zone_data['incrementalSync']) > 1 else 0  # noqa E501  #pylint: disable=line-too-long
-            else:
-                replica_zone_data['usedShards'] = replica_zone_data['totalShards']
-
         return replica_zone_data
 
     def get_primary_zonedata(self, data):
@@ -1648,21 +1631,3 @@ class RgwMultisite:
             return match.group(1)
 
         return ''
-
-    def get_shards_info(self, data):
-        regex = r'\d+/\d+'
-        match = re.search(regex, data)
-
-        if match:
-            return match.group(0)
-
-        return None
-
-    def get_behind_shards(self, data):
-        regex = r'on\s+(\d+)\s+shards'
-        match = re.search(regex, data, re.IGNORECASE)
-
-        if match:
-            return match.group(1)
-
-        return None