From 7c1f623c43936bbf5f2e8f77d59c3dc60d2bab5b Mon Sep 17 00:00:00 2001 From: Sagar Gopale Date: Mon, 9 Mar 2026 17:52:41 +0530 Subject: [PATCH] mgr/dashboard: fix add host API path for namespace mapping in NVMe/TCP fixes: https://tracker.ceph.com/issues/75407 Signed-off-by: Sagar Gopale --- .../src/app/shared/api/nvmeof.service.spec.ts | 12 ++++++++++++ .../frontend/src/app/shared/api/nvmeof.service.ts | 10 +++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.spec.ts index 9ce80fcd448f..70b7dcc2a29c 100755 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.spec.ts @@ -285,6 +285,18 @@ describe('NvmeofService', () => { ); expect(req.request.method).toBe('DELETE'); }); + + it('should call addNamespaceInitiators with UI namespace host endpoint', () => { + const request = { + subsystem_nqn: mockNQN, + host_nqn: 'nqn.2014-08.org.nvmexpress:uuid:11111111-1111-1111-1111-111111111111', + gw_group: mockGroupName + }; + service.addNamespaceInitiators(mockNsid, request).subscribe(); + const req = httpTesting.expectOne(`${UI_API_PATH}/namespace/${mockNsid}/host`); + expect(req.request.method).toBe('POST'); + expect(req.request.body).toEqual(request); + }); }); describe('getHostsForGroup', () => { 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 8fc6b43eba83..ba5810aba7b0 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 @@ -223,13 +223,9 @@ export class NvmeofService { } addNamespaceInitiators(nsid: number | string, request: NamespaceInitiatorRequest) { - return this.http.post( - `${UI_API_PATH}/subsystem/${request.subsystem_nqn}/namespace/${nsid}/host`, - request, - { - observe: 'response' - } - ); + return this.http.post(`${UI_API_PATH}/namespace/${nsid}/host`, request, { + observe: 'response' + }); } updateHostKey(subsystemNQN: string, request: InitiatorRequest) { -- 2.47.3