@@ -88,6 +88,7 @@ def _check_request_version(req, min_version, method, server_id, server_state):
8888 exc_inv , method , server_id )
8989
9090
91+ @validation .validated
9192class VolumeAttachmentController (wsgi .Controller ):
9293 """The volume attachment API controller for the OpenStack API.
9394
@@ -104,6 +105,10 @@ def __init__(self):
104105 @wsgi .expected_errors (404 )
105106 @validation .query_schema (schema .index_query , '2.0' , '2.74' )
106107 @validation .query_schema (schema .index_query_v275 , '2.75' )
108+ @validation .response_body_schema (schema .index_response , '2.0' , '2.69' )
109+ @validation .response_body_schema (schema .index_response_v270 , '2.70' , '2.78' ) # noqa: E501
110+ @validation .response_body_schema (schema .index_response_v279 , '2.79' , '2.88' ) # noqa: E501
111+ @validation .response_body_schema (schema .index_response_v289 , '2.89' )
107112 def index (self , req , server_id ):
108113 """Returns the list of volume attachments for a given instance."""
109114 context = req .environ ['nova.context' ]
@@ -136,6 +141,10 @@ def index(self, req, server_id):
136141
137142 @wsgi .expected_errors (404 )
138143 @validation .query_schema (schema .show_query )
144+ @validation .response_body_schema (schema .show_response , '2.0' , '2.69' )
145+ @validation .response_body_schema (schema .show_response_v270 , '2.70' , '2.78' ) # noqa: E501
146+ @validation .response_body_schema (schema .show_response_v279 , '2.79' , '2.88' ) # noqa: E501
147+ @validation .response_body_schema (schema .show_response_v289 , '2.89' )
139148 def show (self , req , server_id , id ):
140149 """Return data about the given volume attachment."""
141150 context = req .environ ['nova.context' ]
@@ -175,6 +184,9 @@ def show(self, req, server_id, id):
175184 @validation .schema (schema .create , '2.0' , '2.48' )
176185 @validation .schema (schema .create_v249 , '2.49' , '2.78' )
177186 @validation .schema (schema .create_v279 , '2.79' )
187+ @validation .response_body_schema (schema .create_response , '2.0' , '2.69' )
188+ @validation .response_body_schema (schema .create_response_v270 , '2.70' , '2.78' ) # noqa: E501
189+ @validation .response_body_schema (schema .create_response_v279 , '2.79' )
178190 def create (self , req , server_id , body ):
179191 """Attach a volume to an instance."""
180192 context = req .environ ['nova.context' ]
@@ -234,6 +246,8 @@ def create(self, req, server_id, body):
234246 attachment ['tag' ] = tag
235247 if api_version_request .is_supported (req , '2.79' ):
236248 attachment ['delete_on_termination' ] = delete_on_termination
249+ # TODO(stephenfin): We forgot to apply 2.89 here. We should return
250+ # 'bdm_uuid' and 'attachment_id' and stop returning 'id'
237251 return {'volumeAttachment' : attachment }
238252
239253 def _update_volume_swap (self , req , instance , id , body ):
@@ -318,6 +332,7 @@ def _update_volume_regular(self, req, instance, id, body):
318332 @wsgi .expected_errors ((400 , 404 , 409 ))
319333 @validation .schema (schema .update , '2.0' , '2.84' )
320334 @validation .schema (schema .update_v285 , '2.85' )
335+ @validation .response_body_schema (schema .update_response )
321336 def update (self , req , server_id , id , body ):
322337 context = req .environ ['nova.context' ]
323338 instance = common .get_instance (self .compute_api , context , server_id )
@@ -348,6 +363,7 @@ def update(self, req, server_id, id, body):
348363
349364 @wsgi .response (202 )
350365 @wsgi .expected_errors ((400 , 403 , 404 , 409 ))
366+ @validation .response_body_schema (schema .delete_response )
351367 def delete (self , req , server_id , id ):
352368 """Detach a volume from an instance."""
353369 context = req .environ ['nova.context' ]
0 commit comments