]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: bug fixes for rbd mirroring edit and promotion/demotion 48806/head
authorPedro Gonzalez Gomez <pegonzal@redhat.com>
Tue, 25 Oct 2022 13:43:42 +0000 (15:43 +0200)
committerPedro Gonzalez Gomez <pegonzal@redhat.com>
Wed, 9 Nov 2022 07:42:51 +0000 (08:42 +0100)
Signed-off-by: Pedro Gonzalez Gomez <pegonzal@redhat.com>
(cherry picked from commit b1b9d72b754e8d532614ad9d078f7ebedf4037d5)

src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts

index 5df73d93fe1ee4142c022dc854f564f4fdcdbaa6..7f7815c00ac922591efbd291714f9878ee3cd4a4 100644 (file)
@@ -457,6 +457,24 @@ describe('RbdFormComponent', () => {
         expect(exclusiveLocks.checked).toBe(true);
         expect(exclusiveLocks.disabled).toBe(true);
       });
+
+      it('should have journaling feature for journaling mirror mode on createRequest', () => {
+        component.mirroring = true;
+        fixture.detectChanges();
+        const journal = fixture.debugElement.query(By.css('#journal')).nativeElement;
+        expect(journal.checked).toBe(true);
+        const request = component.createRequest();
+        expect(request.features).toContain('journaling');
+      });
+
+      it('should have journaling feature for journaling mirror mode on editRequest', () => {
+        component.mirroring = true;
+        fixture.detectChanges();
+        const journal = fixture.debugElement.query(By.css('#journal')).nativeElement;
+        expect(journal.checked).toBe(true);
+        const request = component.editRequest();
+        expect(request.features).toContain('journaling');
+      });
     });
   });
 });
index 4fa71646215fafe9f6603309d04818892c97651b..f6c6af57947a8aa7572914372579a582300b4dd3 100644 (file)
@@ -690,18 +690,17 @@ export class RbdFormComponent extends CdForm implements OnInit {
       }
     });
     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();
index 983f39ed9be523e7ef53bad5d6f1841cc1a4f558..a24e59f8203d10627b4c76923d92438d7252db8b 100644 (file)
@@ -549,6 +549,7 @@ export class RbdListComponent extends ListWithDetails implements OnInit {
   actionPrimary(primary: boolean) {
     const request = new RbdFormEditRequestModel();
     request.primary = primary;
+    request.features = null;
     const imageSpec = new ImageSpec(
       this.selection.first().pool_name,
       this.selection.first().namespace,