Skip to content

Commit 7113ac4

Browse files
Balazs Gibizermriedem
authored andcommitted
Improve dest service level func tests
As a follow up for Ia69dace6d3b395fa113c1382e8eb52c2cc36119d and Id0ee10e8d323786f4d79c82e3f05b48e76bd0956 the functional test for destination compute service level check behavior is improved and documented a bit better. Change-Id: I406a4e812993682dfb5021ef931cce91e343463e blueprint: support-move-ops-with-qos-ports
1 parent e526afc commit 7113ac4

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

nova/tests/functional/test_servers.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6448,12 +6448,14 @@ def test_migrate_server_with_qos_port_old_dest_compute_no_alternate(self):
64486448
orig_get_service = nova.objects.Service.get_by_host_and_binary
64496449

64506450
def fake_get_service(context, host, binary):
6451-
if host == 'host1':
6452-
return orig_get_service(context, host, binary)
6451+
# host2 is the only migration target, let's make it too old so the
6452+
# migration will fail
64536453
if host == 'host2':
64546454
service = orig_get_service(context, host, binary)
64556455
service.version = 38
64566456
return service
6457+
else:
6458+
return orig_get_service(context, host, binary)
64576459

64586460
with mock.patch(
64596461
'nova.objects.Service.get_by_host_and_binary',
@@ -6504,16 +6506,20 @@ def test_migrate_server_with_qos_port_old_dest_compute_alternate(self):
65046506
orig_get_service = nova.objects.Service.get_by_host_and_binary
65056507

65066508
def fake_get_service(context, host, binary):
6507-
if host == 'host1':
6508-
return orig_get_service(context, host, binary)
6509+
# host2 is the first migration target, let's make it too old so the
6510+
# migration will skip this host
65096511
if host == 'host2':
65106512
service = orig_get_service(context, host, binary)
65116513
service.version = 38
65126514
return service
6513-
if host == 'host3':
6515+
# host3 is the second migration target, let's make it new enough so
6516+
# the migration task will choose this host
6517+
elif host == 'host3':
65146518
service = orig_get_service(context, host, binary)
65156519
service.version = 39
65166520
return service
6521+
else:
6522+
return orig_get_service(context, host, binary)
65176523

65186524
with mock.patch(
65196525
'nova.objects.Service.get_by_host_and_binary',
@@ -6525,7 +6531,8 @@ def fake_get_service(context, host, binary):
65256531

65266532
migration_uuid = self.get_migration_uuid_for_instance(server['id'])
65276533

6528-
# check that server allocates from host3
6534+
# check that server allocates from host3 and the migration allocates
6535+
# from host1
65296536
self._check_allocation(
65306537
server, compute3_rp_uuid, non_qos_normal_port, qos_normal_port,
65316538
qos_sriov_port, self.flavor_with_group_policy, migration_uuid,

0 commit comments

Comments
 (0)