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