Skip to content

Commit ee37978

Browse files
author
Tomer Haskalovitch
committed
mgr/dashboard: add nsid param to ns add command
Signed-off-by: Tomer Haskalovitch <[email protected]>
1 parent 6c0b03b commit ee37978

File tree

2 files changed

+12
-41
lines changed

2 files changed

+12
-41
lines changed

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

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,10 @@ def io_stats(self, nqn: str, nsid: str, gw_group: Optional[str] = None,
441441
"trash_image": Param(bool, "Trash the RBD image when namespace is removed"),
442442
"block_size": Param(int, "NVMeoF namespace block size"),
443443
"load_balancing_group": Param(int, "Load balancing group"),
444+
"disable_auto_resize": Param(str, "Disable auto resize", True, None),
445+
"read_only": Param(str, "Read only namespace", True, None),
444446
"gw_group": Param(str, "NVMeoF gateway group", True, None),
447+
"traddr": Param(str, "Target gateway address", True, None),
445448
"force": Param(
446449
bool,
447450
"Force create namespace even it image is used by other namespace"
@@ -459,44 +462,7 @@ def create(
459462
nqn: str,
460463
rbd_image_name: str,
461464
rbd_pool: str = "rbd",
462-
create_image: Optional[bool] = False,
463-
size: Optional[int] = 1024,
464-
rbd_image_size: Optional[int] = None,
465-
trash_image: Optional[bool] = False,
466-
block_size: int = 512,
467-
load_balancing_group: Optional[int] = None,
468-
force: Optional[bool] = False,
469-
no_auto_visible: Optional[bool] = False,
470-
disable_auto_resize: Optional[bool] = False,
471-
read_only: Optional[bool] = False,
472-
gw_group: Optional[str] = None,
473-
traddr: Optional[str] = None,
474-
):
475-
return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.namespace_add(
476-
NVMeoFClient.pb2.namespace_add_req(
477-
subsystem_nqn=nqn,
478-
rbd_image_name=rbd_image_name,
479-
rbd_pool_name=rbd_pool,
480-
block_size=block_size,
481-
create_image=create_image,
482-
size=rbd_image_size or size,
483-
trash_image=trash_image,
484-
anagrpid=load_balancing_group,
485-
force=force,
486-
no_auto_visible=no_auto_visible,
487-
disable_auto_resize=disable_auto_resize,
488-
read_only=read_only
489-
)
490-
)
491-
492-
@NvmeofCLICommand("nvmeof ns add", model.NamespaceCreation)
493-
@convert_to_model(model.NamespaceCreation)
494-
@handle_nvmeof_error
495-
def create_cli(
496-
self,
497-
nqn: str,
498-
rbd_image_name: str,
499-
rbd_pool: str = "rbd",
465+
nsid: Optional[str] = None,
500466
create_image: Optional[bool] = False,
501467
size: Optional[str] = None,
502468
rbd_image_size: Optional[str] = None,
@@ -518,6 +484,7 @@ def create_cli(
518484
return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.namespace_add(
519485
NVMeoFClient.pb2.namespace_add_req(
520486
subsystem_nqn=nqn,
487+
nsid=int(nsid) if nsid else None,
521488
rbd_image_name=rbd_image_name,
522489
rbd_pool_name=rbd_pool,
523490
block_size=block_size,

src/pybind/mgr/dashboard/openapi.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9351,7 +9351,8 @@ paths:
93519351
type: boolean
93529352
disable_auto_resize:
93539353
default: false
9354-
type: integer
9354+
description: Disable auto resize
9355+
type: string
93559356
force:
93569357
default: false
93579358
description: Force create namespace even it image is used by other
@@ -9367,6 +9368,8 @@ paths:
93679368
default: false
93689369
description: Namespace will be visible only for the allowed hosts
93699370
type: boolean
9371+
nsid:
9372+
type: string
93709373
rbd_image_name:
93719374
description: RBD image name
93729375
type: string
@@ -9379,12 +9382,13 @@ paths:
93799382
type: string
93809383
read_only:
93819384
default: false
9382-
type: boolean
9385+
description: Read only namespace
9386+
type: string
93839387
size:
9384-
default: 1024
93859388
description: RBD image size
93869389
type: integer
93879390
traddr:
9391+
description: Target gateway address
93889392
type: string
93899393
trash_image:
93909394
default: false

0 commit comments

Comments
 (0)