From: Gil Bregman Date: Thu, 30 Jul 2026 13:42:04 +0000 (+0300) Subject: mgr/dashboard: Add namespace unpin command to NVMEoF CLI X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=aff50f2cf7e2836f3f9382717d82080656ccdcd8;p=ceph.git mgr/dashboard: Add namespace unpin command to NVMEoF CLI Fixes: https://tracker.ceph.com/issues/78459 Signed-off-by: Gil Bregman --- diff --git a/src/pybind/mgr/dashboard/controllers/nvmeof.py b/src/pybind/mgr/dashboard/controllers/nvmeof.py index 87fba37f25cc..47d1034e49f5 100644 --- a/src/pybind/mgr/dashboard/controllers/nvmeof.py +++ b/src/pybind/mgr/dashboard/controllers/nvmeof.py @@ -1044,6 +1044,7 @@ else: @APIRouter("/nvmeof/subsystem/{nqn}/namespace", Scope.NVME_OF) @APIDoc("NVMe-oF Subsystem Namespace Management API", "NVMe-oF Subsystem Namespace") + # pylint: disable=too-many-public-methods class NVMeoFNamespace(RESTController): @pick("namespaces") @NvmeofCLICommand( @@ -2059,6 +2060,51 @@ else: ) ) + @ReadPermission + @Endpoint('PUT', '{nsid}/unpin') + @NvmeofCLICommand( + "nvmeof namespace unpin", + model=model.RequestStatus, + alias="nvmeof ns unpin", + success_message_template=( + 'Unpinning load balancing group for namespace {nsid} ' + 'in {nqn}: Successful' + ), + ) + @EndpointDoc( + "Unpin namespace load balancing group", + parameters={ + "nqn": Param(str, "NVMeoF subsystem NQN"), + "nsid": Param(str, "NVMeoF Namespace ID"), + "gw_group": Param(str, "NVMeoF gateway group", True, None), + "server_address": Param(str, "NVMeoF gateway address", True, None), + "traddr": Param(str, "NVMeoF gateway address (deprecated)", True, None), + }, + ) + @convert_to_model(model.RequestStatus) + @handle_nvmeof_error + def unpin_ns( + self, + nqn: str, + nsid: str, + gw_group: Optional[str] = None, + server_address: Optional[str] = None, + traddr: Optional[str] = None + ): + server_address = resolve_nvmeof_server_address( + server_address=server_address, + traddr=traddr + ) + return NVMeoFClient( + gw_group=gw_group, + server_address=server_address + ).stub.namespace_unpin( + NVMeoFClient.pb2.namespace_unpin_req( + subsystem_nqn=nqn, + nsid=int(nsid), + ) + ) + @pick("namespaces", first=True) @NvmeofCLICommand( "nvmeof namespace update", model.NamespaceList, alias="nvmeof ns update" diff --git a/src/pybind/mgr/dashboard/openapi.yaml b/src/pybind/mgr/dashboard/openapi.yaml index 9f72a7ec7c13..8031f45fec5d 100644 --- a/src/pybind/mgr/dashboard/openapi.yaml +++ b/src/pybind/mgr/dashboard/openapi.yaml @@ -15620,6 +15620,69 @@ paths: to all or selected hosts tags: - NVMe-oF Subsystem Namespace + /api/nvmeof/subsystem/{nqn}/namespace/{nsid}/unpin: + put: + parameters: + - description: NVMeoF subsystem NQN + in: path + name: nqn + required: true + schema: + type: string + - description: NVMeoF Namespace ID + in: path + name: nsid + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + gw_group: + description: NVMeoF gateway group + type: string + server_address: + description: NVMeoF gateway address + type: string + traddr: + description: NVMeoF gateway address (deprecated) + type: string + type: object + responses: + '200': + content: + application/json: + schema: + type: object + application/vnd.ceph.api.v1.0+json: + schema: + type: object + description: Resource updated. + '202': + content: + application/json: + schema: + type: object + application/vnd.ceph.api.v1.0+json: + schema: + type: object + description: Operation is still executing. Please check the task queue. + '400': + description: Operation exception. Please check the response body for details. + '401': + description: Unauthenticated access. Please login first. + '403': + description: Unauthorized access. Please check your permissions. + '500': + description: Unexpected error. Please check the response body for the stack + trace. + security: + - jwt: [] + summary: Unpin namespace load balancing group + tags: + - NVMe-oF Subsystem Namespace /api/osd: get: parameters: