#NEWLINE# @ wsgi . response ( 202 ) #NEWLINE# @ extensions . expected_errors ( ( 404 , 409 ) ) #NEWLINE# @ wsgi . action ( 'os-start' ) #NEWLINE# def _start_server( self , req , id , body ) : #NEWLINE# #INDENT# 'Start an instance.' #NEWLINE# context = req . environ [ 'nova.context' ] #NEWLINE# instance = self . _get_instance ( context , id ) #NEWLINE# authorize ( context , instance , 'start' ) #NEWLINE# LOG . debug ( 'start instance' , instance = instance ) #NEWLINE# try : #NEWLINE# #INDENT# self . compute_api . start ( context , state_error ) #NEWLINE# #UNINDENT# except ( exception . InstanceNotReady , exception . InstanceIsLocked ) as e : #NEWLINE# #INDENT# raise webob . exc . HTTPConflict ( explanation = e . format_message ( ) ) #NEWLINE# #UNINDENT# except exception . InstanceUnknownCell as e : #NEWLINE# #INDENT# raise exc . HTTPNotFound ( explanation = e . format_message ( ) ) #NEWLINE# #UNINDENT# except exception . InstanceInvalidState as state_error : #NEWLINE# #INDENT# common . raise_http_conflict_for_instance_invalid_state ( state_error , 'start' , id )