From d29084085bab52ef6eba224d35b58c44b6157ef6 Mon Sep 17 00:00:00 2001 From: Afreen Misbah Date: Mon, 17 Nov 2025 10:31:45 +0530 Subject: [PATCH] mgr/dashboard: Set max subsystem count to 512 rather than 4096 Fixes https://tracker.ceph.com/issues/73867 - regression from https://github.com/ceph/ceph/pull/64477/files - removing frontend valdations as this values are volatiel and require changes every release. Nvmeof is seeting these and validating as well. Signed-off-by: Afreen Misbah --- ...vmeof-subsystems-details.component.spec.ts | 3 ++- .../nvmeof-subsystems-form.component.html | 3 --- .../nvmeof-subsystems-form.component.spec.ts | 19 ++++++++++++++----- .../nvmeof-subsystems-form.component.ts | 13 ++++++------- .../src/app/shared/api/nvmeof.service.ts | 2 +- 5 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-details/nvmeof-subsystems-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-details/nvmeof-subsystems-details.component.spec.ts index 563ef314386fb..12ba23ed72068 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-details/nvmeof-subsystems-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-details/nvmeof-subsystems-details.component.spec.ts @@ -6,6 +6,7 @@ import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; import { Permissions } from '~/app/shared/models/permissions'; import { SharedModule } from '~/app/shared/shared.module'; import { NvmeofSubsystemsDetailsComponent } from './nvmeof-subsystems-details.component'; +import { DEFAULT_MAX_NAMESPACE_PER_SUBSYSTEM } from '~/app/shared/api/nvmeof.service'; describe('NvmeofSubsystemsDetailsComponent', () => { let component: NvmeofSubsystemsDetailsComponent; @@ -27,7 +28,7 @@ describe('NvmeofSubsystemsDetailsComponent', () => { subtype: 'NVMe', nqn: 'nqn.2001-07.com.ceph:1720603703820', namespace_count: 1, - max_namespaces: 4096 + max_namespaces: DEFAULT_MAX_NAMESPACE_PER_SUBSYSTEM }; component.permissions = new Permissions({ grafana: ['read'] diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.html index 5ccc48eeeaef4..4bb762e9ea5f1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.html @@ -53,9 +53,6 @@ The value must be at least 1. - The value cannot be greater than {{defaultMaxNamespace}}. The value must be a positive integer. diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.spec.ts index af178560b30ca..45e5a59b9d700 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.spec.ts @@ -11,7 +11,10 @@ import { CdFormGroup } from '~/app/shared/forms/cd-form-group'; import { SharedModule } from '~/app/shared/shared.module'; import { NvmeofSubsystemsFormComponent } from './nvmeof-subsystems-form.component'; import { FormHelper } from '~/testing/unit-test-helper'; -import { MAX_NAMESPACE, NvmeofService } from '~/app/shared/api/nvmeof.service'; +import { + DEFAULT_MAX_NAMESPACE_PER_SUBSYSTEM, + NvmeofService +} from '~/app/shared/api/nvmeof.service'; describe('NvmeofSubsystemsFormComponent', () => { let component: NvmeofSubsystemsFormComponent; @@ -61,7 +64,7 @@ describe('NvmeofSubsystemsFormComponent', () => { component.onSubmit(); expect(nvmeofService.createSubsystem).toHaveBeenCalledWith({ nqn: expectedNqn, - max_namespaces: MAX_NAMESPACE, + max_namespaces: DEFAULT_MAX_NAMESPACE_PER_SUBSYSTEM, enable_ha: true, gw_group: mockGroupName }); @@ -79,10 +82,16 @@ describe('NvmeofSubsystemsFormComponent', () => { formHelper.expectError('max_namespaces', 'pattern'); }); - it(`should give error on max_namespaces greater than ${MAX_NAMESPACE}`, () => { - formHelper.setValue('max_namespaces', 6000); + it(`should not give error on max_namespaces greater than ${DEFAULT_MAX_NAMESPACE_PER_SUBSYSTEM}`, () => { + const expectedNqn = 'nqn.2001-07.com.ceph:' + mockTimestamp; + formHelper.setValue('max_namespaces', 600); component.onSubmit(); - formHelper.expectError('max_namespaces', 'max'); + expect(nvmeofService.createSubsystem).toHaveBeenCalledWith({ + nqn: expectedNqn, + max_namespaces: DEFAULT_MAX_NAMESPACE_PER_SUBSYSTEM, + enable_ha: true, + gw_group: mockGroupName + }); }); it('should give error on max_namespaces lesser than 1', () => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.ts index 7e5b064f37929..5de7f1b80d89b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.ts @@ -10,7 +10,10 @@ import { AuthStorageService } from '~/app/shared/services/auth-storage.service'; import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service'; import { FinishedTask } from '~/app/shared/models/finished-task'; import { ActivatedRoute, Router } from '@angular/router'; -import { MAX_NAMESPACE, NvmeofService } from '~/app/shared/api/nvmeof.service'; +import { + DEFAULT_MAX_NAMESPACE_PER_SUBSYSTEM, + NvmeofService +} from '~/app/shared/api/nvmeof.service'; @Component({ selector: 'cd-nvmeof-subsystems-form', @@ -23,7 +26,7 @@ export class NvmeofSubsystemsFormComponent implements OnInit { action: string; resource: string; pageURL: string; - defaultMaxNamespace: number = MAX_NAMESPACE; + defaultMaxNamespace: number = DEFAULT_MAX_NAMESPACE_PER_SUBSYSTEM; group: string; constructor( @@ -81,11 +84,7 @@ export class NvmeofSubsystemsFormComponent implements OnInit { ] }), max_namespaces: new UntypedFormControl(this.defaultMaxNamespace, { - validators: [ - CdValidators.number(false), - Validators.max(this.defaultMaxNamespace), - Validators.min(1) - ] + validators: [CdValidators.number(false), Validators.min(1)] }) }); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.ts index 02d0030d6cff5..af69d001a77d5 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.ts @@ -6,7 +6,7 @@ import { Observable, of as observableOf } from 'rxjs'; import { catchError, mapTo } from 'rxjs/operators'; import { CephServiceSpec } from '../models/service.interface'; -export const MAX_NAMESPACE = 4096; +export const DEFAULT_MAX_NAMESPACE_PER_SUBSYSTEM = 512; export type GatewayGroup = CephServiceSpec; -- 2.39.5