#NEWLINE# def create( self , req , body ) : #NEWLINE# #INDENT# 'Creates a new snapshot.' #NEWLINE# context = req . environ [ 'nova.context' ] #NEWLINE# authorize ( context , action = 'create' ) #NEWLINE# if ( not self . is_valid_body ( body , 'snapshot' ) ) : #NEWLINE# #INDENT# raise webob . exc . HTTPBadRequest ( ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# snapshot = body [ 'snapshot' ] #NEWLINE# create_info = snapshot [ 'create_info' ] #NEWLINE# volume_id = snapshot [ 'volume_id' ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# raise webob . exc . HTTPBadRequest ( ) #NEWLINE# #UNINDENT# LOG . info ( _LI ( 'Create assisted snapshot from volume %s' ) , volume_id , context = context ) #NEWLINE# return self . compute_api . volume_snapshot_create ( context , volume_id , create_info )