Browse Source

Merge "prepare func test env for moving servers with bandwidth"

changes/72/671072/18
Zuul 1 week ago
parent
commit
c1de64a657
1 changed files with 28 additions and 13 deletions
  1. 28
    13
      nova/tests/functional/test_servers.py

+ 28
- 13
nova/tests/functional/test_servers.py View File

@@ -5524,6 +5524,7 @@ class PortResourceRequestBasedSchedulingTestBase(
5524 5524
         self.compute1 = self._start_compute('host1')
5525 5525
         self.compute1_rp_uuid = self._get_provider_uuid_by_host('host1')
5526 5526
         self.ovs_bridge_rp_per_host = {}
5527
+        self.sriov_dev_rp_per_host = {}
5527 5528
         self.flavor = self.api.get_flavors()[0]
5528 5529
         self.flavor_with_group_policy = self.api.get_flavors()[1]
5529 5530
 
@@ -5651,6 +5652,7 @@ class PortResourceRequestBasedSchedulingTestBase(
5651 5652
         # physnet2 it will have bandwidth inventory.
5652 5653
         # * PF3 represents the PCI device 0000:03:00 and, it will be mapped to
5653 5654
         # physnet2 but it will not have bandwidth inventory.
5655
+        self.sriov_dev_rp_per_host[compute_rp_uuid] = {}
5654 5656
 
5655 5657
         compute_name = compute_rp_uuid
5656 5658
         sriov_agent_rp_uuid = getattr(uuids, compute_rp_uuid + 'sriov agent')
@@ -5663,17 +5665,20 @@ class PortResourceRequestBasedSchedulingTestBase(
5663 5665
                                 body=agent_rp_req,
5664 5666
                                 version='1.20')
5665 5667
 
5666
-        self.sriov_pf1_rp_uuid = getattr(uuids, sriov_agent_rp_uuid + 'PF1')
5668
+        sriov_pf1_rp_uuid = getattr(uuids, sriov_agent_rp_uuid + 'PF1')
5669
+        self.sriov_dev_rp_per_host[compute_rp_uuid]['pf1'] = sriov_pf1_rp_uuid
5670
+
5667 5671
         inventories = {
5668 5672
             orc.NET_BW_IGR_KILOBIT_PER_SEC: {"total": 100000},
5669 5673
             orc.NET_BW_EGR_KILOBIT_PER_SEC: {"total": 100000},
5670 5674
         }
5671 5675
         traits = [self.CUSTOM_VNIC_TYPE_DIRECT, self.CUSTOM_PHYSNET1]
5672 5676
         self._create_pf_device_rp(
5673
-            self.sriov_pf1_rp_uuid, sriov_agent_rp_uuid, inventories, traits,
5677
+            sriov_pf1_rp_uuid, sriov_agent_rp_uuid, inventories, traits,
5674 5678
             device_rp_name="%s:NIC Switch agent:ens1" % compute_name)
5675 5679
 
5676
-        self.sriov_pf2_rp_uuid = getattr(uuids, sriov_agent_rp_uuid + 'PF2')
5680
+        sriov_pf2_rp_uuid = getattr(uuids, sriov_agent_rp_uuid + 'PF2')
5681
+        self.sriov_dev_rp_per_host[compute_rp_uuid]['pf2'] = sriov_pf2_rp_uuid
5677 5682
         inventories = {
5678 5683
             orc.NET_BW_IGR_KILOBIT_PER_SEC: {"total": 100000},
5679 5684
             orc.NET_BW_EGR_KILOBIT_PER_SEC: {"total": 100000},
@@ -5681,14 +5686,15 @@ class PortResourceRequestBasedSchedulingTestBase(
5681 5686
         traits = [self.CUSTOM_VNIC_TYPE_DIRECT, self.CUSTOM_VNIC_TYPE_MACVTAP,
5682 5687
                   self.CUSTOM_PHYSNET2]
5683 5688
         self._create_pf_device_rp(
5684
-            self.sriov_pf2_rp_uuid, sriov_agent_rp_uuid, inventories, traits,
5689
+            sriov_pf2_rp_uuid, sriov_agent_rp_uuid, inventories, traits,
5685 5690
             device_rp_name="%s:NIC Switch agent:ens2" % compute_name)
5686 5691
 
5687
-        self.sriov_pf3_rp_uuid = getattr(uuids, sriov_agent_rp_uuid + 'PF3')
5692
+        sriov_pf3_rp_uuid = getattr(uuids, sriov_agent_rp_uuid + 'PF3')
5693
+        self.sriov_dev_rp_per_host[compute_rp_uuid]['pf3'] = sriov_pf3_rp_uuid
5688 5694
         inventories = {}
5689 5695
         traits = [self.CUSTOM_VNIC_TYPE_DIRECT, self.CUSTOM_PHYSNET2]
5690 5696
         self._create_pf_device_rp(
5691
-            self.sriov_pf3_rp_uuid, sriov_agent_rp_uuid, inventories, traits,
5697
+            sriov_pf3_rp_uuid, sriov_agent_rp_uuid, inventories, traits,
5692 5698
             device_rp_name="%s:NIC Switch agent:ens3" % compute_name)
5693 5699
 
5694 5700
     def _create_networking_rp_tree(self, compute_rp_uuid):
@@ -6033,7 +6039,10 @@ class PortResourceRequestBasedSchedulingTest(
6033 6039
 
6034 6040
         ovs_allocations = allocations[
6035 6041
             self.ovs_bridge_rp_per_host[self.compute1_rp_uuid]]['resources']
6036
-        sriov_allocations = allocations[self.sriov_pf2_rp_uuid]['resources']
6042
+        sriov_allocations = allocations[
6043
+            self.sriov_dev_rp_per_host[
6044
+                self.compute1_rp_uuid]['pf2']]['resources']
6045
+
6037 6046
         self.assertPortMatchesAllocation(ovs_port, ovs_allocations)
6038 6047
         self.assertPortMatchesAllocation(sriov_port, sriov_allocations)
6039 6048
 
@@ -6044,8 +6053,9 @@ class PortResourceRequestBasedSchedulingTest(
6044 6053
         self.assertEqual(self.ovs_bridge_rp_per_host[self.compute1_rp_uuid],
6045 6054
                          ovs_binding['allocation'])
6046 6055
         sriov_binding = sriov_port['binding:profile']
6047
-        self.assertEqual(self.sriov_pf2_rp_uuid,
6048
-                         sriov_binding['allocation'])
6056
+        self.assertEqual(
6057
+            self.sriov_dev_rp_per_host[self.compute1_rp_uuid]['pf2'],
6058
+            sriov_binding['allocation'])
6049 6059
 
6050 6060
     def test_interface_detach_with_port_with_bandwidth_request(self):
6051 6061
         port = self.neutron.port_with_resource_request
@@ -6229,7 +6239,9 @@ class PortResourceRequestBasedSchedulingTest(
6229 6239
         self.assertComputeAllocationMatchesFlavor(
6230 6240
             allocations, self.compute1_rp_uuid, self.flavor_with_group_policy)
6231 6241
 
6232
-        sriov_allocations = allocations[self.sriov_pf2_rp_uuid]['resources']
6242
+        sriov_allocations = allocations[
6243
+            self.sriov_dev_rp_per_host[
6244
+                self.compute1_rp_uuid]['pf2']]['resources']
6233 6245
         self.assertPortMatchesAllocation(
6234 6246
             sriov_port_with_res_req, sriov_allocations)
6235 6247
 
@@ -6238,7 +6250,8 @@ class PortResourceRequestBasedSchedulingTest(
6238 6250
         # request
6239 6251
         sriov_with_req_binding = sriov_port_with_res_req['binding:profile']
6240 6252
         self.assertEqual(
6241
-            self.sriov_pf2_rp_uuid, sriov_with_req_binding['allocation'])
6253
+            self.sriov_dev_rp_per_host[self.compute1_rp_uuid]['pf2'],
6254
+            sriov_with_req_binding['allocation'])
6242 6255
         # and the port without resource request does not have allocation
6243 6256
         sriov_binding = sriov_port['binding:profile']
6244 6257
         self.assertNotIn('allocation', sriov_binding)
@@ -6323,7 +6336,8 @@ class PortResourceRequestBasedSchedulingTest(
6323 6336
         self.assertComputeAllocationMatchesFlavor(
6324 6337
             allocations, self.compute1_rp_uuid, self.flavor)
6325 6338
 
6326
-        sriov_allocations = allocations[self.sriov_pf2_rp_uuid]['resources']
6339
+        sriov_allocations = allocations[self.sriov_dev_rp_per_host[
6340
+                self.compute1_rp_uuid]['pf2']]['resources']
6327 6341
         self.assertPortMatchesAllocation(
6328 6342
             port, sriov_allocations)
6329 6343
 
@@ -6332,7 +6346,8 @@ class PortResourceRequestBasedSchedulingTest(
6332 6346
         # request
6333 6347
         port_binding = port['binding:profile']
6334 6348
         self.assertEqual(
6335
-            self.sriov_pf2_rp_uuid, port_binding['allocation'])
6349
+            self.sriov_dev_rp_per_host[self.compute1_rp_uuid]['pf2'],
6350
+            port_binding['allocation'])
6336 6351
 
6337 6352
         # We expect that the selected PCI device matches with the RP from
6338 6353
         # where the bandwidth is allocated from. The bandwidth is allocated

Loading…
Cancel
Save