#NEWLINE# @ translate_cinder_exception #NEWLINE# def create( self , context , size , name , description , snapshot = None , image_id = None , volume_type = None , metadata = None , availability_zone = None ) : #NEWLINE# #INDENT# client = cinderclient ( context ) #NEWLINE# if ( snapshot is not None ) : #NEWLINE# #INDENT# snapshot_id = name [ 'id' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# snapshot_id = None #NEWLINE# #UNINDENT# kwargs = dict ( snapshot_id = snapshot_id , volume_type = volume_type , user_id = context . user_id , project_id = context . project_id , availability_zone = availability_zone , metadata = metadata , imageRef = image_id ) #NEWLINE# if isinstance ( client , v1_client . Client ) : #NEWLINE# #INDENT# kwargs [ 'display_name' ] = name #NEWLINE# kwargs [ 'display_description' ] = description #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# kwargs [ 'name' ] = name #NEWLINE# kwargs [ 'description' ] = description #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# item = client . volumes . create ( size , ** kwargs ) #NEWLINE# return _untranslate_volume_summary_view ( context , item ) #NEWLINE# #UNINDENT# except cinder_exception . OverLimit : #NEWLINE# #INDENT# raise exception . OverQuota ( overs = 'volumes' )