Skip to content

Commit 8a17e33

Browse files
authored
Merge pull request ceph#55535 from rhcs-dashboard/nvmeof-api-1.0.0
mgr/dashboard: update nvmeof protoc to 1.0.0 Reviewed-by: Avan Thakkar <[email protected]> Reviewed-by: baum <NOT@FOUND> Reviewed-by: Ernesto Puerta <[email protected]>
2 parents c8e467f + 3f067b4 commit 8a17e33

File tree

6 files changed

+1420
-1009
lines changed

6 files changed

+1420
-1009
lines changed

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

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ def list(self, subsystem_nqn: str):
2727
@CreatePermission
2828
def create(self, rbd_pool: str, rbd_image: str, subsystem_nqn: str,
2929
create_image: Optional[bool] = True, image_size: Optional[int] = 1024,
30-
block_size: int = 512, nsid: Optional[int] = 1,
31-
uuid: Optional[str] = None, anagrpid: Optional[int] = 1):
30+
block_size: int = 512):
3231
"""
3332
Create a new NVMeoF namespace
3433
:param rbd_pool: RBD pool name
@@ -37,24 +36,20 @@ def create(self, rbd_pool: str, rbd_image: str, subsystem_nqn: str,
3736
:param create_image: Create RBD image
3837
:param image_size: RBD image size
3938
:param block_size: NVMeoF namespace block size
40-
:param nsid: NVMeoF namespace ID
41-
:param uuid: NVMeoF namespace UUID
42-
:param anagrpid: NVMeoF namespace ANA group ID
4339
"""
4440
response = NVMeoFClient().create_namespace(rbd_pool, rbd_image,
4541
subsystem_nqn, block_size,
46-
nsid, uuid, anagrpid,
4742
create_image, image_size)
4843
return json.loads(MessageToJson(response))
4944

5045
@Endpoint('DELETE', path='{subsystem_nqn}')
51-
def delete(self, subsystem_nqn: str, nsid: int):
46+
@DeletePermission
47+
def delete(self, subsystem_nqn: str):
5248
"""
5349
Delete an existing NVMeoF namespace
5450
:param subsystem_nqn: NVMeoF subsystem NQN
55-
:param nsid: NVMeoF namespace ID
5651
"""
57-
response = NVMeoFClient().delete_namespace(subsystem_nqn, nsid)
52+
response = NVMeoFClient().delete_namespace(subsystem_nqn)
5853
return json.loads(MessageToJson(response))
5954

6055
@APIRouter('/nvmeof/subsystem', Scope.NVME_OF)
@@ -64,39 +59,36 @@ class NvmeofSubsystem(RESTController):
6459
@EndpointDoc("List all NVMeoF gateways",
6560
parameters={
6661
'subsystem_nqn': (str, 'NVMeoF subsystem NQN'),
67-
'serial_number': (str, 'NVMeoF subsystem serial number')
6862
})
69-
def list(self, subsystem_nqn: Optional[str] = None, serial_number: Optional[str] = None):
63+
@ReadPermission
64+
def list(self, subsystem_nqn: Optional[str] = None):
7065
response = MessageToJson(NVMeoFClient().list_subsystems(
71-
subsystem_nqn=subsystem_nqn, serial_number=serial_number))
66+
subsystem_nqn=subsystem_nqn))
7267

7368
return json.loads(response)
7469

7570
@CreatePermission
7671
def create(self, subsystem_nqn: str, serial_number: Optional[str] = None,
77-
max_namespaces: Optional[int] = 256, ana_reporting: Optional[bool] = False,
78-
enable_ha: Optional[bool] = False):
72+
max_namespaces: Optional[int] = 256):
7973
"""
8074
Create a new NVMeoF subsystem
8175
8276
:param subsystem_nqn: NVMeoF subsystem NQN
8377
:param serial_number: NVMeoF subsystem serial number
8478
:param max_namespaces: NVMeoF subsystem maximum namespaces
85-
:param ana_reporting: NVMeoF subsystem ANA reporting
86-
:param enable_ha: NVMeoF subsystem enable HA
8779
"""
88-
response = NVMeoFClient().create_subsystem(subsystem_nqn, serial_number, max_namespaces,
89-
ana_reporting, enable_ha)
80+
response = NVMeoFClient().create_subsystem(subsystem_nqn, serial_number, max_namespaces)
9081
return json.loads(MessageToJson(response))
9182

