Skip to content

Commit

Permalink
Merge pull request ceph#52005 from rhcs-dashboard/entries
Browse files Browse the repository at this point in the history
mgr/dashboard: n/a entries behind primary snapshot mode

Reviewed-by: Avan Thakkar <[email protected]>
Reviewed-by: Nizamudeen A <[email protected]>
  • Loading branch information
nizamial09 authored Aug 28, 2023
2 parents ff52188 + 6066e37 commit 9850387
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
17 changes: 15 additions & 2 deletions src/pybind/mgr/dashboard/controllers/rbd_mirroring.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,17 @@ class ReplayingData(NamedTuple):
entries_behind_primary: Optional[int] = None


def _get_mirror_mode(ioctx, image_name):
with rbd.Image(ioctx, image_name) as img:
mirror_mode = img.mirror_image_get_mode()
mirror_mode_str = 'Disabled'
if mirror_mode == rbd.RBD_MIRROR_IMAGE_MODE_JOURNAL:
mirror_mode_str = 'journal'
elif mirror_mode == rbd.RBD_MIRROR_IMAGE_MODE_SNAPSHOT:
mirror_mode_str = 'snapshot'
return mirror_mode_str


@ViewCache()
@no_type_check
def _get_pool_datum(pool_name):
Expand Down Expand Up @@ -300,7 +311,8 @@ def _get_pool_datum(pool_name):
data['mirror_images'] = sorted([
dict({
'name': image['name'],
'description': image['description']
'description': image['description'],
'mirror_mode': _get_mirror_mode(ioctx, image['name'])
}, **mirror_state['down' if not image['up'] else image['state']])
for image in mirror_image_status
], key=lambda k: k['name'])
Expand Down Expand Up @@ -363,7 +375,8 @@ def _get_content_data(): # pylint: disable=R0914
'pool_name': pool_name,
'name': mirror_image['name'],
'state_color': mirror_image['state_color'],
'state': mirror_image['state']
'state': mirror_image['state'],
'mirror_mode': mirror_image['mirror_mode']
}

if mirror_image['health'] == 'ok':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,13 @@
[showValue]="true"></ngb-progressbar>
</div>
</ng-template>

<ng-template #entriesBehindPrimaryTpl
let-row="row"
let-value="value">
<span *ngIf="row.mirror_mode === 'journal'">
{{ value }}
</span>
<span *ngIf="row.mirror_mode === 'snapshot'"
ngbTooltip="Not available with mirroring snapshot mode">-</span>
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export class ImageListComponent implements OnInit, OnDestroy {
syncTmpl: TemplateRef<any>;
@ViewChild('progressTmpl', { static: true })
progressTmpl: TemplateRef<any>;
@ViewChild('entriesBehindPrimaryTpl', { static: true })
entriesBehindPrimaryTpl: TemplateRef<any>;

subs: Subscription;

Expand Down Expand Up @@ -66,7 +68,12 @@ export class ImageListComponent implements OnInit, OnDestroy {
flexGrow: 2
},
{ prop: 'bytes_per_second', name: $localize`Bytes per second`, flexGrow: 2 },
{ prop: 'entries_behind_primary', name: $localize`Entries behind primary`, flexGrow: 2 }
{
prop: 'entries_behind_primary',
name: $localize`Entries behind primary`,
cellTemplate: this.entriesBehindPrimaryTpl,
flexGrow: 2
}
];

this.image_ready.columns = [
Expand Down

0 comments on commit 9850387

Please sign in to comment.