]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: raise exception if both size and rbd_image_size are being passed in... 65676/head
authorTomer Haskalovitch <tomer.haska@ibm.com>
Thu, 18 Sep 2025 07:58:44 +0000 (10:58 +0300)
committerHezko <tomer.haska@gmail.com>
Tue, 30 Sep 2025 07:48:24 +0000 (10:48 +0300)
Signed-off-by: Tomer Haskalovitch <tomer.haska@ibm.com>
src/pybind/mgr/dashboard/controllers/nvmeof.py
src/pybind/mgr/dashboard/openapi.yaml

index a26cbe3056d87fbcfed7c1140376fafbebd50fd7..643b2914ae126f1e5ec23b8ce548257b7a3cb3b2 100644 (file)
@@ -7,6 +7,7 @@ import cherrypy
 from orchestrator import OrchestratorError
 
 from .. import mgr
+from ..exceptions import DashboardException
 from ..model import nvmeof as model
 from ..security import Scope
 from ..services.nvmeof_cli import NvmeofCLICommand, convert_to_bytes
@@ -430,13 +431,13 @@ else:
             "nvmeof namespace add", model.NamespaceCreation, alias="nvmeof ns add"
         )
         @EndpointDoc(
-            "Create a new NVMeoF namespace",
+            "Create a new NVMeoF namespace.",
             parameters={
                 "nqn": Param(str, "NVMeoF subsystem NQN"),
                 "rbd_pool": Param(str, "RBD pool name"),
                 "rbd_image_name": Param(str, "RBD image name"),
                 "create_image": Param(bool, "Create RBD image"),
-                "size": Param(int, "RBD image size"),
+                "size": Param(int, "Deprecated. Use `rbd_image_size` instead"),
                 "rbd_image_size": Param(int, "RBD image size"),
                 "trash_image": Param(bool, "Trash the RBD image when namespace is removed"),
                 "block_size": Param(int, "NVMeoF namespace block size"),
@@ -476,6 +477,14 @@ else:
             gw_group: Optional[str] = None,
             traddr: Optional[str] = None,
         ):
+            if size and rbd_image_size:
+                raise DashboardException(
+                    msg="Can use size or rbd_image_size but not both",
+                    code="can_use_size_or_rbd_image_size_but_not_both",
+                    http_status_code=400,
+                    component="nvmeof",
+                )
+
             size_b = rbd_image_size_b = None
             if size:
                 size_b = convert_to_bytes(size, default_unit='MB')
index d6a8011179801401dace9d3bc6c542dfbe893bb3..56bdeb6dec9bf41de618b7c900a976a417232223 100755 (executable)
@@ -9385,7 +9385,7 @@ paths:
                   description: Read only namespace
                   type: string
                 size:
-                  description: RBD image size
+                  description: Deprecated. Use `rbd_image_size` instead
                   type: integer
                 traddr:
                   description: Target gateway address
@@ -9419,7 +9419,7 @@ paths:
             trace.
       security:
       - jwt: []
-      summary: Create a new NVMeoF namespace
+      summary: Create a new NVMeoF namespace.
       tags:
       - NVMe-oF Subsystem Namespace
   /api/nvmeof/subsystem/{nqn}/namespace/{nsid}: