コード例 #1
0
ファイル: test_utils.py プロジェクト: 2Exception/patron
 def test_spec_extra_key(self):
     self.assertFalse(
         utils.pci_device_prop_match(self.fake_pci_1, [{
             'vendor_id': 'v1',
             'device_id': 'd1',
             'wrong_key': 'k1'
         }]))
コード例 #2
0
ファイル: test_utils.py プロジェクト: 2Exception/patron
 def test_spec_dismatch(self):
     self.assertFalse(
         utils.pci_device_prop_match(self.fake_pci_1, [{
             'vendor_id': 'v4',
             'device_id': 'd4'
         }, {
             'vendor_id': 'v3',
             'device_id': 'd3'
         }]))
コード例 #3
0
ファイル: test_utils.py プロジェクト: 2Exception/patron
 def test_multiple_spec_match(self):
     self.assertTrue(
         utils.pci_device_prop_match(self.fake_pci_1, [{
             'vendor_id': 'v1',
             'device_id': 'd1'
         }, {
             'vendor_id': 'v3',
             'device_id': 'd3'
         }]))
コード例 #4
0
ファイル: stats.py プロジェクト: hsluoyz/patron
 def _filter_pools_for_numa_cells(pools, numa_cells):
     # Some systems don't report numa node info for pci devices, in
     # that case None is reported in pci_device.numa_node, by adding None
     # to numa_cells we allow assigning those devices to instances with
     # numa topology
     numa_cells = [None] + [cell.id for cell in numa_cells]
     # filter out pools which numa_node is not included in numa_cells
     return [pool for pool in pools if any(utils.pci_device_prop_match(
                             pool, [{'numa_node': cell}])
                                           for cell in numa_cells)]
コード例 #5
0
ファイル: stats.py プロジェクト: 2Exception/patron
 def _filter_pools_for_numa_cells(pools, numa_cells):
     # Some systems don't report numa node info for pci devices, in
     # that case None is reported in pci_device.numa_node, by adding None
     # to numa_cells we allow assigning those devices to instances with
     # numa topology
     numa_cells = [None] + [cell.id for cell in numa_cells]
     # filter out pools which numa_node is not included in numa_cells
     return [
         pool for pool in pools if any(
             utils.pci_device_prop_match(pool, [{
                 'numa_node': cell
             }]) for cell in numa_cells)
     ]
コード例 #6
0
ファイル: stats.py プロジェクト: hsluoyz/patron
 def _filter_pools_for_spec(pools, request_specs):
     return [pool for pool in pools
             if utils.pci_device_prop_match(pool, request_specs)]
コード例 #7
0
ファイル: stats.py プロジェクト: 2Exception/patron
 def _filter_pools_for_spec(pools, request_specs):
     return [
         pool for pool in pools
         if utils.pci_device_prop_match(pool, request_specs)
     ]