Log which filter failed when on log level INFO

If log level is set to INFO,only see a log message about nova-schedule
attempting to build n instances then a log message about setting the
state to error when the scheduler fails to schedule an instance due to
a filter returning 0 hosts.It may be useful to see which filterreturns 0
host for operator.

Close-bug: #1226334

Change-Id: I7564a8ab093895d1f9db357009aac294783a808b
This commit is contained in:
Shuangtai Tian
2013-09-30 13:50:28 +08:00
parent 0ef896ee3f
commit b1099b5b07

View File

@@ -80,9 +80,10 @@ class BaseFilterHandler(loadables.BaseLoader):
{'cls_name': cls_name})
return
list_objs = list(objs)
if not list_objs:
LOG.info(_("Filter %s returned 0 hosts"), cls_name)
break
LOG.debug(_("Filter %(cls_name)s returned "
"%(obj_len)d host(s)"),
{'cls_name': cls_name, 'obj_len': len(list_objs)})
if len(list_objs) == 0:
break
return list_objs