9283
@DeletePermission
9384
@Endpoint('DELETE', path='{subsystem_nqn}')
94-
def delete(self, subsystem_nqn: str):
85+
def delete(self, subsystem_nqn: str, force: Optional[bool] = False):
9586
"""
9687
Delete an existing NVMeoF subsystem
9788
:param subsystem_nqn: NVMeoF subsystem NQN
89+
:param force: Force delete
9890
"""
99-
response = NVMeoFClient().delete_subsystem(subsystem_nqn)
91+
response = NVMeoFClient().delete_subsystem(subsystem_nqn, force)
10092
return json.loads(MessageToJson(response))
10193

10294
@APIRouter('/nvmeof/hosts', Scope.NVME_OF)
@@ -144,39 +136,25 @@ def list(self, subsystem_nqn: str):
144136
return json.loads(response)
145137

146138
@CreatePermission
147-
def create(self, nqn: str, gateway: str, traddr: Optional[str] = None,
148-
trtype: Optional[str] = 'TCP', adrfam: Optional[str] = 'IPV4',
149-
trsvcid: Optional[int] = 4420,
150-
auto_ha_state: Optional[str] = 'AUTO_HA_UNSET'):
139+
def create(self, nqn: str, gateway: str, traddr: Optional[str] = None):
151140
"""
152141
Create a new NVMeoF listener
153142
:param nqn: NVMeoF subsystem NQN
154143
:param gateway: NVMeoF gateway
155144
:param traddr: NVMeoF transport address
156-
:param trtype: NVMeoF transport type
157-
:param adrfam: NVMeoF address family
158-
:param trsvcid: NVMeoF transport service ID
159-
:param auto_ha_state: NVMeoF auto HA state
160145
"""
161-
response = NVMeoFClient().create_listener(nqn, gateway, traddr,
162-
trtype, adrfam, trsvcid, auto_ha_state)
146+
response = NVMeoFClient().create_listener(nqn, gateway, traddr)
163147
return json.loads(MessageToJson(response))
164148

165149
@DeletePermission
166-
def delete(self, nqn: str, gateway: str, traddr: Optional[str] = None,
167-
transport_type: Optional[str] = 'TCP', addr_family: Optional[str] = 'IPV4',
168-
transport_svc_id: Optional[int] = 4420):
150+
def delete(self, nqn: str, gateway: str, traddr: Optional[str] = None):
169151
"""
170152
Delete an existing NVMeoF listener
171153
:param nqn: NVMeoF subsystem NQN
172154
:param gateway: NVMeoF gateway
173155
:param traddr: NVMeoF transport address
174-
:param transport_type: NVMeoF transport type
175-
:param addr_family: NVMeoF address family
176-
:param transport_svc_id: NVMeoF transport service ID
177156
"""
178-
response = NVMeoFClient().delete_listener(nqn, gateway, traddr, transport_type,
179-
addr_family, transport_svc_id)
157+
response = NVMeoFClient().delete_listener(nqn, gateway, traddr)
180158
return json.loads(MessageToJson(response))
181159

182160
@APIRouter('/nvmeof/gateway', Scope.NVME_OF)

src/pybind/mgr/dashboard/openapi.yaml

