Use common server create function for qos func tests
I1222fc21bde4158df1db70370c7f3bd319ec081f added a common helper for server creation. This patch updated the existing qos tests to use that helper. Change-Id: I017163c6cdf8727be9913a6870cd91fec5f4d568 blueprint: support-move-ops-with-qos-ports-ussuri
This commit is contained in:
@@ -6509,14 +6509,9 @@ class ServerMoveWithPortResourceRequestTest(
|
||||
qos_normal_port = self.neutron.port_with_resource_request
|
||||
qos_sriov_port = self.neutron.port_with_sriov_resource_request
|
||||
|
||||
server = self._create_server_with_ports(
|
||||
server = self._create_server_with_ports_and_check_allocation(
|
||||
non_qos_normal_port, qos_normal_port, qos_sriov_port)
|
||||
|
||||
# check that the server allocates from the current host properly
|
||||
self._check_allocation(
|
||||
server, self.compute1_rp_uuid, non_qos_normal_port,
|
||||
qos_normal_port, qos_sriov_port, self.flavor_with_group_policy)
|
||||
|
||||
orig_get_service = nova.objects.Service.get_by_host_and_binary
|
||||
|
||||
def fake_get_service(context, host, binary):
|
||||
@@ -6568,14 +6563,9 @@ class ServerMoveWithPortResourceRequestTest(
|
||||
qos_normal_port = self.neutron.port_with_resource_request
|
||||
qos_sriov_port = self.neutron.port_with_sriov_resource_request
|
||||
|
||||
server = self._create_server_with_ports(
|
||||
server = self._create_server_with_ports_and_check_allocation(
|
||||
non_qos_normal_port, qos_normal_port, qos_sriov_port)
|
||||
|
||||
# check that the server allocates from the current host properly
|
||||
self._check_allocation(
|
||||
server, self.compute1_rp_uuid, non_qos_normal_port,
|
||||
qos_normal_port, qos_sriov_port, self.flavor_with_group_policy)
|
||||
|
||||
orig_get_service = nova.objects.Service.get_by_host_and_binary
|
||||
|
||||
def fake_get_service(context, host, binary):
|
||||
@@ -6628,14 +6618,9 @@ class ServerMoveWithPortResourceRequestTest(
|
||||
qos_normal_port = self.neutron.port_with_resource_request
|
||||
qos_sriov_port = self.neutron.port_with_sriov_resource_request
|
||||
|
||||
server = self._create_server_with_ports(
|
||||
server = self._create_server_with_ports_and_check_allocation(
|
||||
non_qos_normal_port, qos_normal_port, qos_sriov_port)
|
||||
|
||||
# check that the server allocates from the current host properly
|
||||
self._check_allocation(
|
||||
server, self.compute1_rp_uuid, non_qos_normal_port,
|
||||
qos_normal_port, qos_sriov_port, self.flavor_with_group_policy)
|
||||
|
||||
if new_flavor:
|
||||
self.api_fixture.api.post_server_action(
|
||||
server['id'], {'resize': {"flavorRef": new_flavor['id']}})
|
||||
@@ -6681,14 +6666,9 @@ class ServerMoveWithPortResourceRequestTest(
|
||||
qos_port = self.neutron.port_with_resource_request
|
||||
qos_sriov_port = self.neutron.port_with_sriov_resource_request
|
||||
|
||||
server = self._create_server_with_ports(
|
||||
server = self._create_server_with_ports_and_check_allocation(
|
||||
non_qos_port, qos_port, qos_sriov_port)
|
||||
|
||||
# check that the server allocates from the current host properly
|
||||
self._check_allocation(
|
||||
server, self.compute1_rp_uuid, non_qos_port, qos_port,
|
||||
qos_sriov_port, self.flavor_with_group_policy)
|
||||
|
||||
if new_flavor:
|
||||
self.api_fixture.api.post_server_action(
|
||||
server['id'], {'resize': {"flavorRef": new_flavor['id']}})
|
||||
@@ -6743,14 +6723,9 @@ class ServerMoveWithPortResourceRequestTest(
|
||||
qos_port = self.neutron.port_with_resource_request
|
||||
qos_sriov_port = self.neutron.port_with_sriov_resource_request
|
||||
|
||||
server = self._create_server_with_ports(
|
||||
server = self._create_server_with_ports_and_check_allocation(
|
||||
non_qos_port, qos_port, qos_sriov_port)
|
||||
|
||||
# check that the server allocates from the current host properly
|
||||
self._check_allocation(
|
||||
server, self.compute1_rp_uuid, non_qos_port, qos_port,
|
||||
qos_sriov_port, self.flavor_with_group_policy)
|
||||
|
||||
# Yes this isn't great in a functional test, but it's simple.
|
||||
original_prep_resize = compute_manager.ComputeManager._prep_resize
|
||||
|
||||
@@ -6819,14 +6794,9 @@ class ServerMoveWithPortResourceRequestTest(
|
||||
qos_port = self.neutron.port_with_resource_request
|
||||
qos_sriov_port = self.neutron.port_with_sriov_resource_request
|
||||
|
||||
server = self._create_server_with_ports(
|
||||
server = self._create_server_with_ports_and_check_allocation(
|
||||
non_qos_port, qos_port, qos_sriov_port)
|
||||
|
||||
# check that the server allocates from the current host properly
|
||||
self._check_allocation(
|
||||
server, self.compute1_rp_uuid, non_qos_port, qos_port,
|
||||
qos_sriov_port, self.flavor_with_group_policy)
|
||||
|
||||
# The patched compute manager on host2 will raise from _prep_resize.
|
||||
# Then the migration is reschedule but there is no other host to
|
||||
# choose from.
|
||||
@@ -6883,14 +6853,9 @@ class ServerMoveWithPortResourceRequestTest(
|
||||
qos_port = self.neutron.port_with_resource_request
|
||||
qos_sriov_port = self.neutron.port_with_sriov_resource_request
|
||||
|
||||
server = self._create_server_with_ports(
|
||||
server = self._create_server_with_ports_and_check_allocation(
|
||||
non_qos_port, qos_port, qos_sriov_port)
|
||||
|
||||
# check that the server allocates from the current host properly
|
||||
self._check_allocation(
|
||||
server, self.compute1_rp_uuid, non_qos_port, qos_port,
|
||||
qos_sriov_port, self.flavor_with_group_policy)
|
||||
|
||||
# The compute manager on host2 will raise from
|
||||
# update_pci_request_spec_with_allocated_interface_name which will
|
||||
# intentionally not trigger a re-schedule even if there is host3 as an
|
||||
@@ -7118,14 +7083,9 @@ class ServerMoveWithPortResourceRequestTest(
|
||||
qos_normal_port = self.neutron.port_with_resource_request
|
||||
qos_sriov_port = self.neutron.port_with_sriov_resource_request
|
||||
|
||||
server = self._create_server_with_ports(
|
||||
server = self._create_server_with_ports_and_check_allocation(
|
||||
non_qos_normal_port, qos_normal_port, qos_sriov_port)
|
||||
|
||||
# check that the server allocates from the current host properly
|
||||
self._check_allocation(
|
||||
server, self.compute1_rp_uuid, non_qos_normal_port,
|
||||
qos_normal_port, qos_sriov_port, self.flavor_with_group_policy)
|
||||
|
||||
# force source compute down
|
||||
self.compute1.stop()
|
||||
self.admin_api.put_service(
|
||||
@@ -7169,14 +7129,9 @@ class ServerMoveWithPortResourceRequestTest(
|
||||
qos_normal_port = self.neutron.port_with_resource_request
|
||||
qos_sriov_port = self.neutron.port_with_sriov_resource_request
|
||||
|
||||
server = self._create_server_with_ports(
|
||||
server = self._create_server_with_ports_and_check_allocation(
|
||||
non_qos_normal_port, qos_normal_port, qos_sriov_port)
|
||||
|
||||
# check that the server allocates from the current host properly
|
||||
self._check_allocation(
|
||||
server, self.compute1_rp_uuid, non_qos_normal_port,
|
||||
qos_normal_port, qos_sriov_port, self.flavor_with_group_policy)
|
||||
|
||||
# force source compute down
|
||||
self.compute1.stop()
|
||||
self.admin_api.put_service(
|
||||
@@ -7231,14 +7186,9 @@ class ServerMoveWithPortResourceRequestTest(
|
||||
qos_port = self.neutron.port_with_resource_request
|
||||
qos_sriov_port = self.neutron.port_with_sriov_resource_request
|
||||
|
||||
server = self._create_server_with_ports(
|
||||
server = self._create_server_with_ports_and_check_allocation(
|
||||
non_qos_port, qos_port, qos_sriov_port)
|
||||
|
||||
# check that the server allocates from the current host properly
|
||||
self._check_allocation(
|
||||
server, self.compute1_rp_uuid, non_qos_port, qos_port,
|
||||
qos_sriov_port, self.flavor_with_group_policy)
|
||||
|
||||
# force source compute down
|
||||
self.compute1.stop()
|
||||
self.admin_api.put_service(
|
||||
@@ -7279,14 +7229,9 @@ class ServerMoveWithPortResourceRequestTest(
|
||||
qos_normal_port = self.neutron.port_with_resource_request
|
||||
qos_sriov_port = self.neutron.port_with_sriov_resource_request
|
||||
|
||||
server = self._create_server_with_ports(
|
||||
server = self._create_server_with_ports_and_check_allocation(
|
||||
non_qos_normal_port, qos_normal_port, qos_sriov_port)
|
||||
|
||||
# check that the server allocates from the current host properly
|
||||
self._check_allocation(
|
||||
server, self.compute1_rp_uuid, non_qos_normal_port,
|
||||
qos_normal_port, qos_sriov_port, self.flavor_with_group_policy)
|
||||
|
||||
self.api.post_server_action(
|
||||
server['id'],
|
||||
{
|
||||
@@ -7327,14 +7272,9 @@ class ServerMoveWithPortResourceRequestTest(
|
||||
qos_normal_port = self.neutron.port_with_resource_request
|
||||
qos_sriov_port = self.neutron.port_with_sriov_resource_request
|
||||
|
||||
server = self._create_server_with_ports(
|
||||
server = self._create_server_with_ports_and_check_allocation(
|
||||
non_qos_normal_port, qos_normal_port, qos_sriov_port)
|
||||
|
||||
# check that the server allocates from the current host properly
|
||||
self._check_allocation(
|
||||
server, self.compute1_rp_uuid, non_qos_normal_port,
|
||||
qos_normal_port, qos_sriov_port, self.flavor_with_group_policy)
|
||||
|
||||
orig_check = nova.virt.fake.FakeDriver.\
|
||||
check_can_live_migrate_destination
|
||||
|
||||
@@ -7386,14 +7326,9 @@ class ServerMoveWithPortResourceRequestTest(
|
||||
qos_normal_port = self.neutron.port_with_resource_request
|
||||
qos_sriov_port = self.neutron.port_with_sriov_resource_request
|
||||
|
||||
server = self._create_server_with_ports(
|
||||
server = self._create_server_with_ports_and_check_allocation(
|
||||
non_qos_normal_port, qos_normal_port, qos_sriov_port)
|
||||
|
||||
# check that the server allocates from the current host properly
|
||||
self._check_allocation(
|
||||
server, self.compute1_rp_uuid, non_qos_normal_port,
|
||||
qos_normal_port, qos_sriov_port, self.flavor_with_group_policy)
|
||||
|
||||
with mock.patch(
|
||||
'nova.virt.fake.FakeDriver.check_can_live_migrate_destination',
|
||||
side_effect=exception.MigrationPreCheckError(
|
||||
|
||||
Reference in New Issue
Block a user