From f71d2fc966cb44b8d74b4432179622d6c9e1f284 Mon Sep 17 00:00:00 2001 From: jichenjc Date: Thu, 3 Jul 2014 01:55:23 +0800 Subject: [PATCH] Add debug log for pci passthrough filter Sometimes operator need information why the host doesn't pass the check of scheduler, this patch adds information for pci passthrough filter if it falied to pass check. Change-Id: Ic8fe13174fda5c75ce95fc0b64391ae081b36c6d Partial-Bug: #1301830 --- nova/scheduler/filters/pci_passthrough_filter.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/nova/scheduler/filters/pci_passthrough_filter.py b/nova/scheduler/filters/pci_passthrough_filter.py index dc71e18baaa5..0726d22148ae 100644 --- a/nova/scheduler/filters/pci_passthrough_filter.py +++ b/nova/scheduler/filters/pci_passthrough_filter.py @@ -13,8 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. +from nova.openstack.common import log as logging from nova.scheduler import filters +LOG = logging.getLogger(__name__) + class PciPassthroughFilter(filters.BaseHostFilter): """Pci Passthrough Filter based on PCI request @@ -34,7 +37,12 @@ class PciPassthroughFilter(filters.BaseHostFilter): def host_passes(self, host_state, filter_properties): """Return true if the host has the required PCI devices.""" - if not filter_properties.get('pci_requests'): + pci_requests = filter_properties.get('pci_requests') + if not pci_requests: return True - return host_state.pci_stats.support_requests( - filter_properties.get('pci_requests')) + if not host_state.pci_stats.support_requests(pci_requests): + LOG.debug("%(host_state)s doesn't have the required PCI devices" + " (%(requests)s)", + {'host_state': host_state, 'requests': pci_requests}) + return False + return True