}>(1);
pool: string;
+ peerConfigured = false;
advancedEnabled = false;
return acc;
}, {})
),
- mirroring: new FormControl(false),
+ mirroring: new FormControl(''),
schedule: new FormControl('', {
validators: [Validators.pattern(/^([0-9]+)d|([0-9]+)h|([0-9]+)m$/)] // check schedule interval to be in format - 1d or 1h or 1m
}),
- mirroringMode: new FormControl(this.mirroringOptions[0]),
+ mirroringMode: new FormControl(''),
stripingUnit: new FormControl(this.defaultStripingUnit),
stripingCount: new FormControl(this.defaultStripingCount, {
updateOn: 'blur'
setMirrorMode() {
this.mirroring = !this.mirroring;
this.setExclusiveLock();
+ this.checkPeersConfigured();
+ }
+
+ checkPeersConfigured(poolname?: string) {
+ const poolName = poolname ? poolname : this.rbdForm.get('pool').value;
+ this.rbdMirroringService.getPeerForPool(poolName).subscribe((resp: any) => {
+ if (resp.length > 0) {
+ this.peerConfigured = true;
+ }
+ });
}
setPoolMirrorMode() {
this.mirroring = false;
this.rbdForm.get('mirroring').setValue(this.mirroring);
this.rbdForm.get('mirroring').disable();
- } else if (this.mode !== this.rbdFormMode.editing) {
- this.rbdForm.get('mirroring').enable();
- this.mirroring = true;
- this.rbdForm.get('mirroring').setValue(this.mirroring);
}
});
}
this.snapName = decodeURIComponent(params.snap);
}
promises['rbd'] = this.rbdService.get(imageSpec);
+ this.checkPeersConfigured(imageSpec.poolName);
});
} else {
// New image
request.name = this.rbdForm.getValue('name');
request.schedule_interval = this.rbdForm.getValue('schedule');
request.size = this.formatter.toBytes(this.rbdForm.getValue('size'));
+
if (this.poolMirrorMode === 'image') {
request.mirror_mode = this.rbdForm.getValue('mirroringMode');
}
}
});
request.enable_mirror = this.rbdForm.getValue('mirroring');
- if (this.poolMirrorMode === 'image') {
- if (request.enable_mirror) {
+ if (request.enable_mirror) {
+ if (this.rbdForm.getValue('mirroringMode') === 'journal') {
+ request.features.push('journaling');
+ }
+ if (this.poolMirrorMode === 'image') {
request.mirror_mode = this.rbdForm.getValue('mirroringMode');
}
} else {
- if (request.enable_mirror) {
- request.features.push('journaling');
- } else {
- const index = request.features.indexOf('journaling', 0);
- if (index > -1) {
- request.features.splice(index, 1);
- }
+ const index = request.features.indexOf('journaling', 0);
+ if (index > -1) {
+ request.features.splice(index, 1);
}
}
request.configuration = this.getDirtyConfigurationValues();