Skip to content

Commit 0582fc5

Browse files
authored
Merge pull request ceph#65676 from Hezko/nvmeof-cli-ns-add-size-params2
mgr/dashboard: raise exception if both size and rbd_image_size are being passed in ns add Reviewed-by: Afreen Misbah <[email protected]>
2 parents 4807e02 + 3ff7d73 commit 0582fc5

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/pybind/mgr/dashboard/controllers/nvmeof.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from orchestrator import OrchestratorError
88

99
from .. import mgr
10+
from ..exceptions import DashboardException
1011
from ..model import nvmeof as model
1112
from ..security import Scope
1213
from ..services.nvmeof_cli import NvmeofCLICommand, convert_to_bytes
@@ -435,13 +436,13 @@ def io_stats(self, nqn: str, nsid: str, gw_group: Optional[str] = None,
435436
)
436437

437438
@EndpointDoc(
438-
"Create a new NVMeoF namespace",
439+
"Create a new NVMeoF namespace.",
439440
parameters={
440441
"nqn": Param(str, "NVMeoF subsystem NQN"),
441442
"rbd_pool": Param(str, "RBD pool name"),
442443
"rbd_image_name": Param(str, "RBD image name"),
443444
"create_image": Param(bool, "Create RBD image"),
444-
"size": Param(int, "RBD image size"),
445+
"size": Param(int, "Deprecated. Use `rbd_image_size` instead"),
445446
"rbd_image_size": Param(int, "RBD image size"),
446447
"trash_image": Param(bool, "Trash the RBD image when namespace is removed"),
447448
"block_size": Param(int, "NVMeoF namespace block size"),
@@ -523,6 +524,14 @@ def create_cli(
523524
gw_group: Optional[str] = None,
524525
traddr: Optional[str] = None,
525526
):
527+
if size and rbd_image_size:
528+
raise DashboardException(
529+
msg="Can use size or rbd_image_size but not both",
530+
code="can_use_size_or_rbd_image_size_but_not_both",
531+
http_status_code=400,
532+
component="nvmeof",
533+
)
534+
526535
size_b = rbd_image_size_b = None
527536
if size:
528537
size_b = convert_to_bytes(size, default_unit='MB')

src/pybind/mgr/dashboard/openapi.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9395,7 +9395,7 @@ paths:
93959395
description: Read only namespace
93969396
type: string
93979397
size:
9398-
description: RBD image size
9398+
description: Deprecated. Use `rbd_image_size` instead
93999399
type: integer
94009400
traddr:
94019401
description: Target gateway address
@@ -9429,7 +9429,7 @@ paths:
94299429
trace.
94309430
security:
94319431
- jwt: []
9432-
summary: Create a new NVMeoF namespace
9432+
summary: Create a new NVMeoF namespace.
94339433
tags:
94349434
- NVMe-oF Subsystem Namespace
94359435
/api/nvmeof/subsystem/{nqn}/namespace/{nsid}:

0 commit comments

Comments
 (0)