Skip to content

Commit 1d9a131

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Use common server create function for qos func tests"
2 parents 8b109a2 + 52a03b1 commit 1d9a131

File tree

1 file changed

+13
-78
lines changed

1 file changed

+13
-78
lines changed

nova/tests/functional/test_servers.py

Lines changed: 13 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -6509,14 +6509,9 @@ def test_migrate_server_with_qos_port_old_dest_compute_no_alternate(self):
65096509
qos_normal_port = self.neutron.port_with_resource_request
65106510
qos_sriov_port = self.neutron.port_with_sriov_resource_request
65116511

6512-
server = self._create_server_with_ports(
6512+
server = self._create_server_with_ports_and_check_allocation(
65136513
non_qos_normal_port, qos_normal_port, qos_sriov_port)
65146514

6515-
# check that the server allocates from the current host properly
6516-
self._check_allocation(
6517-
server, self.compute1_rp_uuid, non_qos_normal_port,
6518-
qos_normal_port, qos_sriov_port, self.flavor_with_group_policy)
6519-
65206515
orig_get_service = nova.objects.Service.get_by_host_and_binary
65216516

65226517
def fake_get_service(context, host, binary):
@@ -6568,14 +6563,9 @@ def test_migrate_server_with_qos_port_old_dest_compute_alternate(self):
65686563
qos_normal_port = self.neutron.port_with_resource_request
65696564
qos_sriov_port = self.neutron.port_with_sriov_resource_request
65706565

6571-
server = self._create_server_with_ports(
6566+
server = self._create_server_with_ports_and_check_allocation(
65726567
non_qos_normal_port, qos_normal_port, qos_sriov_port)
65736568

6574-
# check that the server allocates from the current host properly
6575-
self._check_allocation(
6576-
server, self.compute1_rp_uuid, non_qos_normal_port,
6577-
qos_normal_port, qos_sriov_port, self.flavor_with_group_policy)
6578-
65796569
orig_get_service = nova.objects.Service.get_by_host_and_binary
65806570

65816571
def fake_get_service(context, host, binary):
@@ -6628,14 +6618,9 @@ def _test_resize_or_migrate_server_with_qos_ports(self, new_flavor=None):
66286618
qos_normal_port = self.neutron.port_with_resource_request
66296619
qos_sriov_port = self.neutron.port_with_sriov_resource_request
66306620

6631-
server = self._create_server_with_ports(
6621+
server = self._create_server_with_ports_and_check_allocation(
66326622
non_qos_normal_port, qos_normal_port, qos_sriov_port)
66336623

6634-
# check that the server allocates from the current host properly
6635-
self._check_allocation(
6636-
server, self.compute1_rp_uuid, non_qos_normal_port,
6637-
qos_normal_port, qos_sriov_port, self.flavor_with_group_policy)
6638-
66396624
if new_flavor:
66406625
self.api_fixture.api.post_server_action(
66416626
server['id'], {'resize': {"flavorRef": new_flavor['id']}})
@@ -6681,14 +6666,9 @@ def _test_resize_or_migrate_revert_with_qos_ports(self, new_flavor=None):
66816666
qos_port = self.neutron.port_with_resource_request
66826667
qos_sriov_port = self.neutron.port_with_sriov_resource_request
66836668

6684-
server = self._create_server_with_ports(
6669+
server = self._create_server_with_ports_and_check_allocation(
66856670
non_qos_port, qos_port, qos_sriov_port)
66866671

6687-
# check that the server allocates from the current host properly
6688-
self._check_allocation(
6689-
server, self.compute1_rp_uuid, non_qos_port, qos_port,
6690-
qos_sriov_port, self.flavor_with_group_policy)
6691-
66926672
if new_flavor:
66936673
self.api_fixture.api.post_server_action(
66946674
server['id'], {'resize': {"flavorRef": new_flavor['id']}})
@@ -6743,14 +6723,9 @@ def _test_resize_or_migrate_server_with_qos_port_reschedule_success(
67436723
qos_port = self.neutron.port_with_resource_request
67446724
qos_sriov_port = self.neutron.port_with_sriov_resource_request
67456725

6746-
server = self._create_server_with_ports(
6726+
server = self._create_server_with_ports_and_check_allocation(
67476727
non_qos_port, qos_port, qos_sriov_port)
67486728

6749-
# check that the server allocates from the current host properly
6750-
self._check_allocation(
6751-
server, self.compute1_rp_uuid, non_qos_port, qos_port,
6752-
qos_sriov_port, self.flavor_with_group_policy)
6753-
67546729
# Yes this isn't great in a functional test, but it's simple.
67556730
original_prep_resize = compute_manager.ComputeManager._prep_resize
67566731

@@ -6819,14 +6794,9 @@ def _test_resize_or_migrate_server_with_qos_port_reschedule_failure(
68196794
qos_port = self.neutron.port_with_resource_request
68206795
qos_sriov_port = self.neutron.port_with_sriov_resource_request
68216796

6822-
server = self._create_server_with_ports(
6797+
server = self._create_server_with_ports_and_check_allocation(
68236798
non_qos_port, qos_port, qos_sriov_port)
68246799

6825-
# check that the server allocates from the current host properly
6826-
self._check_allocation(
6827-
server, self.compute1_rp_uuid, non_qos_port, qos_port,
6828-
qos_sriov_port, self.flavor_with_group_policy)
6829-
68306800
# The patched compute manager on host2 will raise from _prep_resize.
68316801
# Then the migration is reschedule but there is no other host to
68326802
# choose from.
@@ -6883,14 +6853,9 @@ def test_migrate_server_with_qos_port_pci_update_fail_not_reschedule(self):
68836853
qos_port = self.neutron.port_with_resource_request
68846854
qos_sriov_port = self.neutron.port_with_sriov_resource_request
68856855

6886-
server = self._create_server_with_ports(
6856+
server = self._create_server_with_ports_and_check_allocation(
68876857
non_qos_port, qos_port, qos_sriov_port)
68886858

6889-
# check that the server allocates from the current host properly
6890-
self._check_allocation(
6891-
server, self.compute1_rp_uuid, non_qos_port, qos_port,
6892-
qos_sriov_port, self.flavor_with_group_policy)
6893-
68946859
# The compute manager on host2 will raise from
68956860
# update_pci_request_spec_with_allocated_interface_name which will
68966861
# intentionally not trigger a re-schedule even if there is host3 as an
@@ -7118,14 +7083,9 @@ def test_evacuate_with_qos_port(self, host=None):
71187083
qos_normal_port = self.neutron.port_with_resource_request
71197084
qos_sriov_port = self.neutron.port_with_sriov_resource_request
71207085

7121-
server = self._create_server_with_ports(
7086+
server = self._create_server_with_ports_and_check_allocation(
71227087
non_qos_normal_port, qos_normal_port, qos_sriov_port)
71237088

7124-
# check that the server allocates from the current host properly
7125-
self._check_allocation(
7126-
server, self.compute1_rp_uuid, non_qos_normal_port,
7127-
qos_normal_port, qos_sriov_port, self.flavor_with_group_policy)
7128-
71297089
# force source compute down
71307090
self.compute1.stop()
71317091
self.admin_api.put_service(
@@ -7169,14 +7129,9 @@ def test_evacuate_with_qos_port_fails_recover_source_compute(self):
71697129
qos_normal_port = self.neutron.port_with_resource_request
71707130
qos_sriov_port = self.neutron.port_with_sriov_resource_request
71717131

7172-
server = self._create_server_with_ports(
7132+
server = self._create_server_with_ports_and_check_allocation(
71737133
non_qos_normal_port, qos_normal_port, qos_sriov_port)
71747134

7175-
# check that the server allocates from the current host properly
7176-
self._check_allocation(
7177-
server, self.compute1_rp_uuid, non_qos_normal_port,
7178-
qos_normal_port, qos_sriov_port, self.flavor_with_group_policy)
7179-
71807135
# force source compute down
71817136
self.compute1.stop()
71827137
self.admin_api.put_service(
@@ -7231,14 +7186,9 @@ def test_evacuate_with_qos_port_pci_update_fail(self):
72317186
qos_port = self.neutron.port_with_resource_request
72327187
qos_sriov_port = self.neutron.port_with_sriov_resource_request
72337188

7234-
server = self._create_server_with_ports(
7189+
server = self._create_server_with_ports_and_check_allocation(
72357190
non_qos_port, qos_port, qos_sriov_port)
72367191

7237-
# check that the server allocates from the current host properly
7238-
self._check_allocation(
7239-
server, self.compute1_rp_uuid, non_qos_port, qos_port,
7240-
qos_sriov_port, self.flavor_with_group_policy)
7241-
72427192
# force source compute down
72437193
self.compute1.stop()
72447194
self.admin_api.put_service(
@@ -7279,14 +7229,9 @@ def test_live_migrate_with_qos_port(self, host=None):
72797229
qos_normal_port = self.neutron.port_with_resource_request
72807230
qos_sriov_port = self.neutron.port_with_sriov_resource_request
72817231

7282-
server = self._create_server_with_ports(
7232+
server = self._create_server_with_ports_and_check_allocation(
72837233
non_qos_normal_port, qos_normal_port, qos_sriov_port)
72847234

7285-
# check that the server allocates from the current host properly
7286-
self._check_allocation(
7287-
server, self.compute1_rp_uuid, non_qos_normal_port,
7288-
qos_normal_port, qos_sriov_port, self.flavor_with_group_policy)
7289-
72907235
self.api.post_server_action(
72917236
server['id'],
72927237
{
@@ -7327,14 +7272,9 @@ def test_live_migrate_with_qos_port_reschedule_success(self):
73277272
qos_normal_port = self.neutron.port_with_resource_request
73287273
qos_sriov_port = self.neutron.port_with_sriov_resource_request
73297274

7330-
server = self._create_server_with_ports(
7275+
server = self._create_server_with_ports_and_check_allocation(
73317276
non_qos_normal_port, qos_normal_port, qos_sriov_port)
73327277

7333-
# check that the server allocates from the current host properly
7334-
self._check_allocation(
7335-
server, self.compute1_rp_uuid, non_qos_normal_port,
7336-
qos_normal_port, qos_sriov_port, self.flavor_with_group_policy)
7337-
73387278
orig_check = nova.virt.fake.FakeDriver.\
73397279
check_can_live_migrate_destination
73407280

@@ -7386,14 +7326,9 @@ def test_live_migrate_with_qos_port_reschedule_fails(self):
73867326
qos_normal_port = self.neutron.port_with_resource_request
73877327
qos_sriov_port = self.neutron.port_with_sriov_resource_request
73887328

7389-
server = self._create_server_with_ports(
7329+
server = self._create_server_with_ports_and_check_allocation(
73907330
non_qos_normal_port, qos_normal_port, qos_sriov_port)
73917331

7392-
# check that the server allocates from the current host properly
7393-
self._check_allocation(
7394-
server, self.compute1_rp_uuid, non_qos_normal_port,
7395-
qos_normal_port, qos_sriov_port, self.flavor_with_group_policy)
7396-
73977332
with mock.patch(
73987333
'nova.virt.fake.FakeDriver.check_can_live_migrate_destination',
73997334
side_effect=exception.MigrationPreCheckError(

0 commit comments

Comments
 (0)