NUMA LM: Add func test for bug 1845146

Bug 1845146 was caused by the update available resources periodic task
running during a small window in which the migration was in 'accepted'
but resource claims had been done. 'accepted' migrations were not
considered in progress before the fix for 1845146 merged as commit
6ec686c26b, which caused the periodic task to incorrectly free the
migration's resources from the destination. This patch adds a test
that triggers this race by wrapping around the compute manager's
live_migration() (which sets the 'queued' migration status - this was
actually wrong in 6ec686c26b, as it talks about 'preparing') and
running the update available resources periodic task while the
migration is still in 'accepted'.

Related bug: 1845146

Change-Id: I78e79112a9c803fb45d828cfb4641456da66364a
This commit is contained in:
Artom Lifshitz 2019-10-08 15:23:47 -04:00
parent 06aaa08dc4
commit 32713a4fe8
1 changed files with 19 additions and 0 deletions

View File

@ -18,6 +18,7 @@ import fixtures
from oslo_config import cfg
from oslo_log import log as logging
from nova.compute import manager as compute_manager
from nova import context
from nova import objects
from nova.tests.functional import integrated_helpers
@ -260,6 +261,24 @@ class NUMALiveMigrationPositiveTests(NUMALiveMigrationPositiveBase):
def test_numa_live_migration_dest_pinned(self):
self._test(pin_dest=True)
def test_bug_1843639(self):
orig_live_migration = \
compute_manager.ComputeManager.live_migration
def live_migration(*args, **kwargs):
self._run_periodics()
# During the migration, server_a is consuming CPUs 0,1 on host_a,
# while all 4 of host_b's CPU are consumed by server_b and the
# incoming # migration.
self._assert_host_consumed_cpus('host_a', [0, 1])
self._assert_host_consumed_cpus('host_b', [0, 1, 2, 3])
return orig_live_migration(*args, **kwargs)
self.useFixture(fixtures.MonkeyPatch(
'nova.compute.manager.ComputeManager.live_migration',
live_migration))
self._test()
class NUMALiveMigrationRollbackTests(NUMALiveMigrationPositiveBase):
"""Tests that expect the live migration to fail, and exist to test the