def _GetZonesToTest(api, zone_host_map):
  """Iterate over files in the CL to determine which zones need testing."""
  dhcp_dirs = ['%s/dhcpd' % d for d in ['configs', 'services']]
  patch_root = api.gclient.get_gerrit_patch_root()
  zones_to_test = set()

  assert patch_root, ('local path is not configured for %s' %
                      api.m.tryserver.gerrit_change_repo_url)
  for f in api.m.tryserver.get_files_affected_by_patch(patch_root):
    for zone in zone_host_map:
      if any(['%s/%s/' % (d, zone) in f for d in dhcp_dirs]):
        zones_to_test.add(zone)
  return zones_to_test