Check for single instance migration to backup node

In Host maintenance strategy tempest tests,
instances = self._create_one_instance_per_host(), instances var
contains the list of all instances created on all compute hosts.

We determine the src_node based on first server. Once it migrated
to backup node. Currently we are looping over all instances and
checking whether instance is moved to another node.

It works fine in case of 2 compute nodes. If we have more than
2 compute node, then it fails due to different compute node name
as It tries to check for all the instances (which is not what we
want).

This cr fixes the same by removing loop and checking the dst_node
for the moved instance and validating it with dst_node.

Closes-Bug: #2121355

Change-Id: I66bb4ca9e7aa7e60245febac664b9aa2c0c02bd8
Signed-off-by: Chandan Kumar (raukadah) <chkumar@redhat.com>
This commit is contained in:
Chandan Kumar (raukadah)
2025-08-21 16:10:07 +05:30
parent 83889873ce
commit 962a7350d0

View File

@@ -108,6 +108,8 @@ class TestExecuteHostMaintenanceStrategy(base.BaseInfraOptimScenarioTest):
'migrate'],
**audit_kwargs)
# Make sure servers are migrated to backup node
for server in instances:
self.assertEqual(self.get_host_for_server(server['id']), dst_node)
# Make sure server is migrated to backup node
self.assertEqual(
self.get_host_for_server(instances[0]['id']),
dst_node
)