#NEWLINE# def schedule_create_volumes( self , context , request_spec , availability_zone = None , * _args , **_kwargs ) : #NEWLINE# #INDENT# 'Picks hosts for hosting multiple volumes.' #NEWLINE# num_volumes = request_spec . get ( 'num_volumes' ) #NEWLINE# LOG . debug ( ( _ ( 'Attempting to spawn %(num_volumes)d volume(s)' ) % locals ( ) ) ) #NEWLINE# vsa_id = request_spec . get ( 'vsa_id' ) #NEWLINE# volume_params = request_spec . get ( 'volumes' ) #NEWLINE# host = self . _check_host_enforcement ( context , availability_zone ) #NEWLINE# try : #NEWLINE# #INDENT# self . _print_capabilities_info ( ) #NEWLINE# self . _assign_hosts_to_volumes ( context , volume_params , host ) #NEWLINE# for vol in volume_params : #NEWLINE# #INDENT# self . _provision_volume ( context , vol , vsa_id , availability_zone ) #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# if vsa_id : #NEWLINE# #INDENT# db . vsa_update ( context , vsa_id , dict ( status = VsaState . FAILED ) ) #NEWLINE# #UNINDENT# for vol in volume_params : #NEWLINE# #INDENT# if ( 'capabilities' in vol ) : #NEWLINE# #INDENT# self . _consume_resource ( vol [ 'capabilities' ] , vol [ 'size' ] , 1 ) #NEWLINE# #UNINDENT# #UNINDENT# raise #NEWLINE# #UNINDENT# return None