Skip to content

Commit 47cab0f

Browse files
authored
Merge pull request ceph#65503 from Hezko/nvmeof-cli-ns-add-nsid-param
mgr/dashboard: add nsid param to ns add command Reviewed-by: Nizamudeen A <[email protected]>
2 parents 303f136 + ee37978 commit 47cab0f

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
@@ -446,7 +446,10 @@ def io_stats(self, nqn: str, nsid: str, gw_group: Optional[str] = None,
446446
"trash_image": Param(bool, "Trash the RBD image when namespace is removed"),
447447
"block_size": Param(int, "NVMeoF namespace block size"),
448448
"load_balancing_group": Param(int, "Load balancing group"),
449+
"disable_auto_resize": Param(str, "Disable auto resize", True, None),
450+
"read_only": Param(str, "Read only namespace", True, None),
449451
"gw_group": Param(str, "NVMeoF gateway group", True, None),
452+
"traddr": Param(str, "Target gateway address", True, None),
450453
"force": Param(
451454
bool,
452455
"Force create namespace even it image is used by other namespace"
@@ -464,44 +467,7 @@ def create(
464467
nqn: str,
465468
rbd_image_name: str,
466469
rbd_pool: str = "rbd",
467-
create_image: Optional[bool] = False,
468-
size: Optional[int] = 1024,
469-
rbd_image_size: Optional[int] = None,
470-
trash_image: Optional[bool] = False,
471-
block_size: int = 512,
472-
load_balancing_group: Optional[int] = None,
473-
force: Optional[bool] = False,
474-
no_auto_visible: Optional[bool] = False,
475-
disable_auto_resize: Optional[bool] = False,
476-
read_only: Optional[bool] = False,
477-
gw_group: Optional[str] = None,
478-
traddr: Optional[str] = None,
479-
):
480-
return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.namespace_add(
481-
NVMeoFClient.pb2.namespace_add_req(
482-
subsystem_nqn=nqn,
483-
rbd_image_name=rbd_image_name,
484-
rbd_pool_name=rbd_pool,
485-
block_size=block_size,
486-
create_image=create_image,
487-
size=rbd_image_size or size,
488-
trash_image=trash_image,
489-
anagrpid=load_balancing_group,
490-
force=force,
491-
no_auto_visible=no_auto_visible,
492-
disable_auto_resize=disable_auto_resize,
493-
read_only=read_only
494-
)
495-
)
496-
497-
@NvmeofCLICommand("nvmeof ns add", model.NamespaceCreation)
498-
@convert_to_model(model.NamespaceCreation)
499-
@handle_nvmeof_error
500-
def create_cli(
501-
self,
502-
nqn: str,
503-
rbd_image_name: str,
504-
rbd_pool: str = "rbd",
470+
nsid: Optional[str] = None,
505471
create_image: Optional[bool] = False,
506472
size: Optional[str] = None,
507473
rbd_image_size: Optional[str] = None,
@@ -523,6 +489,7 @@ def create_cli(
523489
return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.namespace_add(
524490
NVMeoFClient.pb2.namespace_add_req(
525491
subsystem_nqn=nqn,
492+
nsid=int(nsid) if nsid else None,
526493
rbd_image_name=rbd_image_name,
527494
rbd_pool_name=rbd_pool,
528495
block_size=block_size,

src/pybind/mgr/dashboard/openapi.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9355,7 +9355,8 @@ paths:
93559355
type: boolean
93569356
disable_auto_resize:
93579357
default: false
9358-
type: integer
9358+
description: Disable auto resize
9359+
type: string
93599360
force:
93609361
default: false
93619362
description: Force create namespace even it image is used by other
@@ -9371,6 +9372,8 @@ paths:
93719372
default: false
93729373
description: Namespace will be visible only for the allowed hosts
93739374
type: boolean
9375+
nsid:
9376+
type: string
93749377
rbd_image_name:
93759378
description: RBD image name
93769379
type: string
@@ -9383,12 +9386,13 @@ paths:
93839386
type: string
93849387
read_only:
93859388
default: false
9386-
type: boolean
9389+
description: Read only namespace
9390+
type: string
93879391
size:
9388-
default: 1024
93899392
description: RBD image size
93909393
type: integer
93919394
traddr:
9395+
description: Target gateway address
93929396
type: string
93939397
trash_image:
93949398
default: false

0 commit comments

Comments
 (0)