#NEWLINE# def create_port_bulk( self , context , ports ) : #NEWLINE# #INDENT# objects = self . _create_bulk_ml2 ( attributes . PORT , context , ports ) #NEWLINE# results = [ obj [ 'result' ] for obj in objects ] #NEWLINE# self . notify_security_groups_member_updated_bulk ( context , results ) #NEWLINE# for obj in objects : #NEWLINE# #INDENT# attrs = obj [ 'attributes' ] #NEWLINE# if ( attrs and attrs . get ( portbindings . HOST_ID ) ) : #NEWLINE# #INDENT# kwargs = { #NEWLINE# #INDENT# 'context' : context , #NEWLINE# 'port' : obj [ 'result' ] , #NEWLINE# #UNINDENT# } #NEWLINE# registry . notify ( resources . PORT , events . AFTER_CREATE , self , ** kwargs ) #NEWLINE# #UNINDENT# #UNINDENT# try : #NEWLINE# #INDENT# for obj in objects : #NEWLINE# #INDENT# obj [ 'bound_context' ] = self . _bind_port_if_needed ( obj [ 'mech_context' ] ) #NEWLINE# #UNINDENT# return [ obj [ 'bound_context' ] . current for obj in objects ] #NEWLINE# #UNINDENT# except ml2_exc . MechanismDriverError : #NEWLINE# #INDENT# with excutils . save_and_reraise_exception ( ) : #NEWLINE# #INDENT# resource_ids = [ res [ 'result' ] [ 'id' ] for res in objects ] #NEWLINE# LOG . error ( _LE ( "_bind_port_if_needed failed. Deleting all ports from create bulk '%s'" ) , resource_ids ) #NEWLINE# self . _delete_objects ( context , attributes . PORT , objects )