Filter migration targets by hypervisor type
Migration tests should only migrate servers to hypervisors of the same type (e.g., QEMU to QEMU, not QEMU to Ironic). This prevents test failures in mixed hypervisor environments. Updated both scenario and functional migration tests to filter candidate hypervisors by hypervisor_type before selecting a migration target. Story: 2011623 Task: 53248 Assisted-By: Claude Code/claude-4.5-sonnet Change-Id: Ic661100db6d22a1528aeb2c69ef95f8f686e60aa Signed-off-by: Harald Jensås <hjensas@redhat.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Migration tests now filter candidate hypervisors by hypervisor type before
|
||||
selecting a migration target. This prevents test failures when attempting
|
||||
to migrate servers between incompatible hypervisor types (e.g., from QEMU
|
||||
compute nodes to Ironic baremetal nodes). Nova does not support migration
|
||||
between different hypervisor types, and tests will now properly select
|
||||
only compatible hypervisors of the same type (QEMU to QEMU, Ironic to
|
||||
Ironic, etc.) when performing live or cold migrations with an explicit
|
||||
target host.
|
||||
|
||||
For more information, see
|
||||
`Story 2011623 <https://storyboard.openstack.org/#!/story/2011623>`_.
|
||||
@@ -201,7 +201,17 @@ class MigrateServerTest(testtools.TestCase):
|
||||
"""
|
||||
server = self.setup_server()
|
||||
initial_hypervisor = nova.get_server_hypervisor(server)
|
||||
for hypervisor in nova.list_hypervisors(status='enabled', state='up'):
|
||||
|
||||
# Get the hypervisor object to determine its type
|
||||
initial_hypervisor_obj = nova.find_hypervisor(
|
||||
hypervisor_hostname=initial_hypervisor)
|
||||
initial_hypervisor_type = initial_hypervisor_obj.hypervisor_type
|
||||
|
||||
# Filter by same hypervisor type
|
||||
for hypervisor in nova.list_hypervisors(
|
||||
status='enabled',
|
||||
state='up',
|
||||
hypervisor_type=initial_hypervisor_type):
|
||||
if initial_hypervisor != hypervisor.hypervisor_hostname:
|
||||
target_hypervisor = hypervisor.hypervisor_hostname
|
||||
break
|
||||
|
||||
@@ -103,8 +103,16 @@ class BaseServerTest(testtools.TestCase):
|
||||
server = self.ensure_server(status='ACTIVE')
|
||||
initial_hypervisor = nova.get_server_hypervisor(server)
|
||||
|
||||
# Get the hypervisor object to determine its type
|
||||
initial_hypervisor_obj = nova.find_hypervisor(
|
||||
hypervisor_hostname=initial_hypervisor)
|
||||
initial_hypervisor_type = initial_hypervisor_obj.hypervisor_type
|
||||
|
||||
# Filter by same hypervisor type and exclude the current hypervisor
|
||||
hypervisors = nova.list_hypervisors(
|
||||
status='enabled', state='up').select(
|
||||
status='enabled',
|
||||
state='up',
|
||||
hypervisor_type=initial_hypervisor_type).select(
|
||||
lambda h: h.hypervisor_hostname != initial_hypervisor)
|
||||
if not hypervisors:
|
||||
tobiko.skip_test("Cannot find a valid hypervisor host to migrate "
|
||||
|
||||
Reference in New Issue
Block a user