#NEWLINE# def _release_unused_leases( self ) : #NEWLINE# #INDENT# filename = self . get_conf_file_name ( 'host' ) #NEWLINE# old_leases = self . _read_hosts_file_leases ( filename ) #NEWLINE# new_leases = set ( ) #NEWLINE# dhcp_port_exists = False #NEWLINE# dhcp_port_on_this_host = self . device_manager . get_device_id ( self . network ) #NEWLINE# for port in self . network . ports : #NEWLINE# #INDENT# client_id = self . _get_client_id ( port ) #NEWLINE# for alloc in port . fixed_ips : #NEWLINE# #INDENT# new_leases . add ( ( alloc . ip_address , port . mac_address , client_id ) ) #NEWLINE# #UNINDENT# if ( port . device_id == dhcp_port_on_this_host ) : #NEWLINE# #INDENT# dhcp_port_exists = True #NEWLINE# #UNINDENT# #UNINDENT# for ( ip , mac , client_id ) in ( old_leases - new_leases ) : #NEWLINE# #INDENT# self . _release_lease ( mac , ip , client_id ) #NEWLINE# #UNINDENT# if ( not dhcp_port_exists ) : #NEWLINE# #INDENT# self . device_manager . driver . unplug ( self . interface_name , namespace = self . network . namespace )