Exemplo n.º 1
0
    def test_translate_alias_to_requests_affinity_policy(self):
        # _fake_alias1 requests the legacy policy and _fake_alias2
        # has no numa_policy set so it will default to legacy.
        self.flags(alias=[_fake_alias1, _fake_alias2], group='pci')
        # so to test that the flavor/image policy takes precedence
        # set use the preferred policy.
        policy = fields.PCINUMAAffinityPolicy.PREFERRED
        expect_request = [
            {'count': 3,
             'requester_id': None,
             'spec': [{'vendor_id': '8086', 'product_id': '4443',
                       'dev_type': 'type-PCI',
                       'capability_type': 'pci'}],
             'alias_name': 'QuickAssist',
             'numa_policy': policy
             },

            {'count': 1,
             'requester_id': None,
             'spec': [{'vendor_id': '8086', 'product_id': '1111',
                       'dev_type': "type-PF",
                       'capability_type': 'pci'}],
             'alias_name': 'IntelNIC',
             'numa_policy': policy
             }, ]

        requests = request._translate_alias_to_requests(
            "QuickAssist : 3, IntelNIC: 1", affinity_policy=policy)
        self.assertEqual(set([p.count for p in requests]), set([1, 3]))
        self._verify_result(expect_request, requests)
Exemplo n.º 2
0
    def test_aliase_2_request(self):
        self.flags(alias=[_fake_alias1, _fake_alias3], group='pci')
        expect_request = [
            {
                'count':
                3,
                'spec': [{
                    'vendor_id': '8086',
                    'product_id': '4443',
                    'dev_type': 'type-PCI',
                    'capability_type': 'pci'
                }],
                'alias_name':
                'QuicAssist'
            },
            {
                'count':
                1,
                'spec': [{
                    'vendor_id': '8086',
                    'product_id': '1111',
                    'dev_type': "type-PF",
                    'capability_type': 'pci'
                }],
                'alias_name':
                'IntelNIC'
            },
        ]

        requests = request._translate_alias_to_requests(
            "QuicAssist : 3, IntelNIC: 1")
        self.assertEqual(set([p['count'] for p in requests]), set([1, 3]))
        self._verify_result(expect_request, requests)
Exemplo n.º 3
0
    def test_aliase_2_request(self):
        self.flags(alias=[_fake_alias1, _fake_alias3], group='pci')
        expect_request = [
            {'count': 3,
             'spec': [{'vendor_id': '8086', 'product_id': '4443',
                       'dev_type': 'type-PCI',
                       'capability_type': 'pci'}],
                       'alias_name': 'QuicAssist'},

            {'count': 1,
             'spec': [{'vendor_id': '8086', 'product_id': '1111',
                       'dev_type': "type-PF",
                       'capability_type': 'pci'}],
             'alias_name': 'IntelNIC'}, ]

        requests = request._translate_alias_to_requests(
            "QuicAssist : 3, IntelNIC: 1")
        self.assertEqual(set([p['count'] for p in requests]), set([1, 3]))
        self._verify_result(expect_request, requests)