diff --git a/nova/pci/utils.py b/nova/pci/utils.py index 2ea64b14911c..221508574aa3 100644 --- a/nova/pci/utils.py +++ b/nova/pci/utils.py @@ -20,7 +20,7 @@ import os import re from oslo_log import log as logging - +import six from nova import exception @@ -54,8 +54,17 @@ def pci_device_prop_match(pci_dev, specs): if isinstance(v, list) and isinstance(pci_dev_v, list): if not all(x in pci_dev.get(k) for x in v): return False - elif pci_dev_v != v: - return False + else: + # We don't need to check case for tags in order to avoid any + # mismatch with the tags provided by users for port + # binding profile and the ones configured by operators + # with pci whitelist option. + if isinstance(v, six.string_types): + v = v.lower() + if isinstance(pci_dev_v, six.string_types): + pci_dev_v = pci_dev_v.lower() + if pci_dev_v != v: + return False return True return any(_matching_devices(spec) for spec in specs) diff --git a/nova/tests/unit/pci/test_utils.py b/nova/tests/unit/pci/test_utils.py index b86f0fab7a8d..6675be5c2471 100644 --- a/nova/tests/unit/pci/test_utils.py +++ b/nova/tests/unit/pci/test_utils.py @@ -36,6 +36,8 @@ class PciDeviceMatchTestCase(test.NoDBTestCase): def test_single_spec_match(self): self.assertTrue(utils.pci_device_prop_match( self.fake_pci_1, [{'vendor_id': 'v1', 'device_id': 'd1'}])) + self.assertTrue(utils.pci_device_prop_match( + self.fake_pci_1, [{'vendor_id': 'V1', 'device_id': 'D1'}])) def test_multiple_spec_match(self): self.assertTrue(utils.pci_device_prop_match(