* [PATCH v3 1/5] tests/functional/migration: Use socket_dir
2026-03-03 13:43 [PATCH v3 0/5] tests/functional: Fix ppc64 issue with make -j Fabiano Rosas
@ 2026-03-03 13:43 ` Fabiano Rosas
2026-03-03 13:43 ` [PATCH v3 2/5] tests/functional/migration: Add migrate_vms Fabiano Rosas
` (3 subsequent siblings)
4 siblings, 0 replies; 11+ messages in thread
From: Fabiano Rosas @ 2026-03-03 13:43 UTC (permalink / raw)
To: qemu-devel; +Cc: adityag, thuth, berrange, peterx
Use QemuBaseTest.socket_dir instead of calling tempfile directly so
all tests have consistent directory prefixes.
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/functional/migration.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tests/functional/migration.py b/tests/functional/migration.py
index 2bfb1f7790..0aa873edba 100644
--- a/tests/functional/migration.py
+++ b/tests/functional/migration.py
@@ -11,7 +11,6 @@
# This work is licensed under the terms of the GNU GPL, version 2 or
# later. See the COPYING file in the top-level directory.
-import tempfile
import time
from qemu_test import QemuSystemTest, which
@@ -65,9 +64,8 @@ def migration_with_tcp_localhost(self):
self.do_migrate(dest_uri)
def migration_with_unix(self):
- with tempfile.TemporaryDirectory(prefix='socket_') as socket_path:
- dest_uri = 'unix:%s/qemu-test.sock' % socket_path
- self.do_migrate(dest_uri)
+ dest_uri = 'unix:%s/migration.sock' % self.socket_dir().name
+ self.do_migrate(dest_uri)
def migration_with_exec(self):
if not which('ncat'):
--
2.51.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v3 2/5] tests/functional/migration: Add migrate_vms
2026-03-03 13:43 [PATCH v3 0/5] tests/functional: Fix ppc64 issue with make -j Fabiano Rosas
2026-03-03 13:43 ` [PATCH v3 1/5] tests/functional/migration: Use socket_dir Fabiano Rosas
@ 2026-03-03 13:43 ` Fabiano Rosas
2026-03-03 14:14 ` Thomas Huth
2026-03-03 13:43 ` [PATCH v3 3/5] tests/functional/migration: Use the migrate_vms helper Fabiano Rosas
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Fabiano Rosas @ 2026-03-03 13:43 UTC (permalink / raw)
To: qemu-devel; +Cc: adityag, thuth, berrange, peterx
Add a migration helper to MigrationTest that uses the migrate-incoming
QMP commmand and takes the already instantiated VMs. The -incoming
'defer' command line option is preferred way instead of the -incoming
URI syntax that's currently used.
Suggested-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/functional/migration.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tests/functional/migration.py b/tests/functional/migration.py
index 0aa873edba..3362e5c743 100644
--- a/tests/functional/migration.py
+++ b/tests/functional/migration.py
@@ -40,6 +40,11 @@ def assert_migration(self, src_vm, dst_vm):
self.assertEqual(dst_vm.cmd('query-status')['status'], 'running')
self.assertEqual(src_vm.cmd('query-status')['status'],'postmigrate')
+ def migrate_vms(self, dst_uri, src_uri, dst_vm, src_vm):
+ dst_vm.qmp('migrate-incoming', uri=dst_uri)
+ src_vm.qmp('migrate', uri=src_uri)
+ self.assert_migration(src_vm, dst_vm)
+
def do_migrate(self, dest_uri, src_uri=None):
dest_vm = self.get_vm('-incoming', dest_uri, name="dest-qemu")
dest_vm.add_args('-nodefaults')
--
2.51.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH v3 2/5] tests/functional/migration: Add migrate_vms
2026-03-03 13:43 ` [PATCH v3 2/5] tests/functional/migration: Add migrate_vms Fabiano Rosas
@ 2026-03-03 14:14 ` Thomas Huth
0 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2026-03-03 14:14 UTC (permalink / raw)
To: Fabiano Rosas, qemu-devel; +Cc: adityag, berrange, peterx
On 03/03/2026 14.43, Fabiano Rosas wrote:
> Add a migration helper to MigrationTest that uses the migrate-incoming
> QMP commmand and takes the already instantiated VMs. The -incoming
> 'defer' command line option is preferred way instead of the -incoming
> URI syntax that's currently used.
>
> Suggested-by: Peter Xu <peterx@redhat.com>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
> tests/functional/migration.py | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/tests/functional/migration.py b/tests/functional/migration.py
> index 0aa873edba..3362e5c743 100644
> --- a/tests/functional/migration.py
> +++ b/tests/functional/migration.py
> @@ -40,6 +40,11 @@ def assert_migration(self, src_vm, dst_vm):
> self.assertEqual(dst_vm.cmd('query-status')['status'], 'running')
> self.assertEqual(src_vm.cmd('query-status')['status'],'postmigrate')
>
> + def migrate_vms(self, dst_uri, src_uri, dst_vm, src_vm):
> + dst_vm.qmp('migrate-incoming', uri=dst_uri)
> + src_vm.qmp('migrate', uri=src_uri)
> + self.assert_migration(src_vm, dst_vm)
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 3/5] tests/functional/migration: Use the migrate_vms helper
2026-03-03 13:43 [PATCH v3 0/5] tests/functional: Fix ppc64 issue with make -j Fabiano Rosas
2026-03-03 13:43 ` [PATCH v3 1/5] tests/functional/migration: Use socket_dir Fabiano Rosas
2026-03-03 13:43 ` [PATCH v3 2/5] tests/functional/migration: Add migrate_vms Fabiano Rosas
@ 2026-03-03 13:43 ` Fabiano Rosas
2026-03-03 14:20 ` Thomas Huth
2026-03-03 13:43 ` [PATCH v3 4/5] tests/functional/ppc64/pseries: Inherit from MigrationTest Fabiano Rosas
2026-03-03 13:43 ` [PATCH v3 5/5] tests/functional/ppc64/pseries: Remove custom migration routine Fabiano Rosas
4 siblings, 1 reply; 11+ messages in thread
From: Fabiano Rosas @ 2026-03-03 13:43 UTC (permalink / raw)
To: qemu-devel; +Cc: adityag, thuth, berrange, peterx
Change do_migrate() to call the migrate_vms() helper and provide it
with the two VMs already created. Rename do_migrate -> migrate and
adjust the callers.
While here, standardize on the "src" and "dst" names.
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/functional/migration.py | 34 ++++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/tests/functional/migration.py b/tests/functional/migration.py
index 3362e5c743..49347a30bb 100644
--- a/tests/functional/migration.py
+++ b/tests/functional/migration.py
@@ -45,17 +45,19 @@ def migrate_vms(self, dst_uri, src_uri, dst_vm, src_vm):
src_vm.qmp('migrate', uri=src_uri)
self.assert_migration(src_vm, dst_vm)
- def do_migrate(self, dest_uri, src_uri=None):
- dest_vm = self.get_vm('-incoming', dest_uri, name="dest-qemu")
- dest_vm.add_args('-nodefaults')
- dest_vm.launch()
+ def migrate(self, dst_uri, src_uri=None):
+ dst_vm = self.get_vm('-incoming', 'defer', name="dst-qemu")
+ dst_vm.add_args('-nodefaults')
+ dst_vm.launch()
+
+ src_vm = self.get_vm(name="src-qemu")
+ src_vm.add_args('-nodefaults')
+ src_vm.launch()
+
if src_uri is None:
- src_uri = dest_uri
- source_vm = self.get_vm(name="source-qemu")
- source_vm.add_args('-nodefaults')
- source_vm.launch()
- source_vm.qmp('migrate', uri=src_uri)
- self.assert_migration(source_vm, dest_vm)
+ src_uri = dst_uri
+
+ self.migrate_vms(dst_uri, src_uri, dst_vm, src_vm)
def _get_free_port(self, ports):
port = ports.find_free_port()
@@ -65,18 +67,18 @@ def _get_free_port(self, ports):
def migration_with_tcp_localhost(self):
with Ports() as ports:
- dest_uri = 'tcp:localhost:%u' % self._get_free_port(ports)
- self.do_migrate(dest_uri)
+ dst_uri = 'tcp:localhost:%u' % self._get_free_port(ports)
+ self.migrate(dst_uri)
def migration_with_unix(self):
- dest_uri = 'unix:%s/migration.sock' % self.socket_dir().name
- self.do_migrate(dest_uri)
+ dst_uri = 'unix:%s/migration.sock' % self.socket_dir().name
+ self.migrate(dst_uri)
def migration_with_exec(self):
if not which('ncat'):
self.skipTest('ncat is not available')
with Ports() as ports:
free_port = self._get_free_port(ports)
- dest_uri = 'exec:ncat -l localhost %u' % free_port
+ dst_uri = 'exec:ncat -l localhost %u' % free_port
src_uri = 'exec:ncat localhost %u' % free_port
- self.do_migrate(dest_uri, src_uri)
+ self.migrate(dst_uri, src_uri)
--
2.51.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v3 4/5] tests/functional/ppc64/pseries: Inherit from MigrationTest
2026-03-03 13:43 [PATCH v3 0/5] tests/functional: Fix ppc64 issue with make -j Fabiano Rosas
` (2 preceding siblings ...)
2026-03-03 13:43 ` [PATCH v3 3/5] tests/functional/migration: Use the migrate_vms helper Fabiano Rosas
@ 2026-03-03 13:43 ` Fabiano Rosas
2026-03-03 14:38 ` Thomas Huth
2026-03-03 13:43 ` [PATCH v3 5/5] tests/functional/ppc64/pseries: Remove custom migration routine Fabiano Rosas
4 siblings, 1 reply; 11+ messages in thread
From: Fabiano Rosas @ 2026-03-03 13:43 UTC (permalink / raw)
To: qemu-devel
Cc: adityag, thuth, berrange, peterx, Nicholas Piggin,
Harsh Prateek Bora
Make the PseriesMachine class inherit from MigrationTest so the next
patch can access migration routines without needing to instantiate a
MigrationTest object. This is just for cleanliness of the code.
Note that creating a separate class for migration wouldn't work quite
well because the class attributes of PseriesMachine would then have to
be exposed to that class somehow.
Suggested-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/functional/ppc64/test_pseries.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/functional/ppc64/test_pseries.py b/tests/functional/ppc64/test_pseries.py
index b45763c305..ce39e16a22 100755
--- a/tests/functional/ppc64/test_pseries.py
+++ b/tests/functional/ppc64/test_pseries.py
@@ -11,7 +11,7 @@
from qemu_test import wait_for_console_pattern
from test_migration import PpcMigrationTest
-class PseriesMachine(QemuSystemTest):
+class PseriesMachine(MigrationTest):
timeout = 90
KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
@@ -116,11 +116,11 @@ def test_ppc64_linux_migration(self):
wait_for_console_pattern(self, console_pattern, self.panic_message,
vm=source_vm)
- PpcMigrationTest().do_migrate_ppc64_linux(source_vm, dest_vm);
+ self.do_migrate_ppc64_linux(source_vm, dest_vm);
# ensure the boot proceeds after migration
wait_for_console_pattern(self, self.good_message, self.panic_message,
vm=dest_vm)
if __name__ == '__main__':
- QemuSystemTest.main()
+ MigrationTest.main()
--
2.51.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH v3 4/5] tests/functional/ppc64/pseries: Inherit from MigrationTest
2026-03-03 13:43 ` [PATCH v3 4/5] tests/functional/ppc64/pseries: Inherit from MigrationTest Fabiano Rosas
@ 2026-03-03 14:38 ` Thomas Huth
2026-03-03 15:46 ` Fabiano Rosas
0 siblings, 1 reply; 11+ messages in thread
From: Thomas Huth @ 2026-03-03 14:38 UTC (permalink / raw)
To: Fabiano Rosas, qemu-devel
Cc: adityag, berrange, peterx, Nicholas Piggin, Harsh Prateek Bora
On 03/03/2026 14.43, Fabiano Rosas wrote:
> Make the PseriesMachine class inherit from MigrationTest so the next
> patch can access migration routines without needing to instantiate a
> MigrationTest object. This is just for cleanliness of the code.
>
> Note that creating a separate class for migration wouldn't work quite
> well because the class attributes of PseriesMachine would then have to
> be exposed to that class somehow.
>
> Suggested-by: Peter Xu <peterx@redhat.com>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
> tests/functional/ppc64/test_pseries.py | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tests/functional/ppc64/test_pseries.py b/tests/functional/ppc64/test_pseries.py
> index b45763c305..ce39e16a22 100755
> --- a/tests/functional/ppc64/test_pseries.py
> +++ b/tests/functional/ppc64/test_pseries.py
> @@ -11,7 +11,7 @@
> from qemu_test import wait_for_console_pattern
> from test_migration import PpcMigrationTest
>
> -class PseriesMachine(QemuSystemTest):
> +class PseriesMachine(MigrationTest):
This patch does not work (without the following one). You only import
PpcMigrationTest, but not MigrationTest, so inheriting from MigrationTest is
not possible here...
> timeout = 90
> KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
> @@ -116,11 +116,11 @@ def test_ppc64_linux_migration(self):
> wait_for_console_pattern(self, console_pattern, self.panic_message,
> vm=source_vm)
>
> - PpcMigrationTest().do_migrate_ppc64_linux(source_vm, dest_vm);
> + self.do_migrate_ppc64_linux(source_vm, dest_vm);
... and do_migrate_ppc64_linux is also not a method of MigrationTest.
Easiest fix: Squash this patch with the next one. Otherwise you have to take
the detour through inheriting from PpcMigrationTest here.
Thomas
> # ensure the boot proceeds after migration
> wait_for_console_pattern(self, self.good_message, self.panic_message,
> vm=dest_vm)
>
> if __name__ == '__main__':
> - QemuSystemTest.main()
> + MigrationTest.main()
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 4/5] tests/functional/ppc64/pseries: Inherit from MigrationTest
2026-03-03 14:38 ` Thomas Huth
@ 2026-03-03 15:46 ` Fabiano Rosas
0 siblings, 0 replies; 11+ messages in thread
From: Fabiano Rosas @ 2026-03-03 15:46 UTC (permalink / raw)
To: Thomas Huth, qemu-devel
Cc: adityag, berrange, peterx, Nicholas Piggin, Harsh Prateek Bora
Thomas Huth <thuth@redhat.com> writes:
> On 03/03/2026 14.43, Fabiano Rosas wrote:
>> Make the PseriesMachine class inherit from MigrationTest so the next
>> patch can access migration routines without needing to instantiate a
>> MigrationTest object. This is just for cleanliness of the code.
>>
>> Note that creating a separate class for migration wouldn't work quite
>> well because the class attributes of PseriesMachine would then have to
>> be exposed to that class somehow.
>>
>> Suggested-by: Peter Xu <peterx@redhat.com>
>> Signed-off-by: Fabiano Rosas <farosas@suse.de>
>> ---
>> tests/functional/ppc64/test_pseries.py | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/tests/functional/ppc64/test_pseries.py b/tests/functional/ppc64/test_pseries.py
>> index b45763c305..ce39e16a22 100755
>> --- a/tests/functional/ppc64/test_pseries.py
>> +++ b/tests/functional/ppc64/test_pseries.py
>> @@ -11,7 +11,7 @@
>> from qemu_test import wait_for_console_pattern
>> from test_migration import PpcMigrationTest
>>
>> -class PseriesMachine(QemuSystemTest):
>> +class PseriesMachine(MigrationTest):
>
> This patch does not work (without the following one). You only import
> PpcMigrationTest, but not MigrationTest, so inheriting from MigrationTest is
> not possible here...
>
Ouch, sorry. I'll repost.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 5/5] tests/functional/ppc64/pseries: Remove custom migration routine
2026-03-03 13:43 [PATCH v3 0/5] tests/functional: Fix ppc64 issue with make -j Fabiano Rosas
` (3 preceding siblings ...)
2026-03-03 13:43 ` [PATCH v3 4/5] tests/functional/ppc64/pseries: Inherit from MigrationTest Fabiano Rosas
@ 2026-03-03 13:43 ` Fabiano Rosas
2026-03-03 14:40 ` Thomas Huth
4 siblings, 1 reply; 11+ messages in thread
From: Fabiano Rosas @ 2026-03-03 13:43 UTC (permalink / raw)
To: qemu-devel
Cc: adityag, thuth, berrange, peterx, Nicholas Piggin,
Harsh Prateek Bora
Don't implement a custom migration routine at PpcMigrationTest and
instead reuse the generic one from MigrationTest.
This removes the dependency of PpcMigrationTest from
PseriesMachine. Having one test import another causes unittest code to
instantiate the imported test, resulting in the setup and teardown
methods being invoked for the imported test class, even if no test
from that class will be executed.
If run in parallel, the extra setup/teardown methods that result from
importing can race with the ones from the actual test being executed
and cause the following error:
File "<SRC_DIR>/tests/functional/qemu_test/testcase.py", line 238, in tearDown
shutil.rmtree(self.workdir)
...
FileNotFoundError: [Errno 2] No such file or directory:
'<SRC_DIR>/build/tests/functional/ppc64/.../test_migration_with_exec/scratch'
Fixes: f4e34d0fd5 ("tests/functional: Add a OS level migration test for pseries")
Reported-by: Aditya Gupta <adityag@linux.ibm.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/functional/migration.py | 5 +++++
tests/functional/ppc64/test_migration.py | 11 -----------
tests/functional/ppc64/test_pseries.py | 4 ++--
3 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/tests/functional/migration.py b/tests/functional/migration.py
index 49347a30bb..e995328e83 100644
--- a/tests/functional/migration.py
+++ b/tests/functional/migration.py
@@ -65,6 +65,11 @@ def _get_free_port(self, ports):
self.skipTest('Failed to find a free port')
return port
+ def migration_with_tcp_localhost_vms(self, dst_vm, src_vm):
+ with Ports() as ports:
+ uri = 'tcp:localhost:%u' % self._get_free_port(ports)
+ self.migrate_vms(uri, uri, dst_vm, src_vm)
+
def migration_with_tcp_localhost(self):
with Ports() as ports:
dst_uri = 'tcp:localhost:%u' % self._get_free_port(ports)
diff --git a/tests/functional/ppc64/test_migration.py b/tests/functional/ppc64/test_migration.py
index a3b819680b..7d49ee175b 100755
--- a/tests/functional/ppc64/test_migration.py
+++ b/tests/functional/ppc64/test_migration.py
@@ -22,17 +22,6 @@ def test_migration_with_exec(self):
self.set_machine('mac99')
self.migration_with_exec()
- def do_migrate_ppc64_linux(self, source_vm, dest_vm):
- with Ports() as ports:
- port = ports.find_free_port()
- if port is None:
- self.skipTest('Failed to find a free port')
- uri = 'tcp:localhost:%u' % port
-
- dest_vm.qmp('migrate-incoming', uri=uri)
- source_vm.qmp('migrate', uri=uri)
- self.assert_migration(source_vm, dest_vm)
-
if __name__ == '__main__':
MigrationTest.main()
diff --git a/tests/functional/ppc64/test_pseries.py b/tests/functional/ppc64/test_pseries.py
index ce39e16a22..7373ca1647 100755
--- a/tests/functional/ppc64/test_pseries.py
+++ b/tests/functional/ppc64/test_pseries.py
@@ -9,7 +9,7 @@
from qemu_test import QemuSystemTest, Asset
from qemu_test import wait_for_console_pattern
-from test_migration import PpcMigrationTest
+from migration import MigrationTest
class PseriesMachine(MigrationTest):
@@ -116,7 +116,7 @@ def test_ppc64_linux_migration(self):
wait_for_console_pattern(self, console_pattern, self.panic_message,
vm=source_vm)
- self.do_migrate_ppc64_linux(source_vm, dest_vm);
+ self.migration_with_tcp_localhost_vms(dest_vm, source_vm);
# ensure the boot proceeds after migration
wait_for_console_pattern(self, self.good_message, self.panic_message,
--
2.51.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH v3 5/5] tests/functional/ppc64/pseries: Remove custom migration routine
2026-03-03 13:43 ` [PATCH v3 5/5] tests/functional/ppc64/pseries: Remove custom migration routine Fabiano Rosas
@ 2026-03-03 14:40 ` Thomas Huth
0 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2026-03-03 14:40 UTC (permalink / raw)
To: Fabiano Rosas, qemu-devel
Cc: adityag, berrange, peterx, Nicholas Piggin, Harsh Prateek Bora
On 03/03/2026 14.43, Fabiano Rosas wrote:
> Don't implement a custom migration routine at PpcMigrationTest and
> instead reuse the generic one from MigrationTest.
>
> This removes the dependency of PpcMigrationTest from
> PseriesMachine. Having one test import another causes unittest code to
> instantiate the imported test, resulting in the setup and teardown
> methods being invoked for the imported test class, even if no test
> from that class will be executed.
>
> If run in parallel, the extra setup/teardown methods that result from
> importing can race with the ones from the actual test being executed
> and cause the following error:
>
> File "<SRC_DIR>/tests/functional/qemu_test/testcase.py", line 238, in tearDown
> shutil.rmtree(self.workdir)
> ...
> FileNotFoundError: [Errno 2] No such file or directory:
> '<SRC_DIR>/build/tests/functional/ppc64/.../test_migration_with_exec/scratch'
>
> Fixes: f4e34d0fd5 ("tests/functional: Add a OS level migration test for pseries")
> Reported-by: Aditya Gupta <adityag@linux.ibm.com>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
> tests/functional/migration.py | 5 +++++
> tests/functional/ppc64/test_migration.py | 11 -----------
> tests/functional/ppc64/test_pseries.py | 4 ++--
> 3 files changed, 7 insertions(+), 13 deletions(-)
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 11+ messages in thread