#NEWLINE# def create( self , req , body ) : #NEWLINE# #INDENT# 'Bulk create floating IPs.' #NEWLINE# context = req . environ [ 'nova.context' ] #NEWLINE# authorize ( context ) #NEWLINE# if ( 'floating_ips_bulk_create' not in body ) : #NEWLINE# #INDENT# raise webob . exc . HTTPUnprocessableEntity ( ) #NEWLINE# #UNINDENT# params = context [ 'floating_ips_bulk_create' ] #NEWLINE# if ( 'ip_range' not in params ) : #NEWLINE# #INDENT# raise webob . exc . HTTPUnprocessableEntity ( ) #NEWLINE# #UNINDENT# ip_range = params [ 'ip_range' ] #NEWLINE# pool = params . get ( 'pool' , CONF . default_floating_pool ) #NEWLINE# interface = params . get ( 'interface' , CONF . public_interface ) #NEWLINE# try : #NEWLINE# #INDENT# ips = [ objects . FloatingIPList . make_ip_info ( addr , pool , interface ) for addr in self . _address_to_hosts ( ip_range ) ] #NEWLINE# #UNINDENT# except exception . InvalidInput as exc : #NEWLINE# #INDENT# raise webob . exc . HTTPBadRequest ( explanation = exc . format_message ( ) ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# objects . FloatingIPList . create ( context , ips ) #NEWLINE# #UNINDENT# except exception . FloatingIpExists as exc : #NEWLINE# #INDENT# raise webob . exc . HTTPConflict ( explanation = exc . format_message ( ) ) #NEWLINE# #UNINDENT# return { #NEWLINE# #INDENT# 'floating_ips_bulk_create' : { #NEWLINE# #INDENT# 'ip_range' : ip_range , #NEWLINE# 'pool' : pool , #NEWLINE# 'interface' : interface , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# }