@RbdTask('edit', ['{image_spec}', '{name}'], 4.0)
def set(self, image_spec, name=None, size=None, features=None,
configuration=None, enable_mirror=None, primary=None,
- resync=False, mirror_mode=None, schedule_interval='',
+ force=False, resync=False, mirror_mode=None, schedule_interval='',
remove_scheduling=False):
pool_name, namespace, image_name = parse_image_spec(image_spec)
if primary and not mirror_image_info['primary']:
RbdMirroringService.promote_image(
- image_name, pool_name, namespace)
+ image_name, pool_name, namespace, force)
elif primary is False and mirror_image_info['primary']:
RbdMirroringService.demote_image(
image_name, pool_name, namespace)
provisionedNotAvailableTooltipTpl: TemplateRef<any>;
@ViewChild('totalProvisionedNotAvailableTooltipTpl', { static: true })
totalProvisionedNotAvailableTooltipTpl: TemplateRef<any>;
+ @ViewChild('forcePromoteConfirmation', { static: true })
+ forcePromoteConfirmation: TemplateRef<any>;
permission: Permission;
tableActions: CdTableAction[];
count = 0;
private tableContext: CdTableFetchDataContext = null;
modalRef: NgbModalRef;
+ errorMessage: string;
builders = {
'rbd/create': (metadata: object) =>
}),
call: this.rbdService.update(imageSpec, request)
})
- .subscribe();
+ .subscribe(
+ () => {},
+ (error) => {
+ if (primary) {
+ this.errorMessage = error.error['detail'].replace(/\[.*?\]\s*/, '');
+ request.force = true;
+ this.modalRef = this.modalService.show(ConfirmationModalComponent, {
+ titleText: $localize`Warning`,
+ buttonText: $localize`Enforce`,
+ warning: true,
+ bodyTpl: this.forcePromoteConfirmation,
+ onSubmit: () => {
+ this.rbdService.update(imageSpec, request).subscribe(
+ () => {
+ this.modalRef.close();
+ },
+ () => {
+ this.modalRef.close();
+ }
+ );
+ }
+ });
+ }
+ }
+ );
}
hasSnapshots() {