Lines changed: 25 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -7806,34 +7806,19 @@ paths:
78067806
post:
78077807
description: "\n Create a new NVMeoF listener\n :param\
78087808
\ nqn: NVMeoF subsystem NQN\n :param gateway: NVMeoF gateway\n\
7809-
\ :param traddr: NVMeoF transport address\n :param trtype:\
7810-
\ NVMeoF transport type\n :param adrfam: NVMeoF address family\n\
7811-
\ :param trsvcid: NVMeoF transport service ID\n :param\
7812-
\ auto_ha_state: NVMeoF auto HA state\n "
7809+
\ :param traddr: NVMeoF transport address\n "
78137810
parameters: []
78147811
requestBody:
78157812
content:
78167813
application/json:
78177814
schema:
78187815
properties:
7819-
adrfam:
7820-
default: IPV4
7821-
type: string
7822-
auto_ha_state:
7823-
default: AUTO_HA_UNSET
7824-
type: string
78257816
gateway:
78267817
type: string
78277818
nqn:
78287819
type: string
78297820
traddr:
78307821
type: string
7831-
trsvcid:
7832-
default: 4420
7833-
type: integer
7834-
trtype:
7835-
default: TCP
7836-
type: string
78377822
required:
78387823
- nqn
78397824
- gateway
@@ -7866,10 +7851,7 @@ paths:
78667851
delete:
78677852
description: "\n Delete an existing NVMeoF listener\n \
78687853
\ :param nqn: NVMeoF subsystem NQN\n :param gateway: NVMeoF gateway\n\
7869-
\ :param traddr: NVMeoF transport address\n :param transport_type:\
7870-
\ NVMeoF transport type\n :param addr_family: NVMeoF address family\n\
7871-
\ :param transport_svc_id: NVMeoF transport service ID\n \
7872-
\ "
7854+
\ :param traddr: NVMeoF transport address\n "
78737855
parameters:
78747856
- in: path
78757857
name: nqn
@@ -7886,21 +7868,6 @@ paths:
78867868
name: traddr
78877869
schema:
78887870
type: string
7889-
- default: TCP
7890-
in: query
7891-
name: transport_type
7892-
schema:
7893-
type: string
7894-
- default: IPV4
7895-
in: query
7896-
name: addr_family
7897-
schema:
7898-
type: string
7899-
- default: 4420
7900-
in: query
7901-
name: transport_svc_id
7902-
schema:
7903-
type: integer
79047871
responses:
79057872
'202':
79067873
content:
@@ -7932,18 +7899,13 @@ paths:
79327899
\ :param subsystem_nqn: NVMeoF subsystem NQN\n :param\
79337900
\ create_image: Create RBD image\n :param image_size: RBD image\
79347901
\ size\n :param block_size: NVMeoF namespace block size\n \
7935-
\ :param nsid: NVMeoF namespace ID\n :param uuid: NVMeoF\
7936-
\ namespace UUID\n :param anagrpid: NVMeoF namespace ANA group\
7937-
\ ID\n "
7902+
\ "
79387903
parameters: []
79397904
requestBody:
79407905
content:
79417906
application/json:
79427907
schema:
79437908
properties:
7944-
anagrpid:
7945-
default: 1
7946-
type: integer
79477909
block_size:
79487910
default: 512
79497911
type: integer
@@ -7953,17 +7915,12 @@ paths:
79537915
image_size:
79547916
default: 1024
79557917
type: integer
7956-
nsid:
7957-
default: 1
7958-
type: integer
79597918
rbd_image:
79607919
type: string
79617920
rbd_pool:
79627921
type: string
79637922
subsystem_nqn:
79647923
type: string
7965-
uuid:
7966-
type: string
79677924
required:
79687925
- rbd_pool
79697926
- rbd_image
@@ -7994,20 +7951,26 @@ paths:
79947951
tags:
79957952
- NVMe-oF
79967953
/api/nvmeof/namespace/{subsystem_nqn}:
7997-
get:
7998-
description: "\n List all NVMeoF namespaces\n "
7954+
delete:
7955+
description: "\n Delete an existing NVMeoF namespace\n \
7956+
\ :param subsystem_nqn: NVMeoF subsystem NQN\n "
79997957
parameters:
80007958
- in: path
80017959
name: subsystem_nqn
80027960
required: true
80037961
schema:
80047962
type: string
80057963
responses:
8006-
'200':
7964+
'202':
80077965
content:
80087966
application/vnd.ceph.api.v1.0+json:
80097967
type: object
8010-
description: OK
7968+
description: Operation is still executing. Please check the task queue.
7969+
'204':
7970+
content:
7971+
application/vnd.ceph.api.v1.0+json:
7972+
type: object
7973+
description: Resource deleted.
80117974
'400':
80127975
description: Operation exception. Please check the response body for details.
80137976
'401':
@@ -8021,33 +7984,20 @@ paths:
80217984
- jwt: []
80227985
tags:
80237986
- NVMe-oF
8024-
/api/nvmeof/namespace/{subsystem_nqn}/{nsid}:
8025-
delete:
8026-
description: "\n Delete an existing NVMeoF namespace\n \
8027-
\ :param subsystem_nqn: NVMeoF subsystem NQN\n :param nsid: NVMeoF\
8028-
\ namespace ID\n "
7987+
get:
7988+
description: "\n List all NVMeoF namespaces\n "
80297989
parameters:
80307990
- in: path
80317991
name: subsystem_nqn
80327992
required: true
80337993
schema:
80347994
type: string
8035-
- in: path
8036-
name: nsid
8037-
required: true
8038-
schema:
8039-
type: string
80407995
responses:
8041-
'202':
8042-
content:
8043-
application/vnd.ceph.api.v1.0+json:
8044-
type: object
8045-
description: Operation is still executing. Please check the task queue.
8046-
'204':
7996+
'200':
80477997
content:
80487998
application/vnd.ceph.api.v1.0+json:
80497999
type: object
8050-
description: Resource deleted.
8000+
description: OK
80518001
'400':
80528002
description: Operation exception. Please check the response body for details.
80538003
'401':
@@ -8070,12 +8020,6 @@ paths:
80708020
name: subsystem_nqn
80718021
schema:
80728022
type: string
8073-
- allowEmptyValue: true
8074-
description: NVMeoF subsystem serial number
8075-
in: query
8076-
name: serial_number
8077-
schema:
8078-
type: string
80798023
responses:
80808024
'200':
80818025
content:
@@ -8100,21 +8044,13 @@ paths:
81008044
description: "\n Create a new NVMeoF subsystem\n\n :param\
81018045
\ subsystem_nqn: NVMeoF subsystem NQN\n :param serial_number: NVMeoF\
81028046
\ subsystem serial number\n :param max_namespaces: NVMeoF subsystem\
8103-
\ maximum namespaces\n :param ana_reporting: NVMeoF subsystem ANA\
8104-
\ reporting\n :param enable_ha: NVMeoF subsystem enable HA\n \
8105-
\ "
8047+
\ maximum namespaces\n "
81068048
parameters: []
81078049
requestBody:
81088050
content:
81098051
application/json:
81108052
schema:
81118053
properties:
8112-
ana_reporting:
8113-
default: false
8114-
type: boolean
8115-
enable_ha:
8116-
default: false
8117-
type: boolean
81188054
max_namespaces:
81198055
default: 256
81208056
type: integer
@@ -8152,13 +8088,19 @@ paths:
81528088
/api/nvmeof/subsystem/{subsystem_nqn}:
81538089
delete:
81548090
description: "\n Delete an existing NVMeoF subsystem\n \
8155-
\ :param subsystem_nqn: NVMeoF subsystem NQN\n "
8091+
\ :param subsystem_nqn: NVMeoF subsystem NQN\n :param force: Force\
8092+
\ delete\n "
81568093
parameters:
81578094
- in: path
81588095
name: subsystem_nqn
81598096
required: true
81608097
schema:
81618098
type: string
8099+
- default: false
8100+
in: query
8101+
name: force
8102+
schema:
8103+
type: boolean
81628104
responses:
81638105
'202':
81648106
content:

0 commit comments

Comments
 (0)