@@ -5491,6 +5491,9 @@ class PortResourceRequestBasedSchedulingTestBase(
5491
5491
CUSTOM_PHYSNET1 = 'CUSTOM_PHYSNET1'
5492
5492
CUSTOM_PHYSNET2 = 'CUSTOM_PHYSNET2'
5493
5493
CUSTOM_PHYSNET3 = 'CUSTOM_PHYSNET3'
5494
+ PF1 = 'pf1'
5495
+ PF2 = 'pf2'
5496
+ PF3 = 'pf3'
5494
5497
5495
5498
def setUp (self ):
5496
5499
# enable PciPassthroughFilter to support SRIOV before the base class
@@ -5652,7 +5655,8 @@ def _create_sriov_networking_rp_tree(self, hostname, compute_rp_uuid):
5652
5655
dev_rp_name_prefix = ("%s:NIC Switch agent:" % hostname )
5653
5656
5654
5657
sriov_pf1_rp_uuid = getattr (uuids , sriov_agent_rp_uuid + 'PF1' )
5655
- self .sriov_dev_rp_per_host [compute_rp_uuid ]['pf1' ] = sriov_pf1_rp_uuid
5658
+ self .sriov_dev_rp_per_host [
5659
+ compute_rp_uuid ][self .PF1 ] = sriov_pf1_rp_uuid
5656
5660
5657
5661
inventories = {
5658
5662
orc .NET_BW_IGR_KILOBIT_PER_SEC : {"total" : 100000 },
@@ -5664,7 +5668,8 @@ def _create_sriov_networking_rp_tree(self, hostname, compute_rp_uuid):
5664
5668
device_rp_name = dev_rp_name_prefix + "%s-ens1" % hostname )
5665
5669
5666
5670
sriov_pf2_rp_uuid = getattr (uuids , sriov_agent_rp_uuid + 'PF2' )
5667
- self .sriov_dev_rp_per_host [compute_rp_uuid ]['pf2' ] = sriov_pf2_rp_uuid
5671
+ self .sriov_dev_rp_per_host [
5672
+ compute_rp_uuid ][self .PF2 ] = sriov_pf2_rp_uuid
5668
5673
inventories = {
5669
5674
orc .NET_BW_IGR_KILOBIT_PER_SEC : {"total" : 100000 },
5670
5675
orc .NET_BW_EGR_KILOBIT_PER_SEC : {"total" : 100000 },
@@ -5676,7 +5681,8 @@ def _create_sriov_networking_rp_tree(self, hostname, compute_rp_uuid):
5676
5681
device_rp_name = dev_rp_name_prefix + "%s-ens2" % hostname )
5677
5682
5678
5683
sriov_pf3_rp_uuid = getattr (uuids , sriov_agent_rp_uuid + 'PF3' )
5679
- self .sriov_dev_rp_per_host [compute_rp_uuid ]['pf3' ] = sriov_pf3_rp_uuid
5684
+ self .sriov_dev_rp_per_host [
5685
+ compute_rp_uuid ][self .PF3 ] = sriov_pf3_rp_uuid
5680
5686
inventories = {}
5681
5687
traits = [self .CUSTOM_VNIC_TYPE_DIRECT , self .CUSTOM_PHYSNET2 ]
5682
5688
self ._create_pf_device_rp (
@@ -5982,7 +5988,7 @@ def test_one_ovs_one_sriov_port(self):
5982
5988
self .ovs_bridge_rp_per_host [self .compute1_rp_uuid ]]['resources' ]
5983
5989
sriov_allocations = allocations [
5984
5990
self .sriov_dev_rp_per_host [
5985
- self .compute1_rp_uuid ]['pf2' ]]['resources' ]
5991
+ self .compute1_rp_uuid ][self . PF2 ]]['resources' ]
5986
5992
5987
5993
self .assertPortMatchesAllocation (ovs_port , ovs_allocations )
5988
5994
self .assertPortMatchesAllocation (sriov_port , sriov_allocations )
@@ -5995,7 +6001,7 @@ def test_one_ovs_one_sriov_port(self):
5995
6001
ovs_binding ['allocation' ])
5996
6002
sriov_binding = sriov_port ['binding:profile' ]
5997
6003
self .assertEqual (
5998
- self .sriov_dev_rp_per_host [self .compute1_rp_uuid ]['pf2' ],
6004
+ self .sriov_dev_rp_per_host [self .compute1_rp_uuid ][self . PF2 ],
5999
6005
sriov_binding ['allocation' ])
6000
6006
6001
6007
def test_interface_detach_with_port_with_bandwidth_request (self ):
@@ -6182,7 +6188,7 @@ def test_two_sriov_ports_one_with_request_two_available_pfs(self):
6182
6188
6183
6189
sriov_allocations = allocations [
6184
6190
self .sriov_dev_rp_per_host [
6185
- self .compute1_rp_uuid ]['pf2' ]]['resources' ]
6191
+ self .compute1_rp_uuid ][self . PF2 ]]['resources' ]
6186
6192
self .assertPortMatchesAllocation (
6187
6193
sriov_port_with_res_req , sriov_allocations )
6188
6194
@@ -6191,7 +6197,7 @@ def test_two_sriov_ports_one_with_request_two_available_pfs(self):
6191
6197
# request
6192
6198
sriov_with_req_binding = sriov_port_with_res_req ['binding:profile' ]
6193
6199
self .assertEqual (
6194
- self .sriov_dev_rp_per_host [self .compute1_rp_uuid ]['pf2' ],
6200
+ self .sriov_dev_rp_per_host [self .compute1_rp_uuid ][self . PF2 ],
6195
6201
sriov_with_req_binding ['allocation' ])
6196
6202
# and the port without resource request does not have allocation
6197
6203
sriov_binding = sriov_port ['binding:profile' ]
@@ -6278,7 +6284,7 @@ def test_sriov_macvtap_port_with_resource_request(self):
6278
6284
allocations , self .compute1_rp_uuid , self .flavor )
6279
6285
6280
6286
sriov_allocations = allocations [self .sriov_dev_rp_per_host [
6281
- self .compute1_rp_uuid ]['pf2' ]]['resources' ]
6287
+ self .compute1_rp_uuid ][self . PF2 ]]['resources' ]
6282
6288
self .assertPortMatchesAllocation (
6283
6289
port , sriov_allocations )
6284
6290
@@ -6287,7 +6293,7 @@ def test_sriov_macvtap_port_with_resource_request(self):
6287
6293
# request
6288
6294
port_binding = port ['binding:profile' ]
6289
6295
self .assertEqual (
6290
- self .sriov_dev_rp_per_host [self .compute1_rp_uuid ]['pf2' ],
6296
+ self .sriov_dev_rp_per_host [self .compute1_rp_uuid ][self . PF2 ],
6291
6297
port_binding ['allocation' ])
6292
6298
6293
6299
# We expect that the selected PCI device matches with the RP from
@@ -6365,7 +6371,7 @@ def _check_allocation(
6365
6371
self .ovs_bridge_rp_per_host [compute_rp_uuid ]]['resources' ]
6366
6372
self .assertPortMatchesAllocation (qos_port , ovs_allocations )
6367
6373
sriov_allocations = allocations [
6368
- self .sriov_dev_rp_per_host [compute_rp_uuid ]['pf2' ]]['resources' ]
6374
+ self .sriov_dev_rp_per_host [compute_rp_uuid ][self . PF2 ]]['resources' ]
6369
6375
self .assertPortMatchesAllocation (qos_sriov_port , sriov_allocations )
6370
6376
6371
6377
# We expect that only the RP uuid of the networking RP having the port
@@ -6375,7 +6381,7 @@ def _check_allocation(
6375
6381
self .assertEqual (self .ovs_bridge_rp_per_host [compute_rp_uuid ],
6376
6382
qos_binding_profile ['allocation' ])
6377
6383
qos_sriov_binding_profile = updated_qos_sriov_port ['binding:profile' ]
6378
- self .assertEqual (self .sriov_dev_rp_per_host [compute_rp_uuid ]['pf2' ],
6384
+ self .assertEqual (self .sriov_dev_rp_per_host [compute_rp_uuid ][self . PF2 ],
6379
6385
qos_sriov_binding_profile ['allocation' ])
6380
6386
6381
6387
# And we expect not to have any allocation set in the port binding for
@@ -6399,7 +6405,7 @@ def _check_allocation(
6399
6405
self .assertPortMatchesAllocation (qos_port , ovs_allocations )
6400
6406
sriov_allocations = migration_allocations [
6401
6407
self .sriov_dev_rp_per_host [
6402
- source_compute_rp_uuid ]['pf2' ]]['resources' ]
6408
+ source_compute_rp_uuid ][self . PF2 ]]['resources' ]
6403
6409
self .assertPortMatchesAllocation (qos_sriov_port , sriov_allocations )
6404
6410
6405
6411
def _create_server_with_ports (self , * ports ):
0 commit comments