#NEWLINE# def _delete_mac_associated_with_agent( resource , event , trigger , context , agent , **kwargs ) : #NEWLINE# #INDENT# host = agent [ 'host' ] #NEWLINE# plugin = manager . NeutronManager . get_plugin ( ) #NEWLINE# if [ a for a in plugin . get_agents ( context , filters = { #NEWLINE# #INDENT# 'host' : [ host ] , #NEWLINE# #UNINDENT# } ) if ( a [ 'id' ] != agent [ 'id' ] ) ] : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# with context . session . begin ( subtransactions = True ) : #NEWLINE# #INDENT# entry = context . session . query ( DistributedVirtualRouterMacAddress ) . filter ( ( DistributedVirtualRouterMacAddress . host == host ) ) . one ( ) #NEWLINE# context . session . delete ( entry ) #NEWLINE# #UNINDENT# #UNINDENT# except exc . NoResultFound : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# dvr_macs = plugin . get_dvr_mac_address_list ( context ) #NEWLINE# plugin . notifier . dvr_mac_address_update ( context , dvr_macs )