Skip to content

Commit 00ed8a2

Browse files
committed
Add a workaround to skip hypervisor version check on LM
When turned on, this will disable the version-checking of hypervisors during live-migration. This can be useful for operators in certain scenarios when upgrading. E.g. if you want to relocate all instances off a compute node due to an emergency hardware issue, and you only have another old compute node ready at the time. Note, though: libvirt will do its own internal compatibility checks, and might still reject live migration if the destination is incompatible. Closes-Bug: #1982853 Change-Id: Iec387dcbc49ddb91ebf5cfd188224eaf6021c0e1 Signed-off-by: Kashyap Chamarthy <[email protected]>
1 parent de65131 commit 00ed8a2

File tree

4 files changed

+53
-2
lines changed

4 files changed

+53
-2
lines changed

nova/conductor/tasks/live_migrate.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,9 @@ def _check_compatible_with_source_hypervisor(self, destination):
347347

348348
source_version = source_info.hypervisor_version
349349
destination_version = destination_info.hypervisor_version
350-
if source_version > destination_version:
351-
raise exception.DestinationHypervisorTooOld()
350+
if not CONF.workarounds.skip_hypervisor_version_check_on_lm:
351+
if source_version > destination_version:
352+
raise exception.DestinationHypervisorTooOld()
352353
return source_info, destination_info
353354

354355
def _call_livem_checks_on_host(self, destination, provider_mapping):

nova/conf/workarounds.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,13 @@
409409
with the destination host. When using QEMU >= 2.9 and libvirt >=
410410
4.4.0, libvirt will do the correct thing with respect to checking CPU
411411
compatibility on the destination host during live migration.
412+
"""),
413+
cfg.BoolOpt(
414+
'skip_hypervisor_version_check_on_lm',
415+
default=False,
416+
help="""
417+
When this is enabled, it will skip version-checking of hypervisors
418+
during live migration.
412419
"""),
413420
]
414421

nova/tests/unit/conductor/tasks/test_live_migrate.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,36 @@ def test_check_compatible_fails_with_hypervisor_too_old(
345345
mock.call(self.destination)],
346346
mock_get_info.call_args_list)
347347

348+
@mock.patch.object(live_migrate.LiveMigrationTask, '_get_compute_info')
349+
def test_skip_hypervisor_version_check_on_lm_raise_ex(self, mock_get_info):
350+
host1 = {'hypervisor_type': 'a', 'hypervisor_version': 7}
351+
host2 = {'hypervisor_type': 'a', 'hypervisor_version': 6}
352+
self.flags(group='workarounds',
353+
skip_hypervisor_version_check_on_lm=False)
354+
mock_get_info.side_effect = [objects.ComputeNode(**host1),
355+
objects.ComputeNode(**host2)]
356+
self.assertRaises(exception.DestinationHypervisorTooOld,
357+
self.task._check_compatible_with_source_hypervisor,
358+
self.destination)
359+
self.assertEqual([mock.call(self.instance_host),
360+
mock.call(self.destination)],
361+
mock_get_info.call_args_list)
362+
363+
@mock.patch.object(live_migrate.LiveMigrationTask, '_get_compute_info')
364+
def test_skip_hypervisor_version_check_on_lm_do_not_raise_ex(
365+
self, mock_get_info
366+
):
367+
host1 = {'hypervisor_type': 'a', 'hypervisor_version': 7}
368+
host2 = {'hypervisor_type': 'a', 'hypervisor_version': 6}
369+
self.flags(group='workarounds',
370+
skip_hypervisor_version_check_on_lm=True)
371+
mock_get_info.side_effect = [objects.ComputeNode(**host1),
372+
objects.ComputeNode(**host2)]
373+
self.task._check_compatible_with_source_hypervisor(self.destination)
374+
self.assertEqual([mock.call(self.instance_host),
375+
mock.call(self.destination)],
376+
mock_get_info.call_args_list)
377+
348378
@mock.patch.object(compute_rpcapi.ComputeAPI,
349379
'check_can_live_migrate_destination')
350380
def test_check_requested_destination(self, mock_check):
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
feature:
3+
- |
4+
Adds a workaround that allows one to disable hypervisor
5+
version-check on live migration. This workaround option can be
6+
useful in certain scenarios when upgrading. E.g. if you want to
7+
relocate all instances off a compute node due to an emergency
8+
hardware issue, and you only have another old compute node ready at
9+
the time.
10+
11+
To enable this, use the config attribute
12+
``[workarounds]skip_hypervisor_version_check_on_lm=True`` in
13+
``nova.conf``. The option defaults to ``False``.

0 commit comments

Comments
 (0)