Merge "Add debug log for pci passthrough filter"

This commit is contained in:
Jenkins 2014-07-31 11:03:42 +00:00 committed by Gerrit Code Review
commit c08d32885d

View File

@ -13,8 +13,11 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nova.openstack.common import log as logging
from nova.scheduler import filters from nova.scheduler import filters
LOG = logging.getLogger(__name__)
class PciPassthroughFilter(filters.BaseHostFilter): class PciPassthroughFilter(filters.BaseHostFilter):
"""Pci Passthrough Filter based on PCI request """Pci Passthrough Filter based on PCI request
@ -34,7 +37,12 @@ class PciPassthroughFilter(filters.BaseHostFilter):
def host_passes(self, host_state, filter_properties): def host_passes(self, host_state, filter_properties):
"""Return true if the host has the required PCI devices.""" """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 True
return host_state.pci_stats.support_requests( if not host_state.pci_stats.support_requests(pci_requests):
filter_properties.get('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