From 32713a4fe885ee55ef0fefc8ce6c78877f2f03e7 Mon Sep 17 00:00:00 2001 From: Artom Lifshitz Date: Tue, 8 Oct 2019 15:23:47 -0400 Subject: [PATCH] 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 --- .../libvirt/test_numa_live_migration.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/nova/tests/functional/libvirt/test_numa_live_migration.py b/nova/tests/functional/libvirt/test_numa_live_migration.py index 18021ab46c04..535444f5f5c5 100644 --- a/nova/tests/functional/libvirt/test_numa_live_migration.py +++ b/nova/tests/functional/libvirt/test_numa_live_migration.py @@ -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