]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard:[NFS] add Subvolume Groups and Subvolumes in "Edit NFS Export" form
authorDnyaneshwari <dnyaneshwari@li-9c9fbecc-2d5c-11b2-a85c-e2a7cc8a424f.ibm.com>
Wed, 6 Aug 2025 09:42:43 +0000 (15:12 +0530)
committerJon <jonathan.bailey1@ibm.com>
Fri, 3 Oct 2025 13:31:28 +0000 (14:31 +0100)
Fixes: https://tracker.ceph.com/issues/72435
Signed-off-by: Dnyaneshwari Talwekar <dtalweka@redhat.com>
(cherry picked from commit aa7a586c5690e26bfc99687a601f8c0c3c221aa7)

src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts

index 6b091e14639dc64e043b36a0fa8d345da614ee2e..0da4913e9b8a417627baf5f48c5528dccd6b0ef0 100644 (file)
       </div>
 
       <div class="form-item"
-           *ngIf="storageBackend === 'CEPH' && nfsForm.getValue('fsal').fs_name && !this.isEdit">
+           *ngIf="storageBackend === 'CEPH' && nfsForm.getValue('fsal').fs_name">
         <cds-select formControlName="subvolume_group"
                     name="subvolume_group"
                     for="subvolume_group"
       </div>
 
     <div class="form-group row"
-         *ngIf="storageBackend === 'CEPH' && nfsForm.getValue('fsal').fs_name && !this.isEdit">
+         *ngIf="storageBackend === 'CEPH' && nfsForm.getValue('fsal').fs_name">
       <cds-select formControlName="subvolume"
                   name="subvolume"
                   for="subvolume"
index 2d6dffcb298347a4300cca2aad89d996f2e4c54d..65e3f3acc9f5cd2e3bab9a4bab42005f67cdb2b4 100644 (file)
@@ -188,6 +188,7 @@ export class NfsFormComponent extends CdForm implements OnInit {
   async getSubVol() {
     const fs_name = this.nfsForm.getValue('fsal').fs_name;
     const subvolgrp = this.nfsForm.getValue('subvolume_group');
+
     await this.setSubVolGrpPath();
 
     (subvolgrp === this.defaultSubVolGroup
@@ -264,7 +265,7 @@ export class NfsFormComponent extends CdForm implements OnInit {
     const subVolumeControl = this.nfsForm.get('subvolume');
 
     // SubVolume is required if SubVolume Group is "_nogroup".
-    if (subvolumeGroup == this.defaultSubVolGroup) {
+    if (subvolumeGroup === DEFAULT_SUBVOLUME_GROUP) {
       subVolumeControl?.setValidators([Validators.required]);
     } else {
       subVolumeControl?.clearValidators();
@@ -401,6 +402,31 @@ export class NfsFormComponent extends CdForm implements OnInit {
     this.nfsForm.patchValue(res);
     this.setPathValidation();
     this.clients = res.clients;
+
+    if (this.isEdit) {
+      if (res?.fsal?.name === SUPPORTED_FSAL.CEPH && res?.path) {
+        this.getSubVolGrp(res.fsal.fs_name);
+        this.resolveCephfsPath(res.path, res.fsal.fs_name);
+      }
+    }
+  }
+
+  // Setting up Subvolumegroup and Subvolume for CephFS paths on Edit.
+  resolveCephfsPath(path: string, fsName: string) {
+    if (!path?.startsWith('/volumes/')) return;
+
+    const splitPath = path.split('/');
+    const subvolumeGroup = splitPath[2] ?? null;
+    const subvolume = splitPath[3] ?? null;
+
+    this.nfsForm.patchValue({
+      fsal: {
+        ...this.nfsForm.get('fsal').value,
+        fs_name: fsName
+      },
+      subvolumeGroup,
+      subvolume
+    });
   }
 
   resolveClusters(clusters: string[]) {