[PATCH v2 2/2] tests/functional: Add a OS level migration test for pseries

Fabiano Rosas posted 2 patches 1 month, 3 weeks ago
Maintainers: Nicholas Piggin <npiggin@gmail.com>, Harsh Prateek Bora <harshpb@linux.ibm.com>, Chinmay Rath <rathc@linux.ibm.com>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>
There is a newer version of this series
[PATCH v2 2/2] tests/functional: Add a OS level migration test for pseries
Posted by Fabiano Rosas 1 month, 3 weeks ago
There's currently no OS level test for ppc64le. Add one such test by
reusing the boot level tests that are already present.

The test boots the source machine, waits for it to reach a mid-boot
message, migrates and checks that the destination has reached the
final boot message (VFS error due to no disk).

Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/functional/ppc64/test_migration.py | 12 ++++++++
 tests/functional/ppc64/test_pseries.py   | 35 ++++++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/tests/functional/ppc64/test_migration.py b/tests/functional/ppc64/test_migration.py
index 5dfdaaf709..a3b819680b 100755
--- a/tests/functional/ppc64/test_migration.py
+++ b/tests/functional/ppc64/test_migration.py
@@ -4,6 +4,7 @@
 #
 # ppc migration test
 
+from qemu_test.ports import Ports
 from migration import MigrationTest
 
 
@@ -21,6 +22,17 @@ 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 7840c4e3ff..e15a8956a5 100755
--- a/tests/functional/ppc64/test_pseries.py
+++ b/tests/functional/ppc64/test_pseries.py
@@ -9,6 +9,7 @@
 
 from qemu_test import QemuSystemTest, Asset
 from qemu_test import wait_for_console_pattern
+from test_migration import PpcMigrationTest
 
 class PseriesMachine(QemuSystemTest):
 
@@ -87,5 +88,39 @@ def test_ppc64_linux_big_boot(self):
         wait_for_console_pattern(self, console_pattern, self.panic_message)
         wait_for_console_pattern(self, self.good_message, self.panic_message)
 
+    def test_ppc64_linux_migration(self):
+        kernel_path = self.ASSET_KERNEL.fetch()
+        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
+
+        self.set_machine('pseries')
+
+        dest_vm = self.get_vm(name="dest-qemu")
+        dest_vm.add_args('-incoming', 'defer')
+        dest_vm.add_args('-smp', '4')
+        dest_vm.add_args('-nodefaults')
+        dest_vm.add_args('-kernel', kernel_path,
+                         '-append', kernel_command_line)
+        dest_vm.set_console()
+        dest_vm.launch()
+
+        source_vm = self.get_vm(name="source-qemu")
+        source_vm.add_args('-smp', '4')
+        source_vm.add_args('-nodefaults')
+        source_vm.add_args('-kernel', kernel_path,
+                           '-append', kernel_command_line)
+        source_vm.set_console()
+        source_vm.launch()
+
+        # ensure the boot has reached Linux
+        console_pattern = 'smp: Brought up 1 node, 4 CPUs'
+        wait_for_console_pattern(self, console_pattern, self.panic_message,
+                                 vm=source_vm)
+
+        PpcMigrationTest().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()
-- 
2.51.0
Re: [PATCH v2 2/2] tests/functional: Add a OS level migration test for pseries
Posted by Thomas Huth 1 month ago
On 17/12/2025 17.45, Fabiano Rosas wrote:
> There's currently no OS level test for ppc64le. Add one such test by
> reusing the boot level tests that are already present.
> 
> The test boots the source machine, waits for it to reach a mid-boot
> message, migrates and checks that the destination has reached the
> final boot message (VFS error due to no disk).
> 
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>   tests/functional/ppc64/test_migration.py | 12 ++++++++
>   tests/functional/ppc64/test_pseries.py   | 35 ++++++++++++++++++++++++
>   2 files changed, 47 insertions(+)
> 
> diff --git a/tests/functional/ppc64/test_migration.py b/tests/functional/ppc64/test_migration.py
> index 5dfdaaf709..a3b819680b 100755
> --- a/tests/functional/ppc64/test_migration.py
> +++ b/tests/functional/ppc64/test_migration.py
> @@ -4,6 +4,7 @@
>   #
>   # ppc migration test
>   
> +from qemu_test.ports import Ports
>   from migration import MigrationTest
>   
>   
> @@ -21,6 +22,17 @@ 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 7840c4e3ff..e15a8956a5 100755
> --- a/tests/functional/ppc64/test_pseries.py
> +++ b/tests/functional/ppc64/test_pseries.py
> @@ -9,6 +9,7 @@
>   
>   from qemu_test import QemuSystemTest, Asset
>   from qemu_test import wait_for_console_pattern
> +from test_migration import PpcMigrationTest
>   
>   class PseriesMachine(QemuSystemTest):
>   
> @@ -87,5 +88,39 @@ def test_ppc64_linux_big_boot(self):
>           wait_for_console_pattern(self, console_pattern, self.panic_message)
>           wait_for_console_pattern(self, self.good_message, self.panic_message)
>   
> +    def test_ppc64_linux_migration(self):
> +        kernel_path = self.ASSET_KERNEL.fetch()
> +        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
> +
> +        self.set_machine('pseries')

It's slightly better to do set_machine() first, before the ASSET_* lines, so 
that the test is skipped without fetching the assets in case the pseries 
machine is not available.

With that nit fixed:
Reviewed-by: Thomas Huth <thuth@redhat.com>


> +        dest_vm = self.get_vm(name="dest-qemu")
> +        dest_vm.add_args('-incoming', 'defer')
> +        dest_vm.add_args('-smp', '4')
> +        dest_vm.add_args('-nodefaults')
> +        dest_vm.add_args('-kernel', kernel_path,
> +                         '-append', kernel_command_line)
> +        dest_vm.set_console()
> +        dest_vm.launch()
> +
> +        source_vm = self.get_vm(name="source-qemu")
> +        source_vm.add_args('-smp', '4')
> +        source_vm.add_args('-nodefaults')
> +        source_vm.add_args('-kernel', kernel_path,
> +                           '-append', kernel_command_line)
> +        source_vm.set_console()
> +        source_vm.launch()
> +
> +        # ensure the boot has reached Linux
> +        console_pattern = 'smp: Brought up 1 node, 4 CPUs'
> +        wait_for_console_pattern(self, console_pattern, self.panic_message,
> +                                 vm=source_vm)
> +
> +        PpcMigrationTest().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()