def _filter_hypervisor_macs(instance, ports, hypervisor_macs):
 if (not hypervisor_macs):
  return None
 available_macs = set(hypervisor_macs)
 if (not ports):
  return available_macs
 for port in ports.values():
  mac = port['mac_address']
  if (mac not in hypervisor_macs):
   LOG.debug('Port %(port)s mac address %(mac)s is not in the set of hypervisor macs: %(hyper_macs)s. Nova will overwrite this with a new mac address.', {'port': port['id'], 'mac': mac, 'hyper_macs': hypervisor_macs}, instance=instance)
  else:
   available_macs.discard(mac)
 return available_macs

def _filter_hypervisor_macs ( instance , ports , hypervisor_macs ) : if ( not hypervisor_macs ) : return None available_macs = set ( hypervisor_macs ) if ( not ports ) : return available_macs for port in ports . values ( ) : mac = port [ 'mac_address' ] if ( mac not in hypervisor_macs ) : LOG . debug ( 'Port %(port)s mac address %(mac)s is not in the set of hypervisor macs: %(hyper_macs)s. Nova will overwrite this with a new mac address.' , { 'port' : port [ 'id' ] , 'mac' : mac , 'hyper_macs' : hypervisor_macs } , instance = instance ) else : available_macs . discard ( mac ) return available_macs
removes macs from set if used by existing ports .