Skip to content

Commit

Permalink
Add debug log for pci passthrough filter
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jichenjc committed Jul 19, 2014
1 parent 1addb63 commit f71d2fc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions nova/scheduler/filters/pci_passthrough_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit f71d2fc

Please sign in to comment.