1717 @APIDoc ('NVMe-oF Namespace Management API' , 'NVMe-oF' )
1818 class NvmeofNamespace (RESTController ):
1919 @ReadPermission
20+ @EndpointDoc ('List all NVMeoF namespaces' ,
21+ parameters = {
22+ 'subsystem_nqn' : (str , 'NVMeoF subsystem NQN' )
23+ })
2024 def list (self , subsystem_nqn : str ):
21- """
22- List all NVMeoF namespaces
23- """
2425 response = MessageToJson (NVMeoFClient ().list_namespaces (subsystem_nqn ))
2526 return json .loads (response )
2627
2728 @CreatePermission
29+ @EndpointDoc ('Create a new NVMeoF namespace' ,
30+ parameters = {
31+ 'rbd_pool' : (str , 'RBD pool name' ),
32+ 'rbd_image' : (str , 'RBD image name' ),
33+ 'subsystem_nqn' : (str , 'NVMeoF subsystem NQN' ),
34+ 'create_image' : (bool , 'Create RBD image' ),
35+ 'image_size' : (int , 'RBD image size' ),
36+ 'block_size' : (int , 'NVMeoF namespace block size' )
37+ })
2838 def create (self , rbd_pool : str , rbd_image : str , subsystem_nqn : str ,
2939 create_image : Optional [bool ] = True , image_size : Optional [int ] = 1024 ,
3040 block_size : int = 512 ):
31- """
32- Create a new NVMeoF namespace
33- :param rbd_pool: RBD pool name
34- :param rbd_image: RBD image name
35- :param subsystem_nqn: NVMeoF subsystem NQN
36- :param create_image: Create RBD image
37- :param image_size: RBD image size
38- :param block_size: NVMeoF namespace block size
39- """
4041 response = NVMeoFClient ().create_namespace (rbd_pool , rbd_image ,
4142 subsystem_nqn , block_size ,
4243 create_image , image_size )
4344 return json .loads (MessageToJson (response ))
4445
4546 @Endpoint ('DELETE' , path = '{subsystem_nqn}' )
47+ @EndpointDoc ('Delete an existing NVMeoF namespace' ,
48+ parameters = {
49+ 'subsystem_nqn' : (str , 'NVMeoF subsystem NQN' )
50+ })
4651 @DeletePermission
4752 def delete (self , subsystem_nqn : str ):
48- """
49- Delete an existing NVMeoF namespace
50- :param subsystem_nqn: NVMeoF subsystem NQN
51- """
5253 response = NVMeoFClient ().delete_namespace (subsystem_nqn )
5354 return json .loads (MessageToJson (response ))
5455
5556 @APIRouter ('/nvmeof/subsystem' , Scope .NVME_OF )
5657 @APIDoc ('NVMe-oF Subsystem Management API' , 'NVMe-oF' )
5758 class NvmeofSubsystem (RESTController ):
5859 @ReadPermission
59- @EndpointDoc ("List all NVMeoF gateways " ,
60+ @EndpointDoc ("List all NVMeoF subsystems " ,
6061 parameters = {
6162 'subsystem_nqn' : (str , 'NVMeoF subsystem NQN' ),
6263 })
@@ -68,92 +69,90 @@ def list(self, subsystem_nqn: Optional[str] = None):
6869 return json .loads (response )
6970
7071 @CreatePermission
71- def create (self , subsystem_nqn : str , serial_number : Optional [str ] = None ,
72- max_namespaces : Optional [int ] = 256 ):
73- """
74- Create a new NVMeoF subsystem
75-
76- :param subsystem_nqn: NVMeoF subsystem NQN
77- :param serial_number: NVMeoF subsystem serial number
78- :param max_namespaces: NVMeoF subsystem maximum namespaces
79- """
80- response = NVMeoFClient ().create_subsystem (subsystem_nqn , serial_number , max_namespaces )
72+ @EndpointDoc ('Create a new NVMeoF subsystem' ,
73+ parameters = {
74+ 'subsystem_nqn' : (str , 'NVMeoF subsystem NQN' ),
75+ 'serial_number' : (str , 'NVMeoF subsystem serial number' ),
76+ 'max_namespaces' : (int , 'Maximum number of namespaces' )
77+ })
78+ def create (self , subsystem_nqn : str ):
79+ response = NVMeoFClient ().create_subsystem (subsystem_nqn )
8180 return json .loads (MessageToJson (response ))
8281
8382 @DeletePermission
8483 @Endpoint ('DELETE' , path = '{subsystem_nqn}' )
84+ @EndpointDoc ('Delete an existing NVMeoF subsystem' ,
85+ parameters = {
86+ 'subsystem_nqn' : (str , 'NVMeoF subsystem NQN' ),
87+ 'force' : (bool , 'Force delete' )
88+ })
8589 def delete (self , subsystem_nqn : str , force : Optional [bool ] = False ):
86- """
87- Delete an existing NVMeoF subsystem
88- :param subsystem_nqn: NVMeoF subsystem NQN
89- :param force: Force delete
90- """
9190 response = NVMeoFClient ().delete_subsystem (subsystem_nqn , force )
9291 return json .loads (MessageToJson (response ))
9392
9493 @APIRouter ('/nvmeof/hosts' , Scope .NVME_OF )
9594 @APIDoc ('NVMe-oF Host Management API' , 'NVMe-oF' )
9695 class NvmeofHost (RESTController ):
9796 @ReadPermission
97+ @EndpointDoc ('List all allowed hosts for an NVMeoF subsystem' ,
98+ parameters = {
99+ 'subsystem_nqn' : (str , 'NVMeoF subsystem NQN' )
100+ })
98101 def list (self , subsystem_nqn : str ):
99- """
100- List all NVMeoF hosts
101- :param subsystem_nqn: NVMeoF subsystem NQN
102- """
103102 response = MessageToJson (NVMeoFClient ().list_hosts (subsystem_nqn ))
104103 return json .loads (response )
105104
106105 @CreatePermission
106+ @EndpointDoc ('Allow hosts to access an NVMeoF subsystem' ,
107+ parameters = {
108+ 'subsystem_nqn' : (str , 'NVMeoF subsystem NQN' ),
109+ 'host_nqn' : (str , 'NVMeoF host NQN' )
110+ })
107111 def create (self , subsystem_nqn : str , host_nqn : str ):
108- """
109- Create a new NVMeoF host
110- :param subsystem_nqn: NVMeoF subsystem NQN
111- :param host_nqn: NVMeoF host NQN
112- """
113112 response = NVMeoFClient ().add_host (subsystem_nqn , host_nqn )
114113 return json .loads (MessageToJson (response ))
115114
116115 @DeletePermission
116+ @EndpointDoc ('Disallow hosts from accessing an NVMeoF subsystem' ,
117+ parameters = {
118+ 'subsystem_nqn' : (str , 'NVMeoF subsystem NQN' ),
119+ 'host_nqn' : (str , 'NVMeoF host NQN' )
120+ })
117121 def delete (self , subsystem_nqn : str , host_nqn : str ):
118- """
119- Delete an existing NVMeoF host
120- :param subsystem_nqn: NVMeoF subsystem NQN
121- :param host_nqn: NVMeoF host NQN
122- """
123122 response = NVMeoFClient ().remove_host (subsystem_nqn , host_nqn )
124123 return json .loads (MessageToJson (response ))
125124
126125 @APIRouter ('/nvmeof/listener' , Scope .NVME_OF )
127126 @APIDoc ('NVMe-oF Listener Management API' , 'NVMe-oF' )
128127 class NvmeofListener (RESTController ):
129128 @ReadPermission
129+ @EndpointDoc ('List all NVMeoF listeners' ,
130+ parameters = {
131+ 'subsystem_nqn' : (str , 'NVMeoF subsystem NQN' )
132+ })
130133 def list (self , subsystem_nqn : str ):
131- """
132- List all NVMeoF listeners
133- :param nqn: NVMeoF subsystem NQN
134- """
135134 response = MessageToJson (NVMeoFClient ().list_listeners (subsystem_nqn ))
136135 return json .loads (response )
137136
138137 @CreatePermission
138+ @EndpointDoc ('Create a new NVMeoF listener' ,
139+ parameters = {
140+ 'nqn' : (str , 'NVMeoF subsystem NQN' ),
141+ 'gateway' : (str , 'NVMeoF gateway' ),
142+ 'traddr' : (str , 'NVMeoF transport address' )
143+ })
139144 def create (self , nqn : str , gateway : str , traddr : Optional [str ] = None ):
140- """
141- Create a new NVMeoF listener
142- :param nqn: NVMeoF subsystem NQN
143- :param gateway: NVMeoF gateway
144- :param traddr: NVMeoF transport address
145- """
146145 response = NVMeoFClient ().create_listener (nqn , gateway , traddr )
147146 return json .loads (MessageToJson (response ))
148147
149148 @DeletePermission
149+ @EndpointDoc ('Delete an existing NVMeoF listener' ,
150+ parameters = {
151+ 'nqn' : (str , 'NVMeoF subsystem NQN' ),
152+ 'gateway' : (str , 'NVMeoF gateway' ),
153+ 'traddr' : (str , 'NVMeoF transport address' )
154+ })
150155 def delete (self , nqn : str , gateway : str , traddr : Optional [str ] = None ):
151- """
152- Delete an existing NVMeoF listener
153- :param nqn: NVMeoF subsystem NQN
154- :param gateway: NVMeoF gateway
155- :param traddr: NVMeoF transport address
156- """
157156 response = NVMeoFClient ().delete_listener (nqn , gateway , traddr )
158157 return json .loads (MessageToJson (response ))
159158
@@ -162,9 +161,7 @@ def delete(self, nqn: str, gateway: str, traddr: Optional[str] = None):
162161 class NvmeofGateway (RESTController ):
163162 @ReadPermission
164163 @Endpoint ()
164+ @EndpointDoc ('List all NVMeoF gateways' )
165165 def info (self ):
166- """
167- Get NVMeoF gateway information
168- """
169166 response = MessageToJson (NVMeoFClient ().gateway_info ())
170167 return json .loads (response )
0 commit comments