Skip to content

Commit 3185575

Browse files
authored
Merge pull request ceph#64858 from rhcs-dashboard/edit-nfs-export
mgr/dashboard:[NFS] Missing Subvolume Groups and Subvolumes on Edit NFS Export. Reviewed-by: Naman Munet <[email protected]>
2 parents 99ef4dc + aa7a586 commit 3185575

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
</div>
154154

155155
<div class="form-item"
156-
*ngIf="storageBackend === 'CEPH' && nfsForm.getValue('fsal').fs_name && !this.isEdit">
156+
*ngIf="storageBackend === 'CEPH' && nfsForm.getValue('fsal').fs_name">
157157
<cds-select formControlName="subvolume_group"
158158
name="subvolume_group"
159159
for="subvolume_group"
@@ -174,7 +174,7 @@
174174
</div>
175175

176176
<div class="form-group row"
177-
*ngIf="storageBackend === 'CEPH' && nfsForm.getValue('fsal').fs_name && !this.isEdit">
177+
*ngIf="storageBackend === 'CEPH' && nfsForm.getValue('fsal').fs_name">
178178
<cds-select formControlName="subvolume"
179179
name="subvolume"
180180
for="subvolume"

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

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ export class NfsFormComponent extends CdForm implements OnInit {
188188
async getSubVol() {
189189
const fs_name = this.nfsForm.getValue('fsal').fs_name;
190190
const subvolgrp = this.nfsForm.getValue('subvolume_group');
191+
191192
await this.setSubVolGrpPath();
192193

193194
(subvolgrp === this.defaultSubVolGroup
@@ -264,7 +265,7 @@ export class NfsFormComponent extends CdForm implements OnInit {
264265
const subVolumeControl = this.nfsForm.get('subvolume');
265266

266267
// SubVolume is required if SubVolume Group is "_nogroup".
267-
if (subvolumeGroup == this.defaultSubVolGroup) {
268+
if (subvolumeGroup === DEFAULT_SUBVOLUME_GROUP) {
268269
subVolumeControl?.setValidators([Validators.required]);
269270
} else {
270271
subVolumeControl?.clearValidators();
@@ -401,6 +402,31 @@ export class NfsFormComponent extends CdForm implements OnInit {
401402
this.nfsForm.patchValue(res);
402403
this.setPathValidation();
403404
this.clients = res.clients;
405+
406+
if (this.isEdit) {
407+
if (res?.fsal?.name === SUPPORTED_FSAL.CEPH && res?.path) {
408+
this.getSubVolGrp(res.fsal.fs_name);
409+
this.resolveCephfsPath(res.path, res.fsal.fs_name);
410+
}
411+
}
412+
}
413+
414+
// Setting up Subvolumegroup and Subvolume for CephFS paths on Edit.
415+
resolveCephfsPath(path: string, fsName: string) {
416+
if (!path?.startsWith('/volumes/')) return;
417+
418+
const splitPath = path.split('/');
419+
const subvolumeGroup = splitPath[2] ?? null;
420+
const subvolume = splitPath[3] ?? null;
421+
422+
this.nfsForm.patchValue({
423+
fsal: {
424+
...this.nfsForm.get('fsal').value,
425+
fs_name: fsName
426+
},
427+
subvolumeGroup,
428+
subvolume
429+
});
404430
}
405431

406432
resolveClusters(clusters: string[]) {

0 commit comments

Comments
 (0)