Skip to contentSkip to conversation

tests/functional/ppc64: extend ppc64 functional tests

PATCH Superseded Aniket Sahu 3 participants 11 messages Sep 16 – Sep 21 PowerPC

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#1 lore raw

PATCH v2 1/2 tests/functional/ppc64: extend pseries migration tests

In reply to Aniket Sahu

Made a few changes to test_pseries.py to extend the migration tests to validate exec (socat) and UNIX paths.

- Refactored test_ppc64_linux_migration to a private method _do_linux_migration(dst_uri, src_uri=None).
- It is then called by three separate methods which exercise the TCP, UNIX and exec paths via the migrate_vms method from MigrationTest.

---
 tests/functional/ppc64/test_pseries.py | 41 ++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 5 deletions(-)
tests/functional/ppc64/test_pseries.py +36 -5
index cb6d25dc81..19f31141b1 100755
@@ -8,8 +8,9 @@
 # later.  See the COPYING file in the top-level directory.
 
 from qemu_test import Asset
-from qemu_test import wait_for_console_pattern
+from qemu_test import wait_for_console_pattern, which
 from migration import MigrationTest
+from qemu_test.ports import Ports
 
 class PseriesMachine(MigrationTest):
 
@@ -88,12 +89,20 @@ 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):
+    def _do_linux_migration(self, dst_uri, src_uri=None):
+        """
+        Boot a pseries kernel on a source VM, wait until Linux is up, then
+        migrate to a destination VM over the given URI(s) and verify the boot
+        continues on the destination.
+        """
         self.set_machine('pseries')
 
         kernel_path = self.ASSET_KERNEL.fetch()
         kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
 
+        if src_uri is None:
+            src_uri = dst_uri
+
         dest_vm = self.get_vm(name="dest-qemu")
         dest_vm.add_args('-incoming', 'defer')
         dest_vm.add_args('-smp', '4')
@@ -111,16 +120,38 @@ def test_ppc64_linux_migration(self):
         source_vm.set_console()
         source_vm.launch()
 
-        # ensure the boot has reached Linux
+        # ensure the boot has reached Linux before migrating
         console_pattern = 'smp: Brought up 1 node, 4 CPUs'
         wait_for_console_pattern(self, console_pattern, self.panic_message,
                                  vm=source_vm)
 
-        self.migration_with_tcp_localhost_vms(dest_vm, source_vm)
+        self.migrate_vms(dst_uri, src_uri, dest_vm, source_vm)
 
-        # ensure the boot proceeds after migration
+        # ensure the boot continues on the destination after migration
         wait_for_console_pattern(self, self.good_message, self.panic_message,
                                  vm=dest_vm)
 
+    def test_ppc64_linux_migration(self):
+        with Ports() as ports:
+            port = ports.find_free_port()
+            if port is None:
+                self.skipTest('Failed to find a free port')
+            self._do_linux_migration('tcp:localhost:%u' % port)
+
+    def test_ppc64_linux_migration_unix(self):
+        self._do_linux_migration(
+            'unix:%s/migration.sock' % self.socket_dir().name)
+
+    def test_ppc64_linux_migration_exec(self):
+        if not which('socat'):
+            self.skipTest('socat is not available')
+        with Ports() as ports:
+            port = ports.find_free_port()
+            if port is None:
+                self.skipTest('Failed to find a free port')
+            self._do_linux_migration(
+                'exec:socat TCP-LISTEN:%u -' % port,
+                'exec:socat - TCP:localhost:%u,forever' % port)
+
 if __name__ == '__main__':
     MigrationTest.main()
Signature · 1 line
2.52.0
#0 lore raw

v2 cover tests/functional/ppc64: extend ppc64 functional tests

Patch 1 extends pseries migration coverage by refactoring the existing test_ppc64_linux_migration into a shared helper and adding two new tests for the UNIX socket and exec (socat) transport paths, which were previously untested for pseries. Referred to the mac99 migration tests for the same.

Patch 2 adds explicit console checks for NVMe, e1000e, and xHCI driver probe messages in do_test_ppc64_powernv(). These are emitted synchronously during PCI enumeration, after OPAL hands off to Linux, making them safe to check without a separate test file.

Aniket Sahu (2):
tests/functional/ppc64: extend pseries migration tests tests/functional/ppc64: extend ppc64 powernv net device tests

 tests/functional/ppc64/test_powernv.py |  7 +++--
 tests/functional/ppc64/test_pseries.py | 41 ++++++++++++++++++++++----
 2 files changed, 41 insertions(+), 7 deletions(-)

---
Changes in v2:
- Patch 1: Dropped test_pseries_migrate.py; UNIX and exec transport tests are now full-boot tests in test_pseries.py alongside the existing TCP test. (Review comments by Thomas Huth)
- Patch 2: Dropped test_powernv_devices.py; PCIe device checks are folded into the existing do_test_ppc64_powernv() helper instead. (Review comments by Thomas Huth)

v1: https://lore.kernel.org/qemu-devel/[email protected]/

Signature · 1 line
2.52.0
#8 lore raw

PATCH v2 2/2 tests/functional/ppc64: extend ppc64 powernv net device tests

Added console checks as the probe log lines will appear before the S14Silence-console init scripts.

---
 tests/functional/ppc64/test_powernv.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tests/functional/ppc64/test_powernv.py +5 -2
index f3e05e4d38..200fd2c894 100755
@@ -201,9 +201,12 @@ def do_test_ppc64_powernv(self, proc):
 
         self.wait_for_console_pattern("CPU: " + proc + " generation processor")
         self.wait_for_console_pattern("INIT: Starting kernel at ")
+        # NVMe, e1000e, and xHCI are probed synchronously by the kernel
+        # during PCI enumeration, after OPAL hands off to Linux.
+        self.wait_for_console_pattern("nvme nvme0")
+        self.wait_for_console_pattern("e1000e")
+        self.wait_for_console_pattern("xhci_hcd")
         self.wait_for_console_pattern("Run /sbin/init as init process")
-        # Device detection output driven by udev probing is sometimes cut off
-        # from console output, suspect S14silence-console init script.
 
     def test_ppc64_powernv_external_dtb(self):
         self.set_machine('powernv11')
Signature · 1 line
2.52.0
#2 lore raw

Re: [PATCH v2 1/2] tests/functional/ppc64: extend pseries migration tests

In reply to Aniket Sahu
Quoted 78 lines · Aniket Sahu

Made a few changes to test_pseries.py to extend the migration tests to validate exec (socat) and UNIX paths.

- Refactored test_ppc64_linux_migration to a private method _do_linux_migration(dst_uri, src_uri=None).
- It is then called by three separate methods which exercise the TCP, UNIX and exec paths via the migrate_vms method from MigrationTest.

---
  tests/functional/ppc64/test_pseries.py | 41 ++++++++++++++++++++++----
  1 file changed, 36 insertions(+), 5 deletions(-)
tests/functional/ppc64/test_pseries.py +25 -5
index cb6d25dc81..19f31141b1 100755
@@ -8,8 +8,9 @@
  # later.  See the COPYING file in the top-level directory.
 
  from qemu_test import Asset
-from qemu_test import wait_for_console_pattern
+from qemu_test import wait_for_console_pattern, which
  from migration import MigrationTest
+from qemu_test.ports import Ports
 
  class PseriesMachine(MigrationTest):
 
@@ -88,12 +89,20 @@ 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):
+    def _do_linux_migration(self, dst_uri, src_uri=None):
+        """
+        Boot a pseries kernel on a source VM, wait until Linux is up, then
+        migrate to a destination VM over the given URI(s) and verify the boot
+        continues on the destination.
+        """
          self.set_machine('pseries')
 
          kernel_path = self.ASSET_KERNEL.fetch()
          kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
 
+        if src_uri is None:
+            src_uri = dst_uri
+
          dest_vm = self.get_vm(name="dest-qemu")
          dest_vm.add_args('-incoming', 'defer')
          dest_vm.add_args('-smp', '4')
@@ -111,16 +120,38 @@ def test_ppc64_linux_migration(self):
          source_vm.set_console()
          source_vm.launch()
 
-        # ensure the boot has reached Linux
+        # ensure the boot has reached Linux before migrating
          console_pattern = 'smp: Brought up 1 node, 4 CPUs'
          wait_for_console_pattern(self, console_pattern, self.panic_message,
                                   vm=source_vm)
 
-        self.migration_with_tcp_localhost_vms(dest_vm, source_vm)
+        self.migrate_vms(dst_uri, src_uri, dest_vm, source_vm)
 
-        # ensure the boot proceeds after migration
+        # ensure the boot continues on the destination after migration
          wait_for_console_pattern(self, self.good_message, self.panic_message,
                                   vm=dest_vm)
 
+    def test_ppc64_linux_migration(self):
+        with Ports() as ports:
+            port = ports.find_free_port()
+            if port is None:
+                self.skipTest('Failed to find a free port')
+            self._do_linux_migration('tcp:localhost:%u' % port)
+
+    def test_ppc64_linux_migration_unix(self):
+        self._do_linux_migration(
+            'unix:%s/migration.sock' % self.socket_dir().name)
+

tests/functional/ppc64/test_pseries.py def test_ppc64_linux_migration(self): · line 154

Quoted 10 lines
tests/functional/ppc64/test_pseries.py +10 -0
+    def test_ppc64_linux_migration_exec(self):
+        if not which('socat'):
+            self.skipTest('socat is not available')
+        with Ports() as ports:
+            port = ports.find_free_port()
+            if port is None:
+                self.skipTest('Failed to find a free port')
+            self._do_linux_migration(
+                'exec:socat TCP-LISTEN:%u -' % port,
+                'exec:socat - TCP:localhost:%u,forever' % port)

Hi!

I'm really not sure whether this change is really justifiable: Linux is now booted three times, which will take a lot of additional time during testing. And that's just for exercising two additional migration channels which should be orthogonal to what happens in the guest? ... and we test those channels in other tests already ... sounds like too much wasted testing time for little gain to me.

Since our CI testing time is not unlimited, I'd prefer to rather drop this patch. Or if you really really think we get a lot more test coverage by exercising more migration channels here, then test the additional channels with migrating a guest that sits at the firmware prompt only, like you did in v1 of your patch set. But still, please also add some proper justification to the patch description why this is necessary from a test coverage point of view.

Thanks,
Thomas

Reviewed-by on v2 2/2
#9 lore raw

Re: [PATCH v2 2/2] tests/functional/ppc64: extend ppc64 powernv net device tests

In reply to Aniket Sahu
Quoted 15 lines · Aniket Sahu

Added console checks as the probe log lines will appear before the S14Silence-console init scripts.

---
  tests/functional/ppc64/test_powernv.py | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)
tests/functional/ppc64/test_powernv.py +1 -0
index f3e05e4d38..200fd2c894 100755
@@ -201,9 +201,12 @@ def do_test_ppc64_powernv(self, proc):
 
          self.wait_for_console_pattern("CPU: " + proc + " generation processor")
          self.wait_for_console_pattern("INIT: Starting kernel at ")
+        # NVMe, e1000e, and xHCI are probed synchronously by the kernel

tests/functional/ppc64/test_powernv.py def do_test_ppc64_powernv(self, proc): · line 212

Quoted 10 lines
tests/functional/ppc64/test_powernv.py +4 -2
+        # during PCI enumeration, after OPAL hands off to Linux.
+        self.wait_for_console_pattern("nvme nvme0")
+        self.wait_for_console_pattern("e1000e")
+        self.wait_for_console_pattern("xhci_hcd")
          self.wait_for_console_pattern("Run /sbin/init as init process")
-        # Device detection output driven by udev probing is sometimes cut off
-        # from console output, suspect S14silence-console init script.
 
      def test_ppc64_powernv_external_dtb(self):
          self.set_machine('powernv11')
#3 lore raw

Re: [PATCH v2 1/2] tests/functional/ppc64: extend pseries migration tests

In reply to Aniket Sahu

Hi Aniket,

Thanks for the patches. Please find my comments inline below.

Quoted 35 lines · Aniket Sahu

Made a few changes to test_pseries.py to extend the migration tests to validate exec (socat) and UNIX paths.

- Refactored test_ppc64_linux_migration to a private method _do_linux_migration(dst_uri, src_uri=None).
- It is then called by three separate methods which exercise the TCP, UNIX and exec paths via the migrate_vms method from MigrationTest.

---
 tests/functional/ppc64/test_pseries.py | 41 ++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 5 deletions(-)
tests/functional/ppc64/test_pseries.py +5 -2
index cb6d25dc81..19f31141b1 100755
@@ -8,8 +8,9 @@
 # later.  See the COPYING file in the top-level directory.
 
 from qemu_test import Asset
-from qemu_test import wait_for_console_pattern
+from qemu_test import wait_for_console_pattern, which
 from migration import MigrationTest
+from qemu_test.ports import Ports
 
 class PseriesMachine(MigrationTest):
 
@@ -88,12 +89,20 @@ 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):
+    def _do_linux_migration(self, dst_uri, src_uri=None):
+        """
+        Boot a pseries kernel on a source VM, wait until Linux is up, then

tests/functional/ppc64/test_pseries.py def test_ppc64_linux_big_boot(self): · line 104

Quoted 10 lines
tests/functional/ppc64/test_pseries.py +5 -0
+        migrate to a destination VM over the given URI(s) and verify the boot
+        continues on the destination.
+        """
         self.set_machine('pseries')
 
         kernel_path = self.ASSET_KERNEL.fetch()
         kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
 
+        if src_uri is None:
+            src_uri = dst_uri

The default behavior of src_uri=None is non-obvious from the docstring. Could you mention that it defaults to dst_uri, and that callers using transports with different source and destination URIs (such as the exec: case below) need to provide src_uri explicitly?

Quoted 33 lines
tests/functional/ppc64/test_pseries.py +15 -3
+
         dest_vm = self.get_vm(name="dest-qemu")
         dest_vm.add_args('-incoming', 'defer')
         dest_vm.add_args('-smp', '4')
@@ -111,16 +120,38 @@ def test_ppc64_linux_migration(self):
         source_vm.set_console()
         source_vm.launch()
 
-        # ensure the boot has reached Linux
+        # ensure the boot has reached Linux before migrating
         console_pattern = 'smp: Brought up 1 node, 4 CPUs'
         wait_for_console_pattern(self, console_pattern, self.panic_message,
                                  vm=source_vm)
 
-        self.migration_with_tcp_localhost_vms(dest_vm, source_vm)
+        self.migrate_vms(dst_uri, src_uri, dest_vm, source_vm)
 
-        # ensure the boot proceeds after migration
+        # ensure the boot continues on the destination after migration
         wait_for_console_pattern(self, self.good_message, self.panic_message,
                                  vm=dest_vm)
 
+    def test_ppc64_linux_migration(self):
+        with Ports() as ports:
+            port = ports.find_free_port()
+            if port is None:
+                self.skipTest('Failed to find a free port')
+            self._do_linux_migration('tcp:localhost:%u' % port)
+
+    def test_ppc64_linux_migration_unix(self):
+        self._do_linux_migration(
+            'unix:%s/migration.sock' % self.socket_dir().name)
+

tests/functional/ppc64/test_pseries.py def test_ppc64_linux_migration(self): · line 154

Quoted 10 lines
tests/functional/ppc64/test_pseries.py +10 -0
+    def test_ppc64_linux_migration_exec(self):
+        if not which('socat'):
+            self.skipTest('socat is not available')
+        with Ports() as ports:
+            port = ports.find_free_port()
+            if port is None:
+                self.skipTest('Failed to find a free port')
+            self._do_linux_migration(
+                'exec:socat TCP-LISTEN:%u -' % port,
+                'exec:socat - TCP:localhost:%u,forever' % port)

I share Thomas's concern about CI cost. With this patch, Linux is fully booted three times — once per transport variant — which significantly increases the wall-clock time of the pseries migration test slot.

The UNIX and exec transport paths are already covered on ppc64 in tests/functional/ppc64/test_migration.py, though against mac99 rather than pseries. If the intent is specifically to validate these transports on the pseries machine, that is a reasonable goal — but does it require a full Linux boot? The transport layer is independent of what the guest is running. A firmware-only pseries migration (as was done in v1) would cover the pseries-specific migration path with substantially lower CI cost.

Please clarify in the commit message why a full Linux boot is needed here, or consider using a firmware-only guest for the two new tests.

Thanks,
Amit

#7 lore raw

Re: [PATCH v2 1/2] tests/functional/ppc64: extend pseries migration tests

In reply to Aniket Sahu
Quoted 8 lines · Aniket Sahu

Made a few changes to test_pseries.py to extend the migration tests to validate exec (socat) and UNIX paths.

- Refactored test_ppc64_linux_migration to a private method _do_linux_migration(dst_uri, src_uri=None).
- It is then called by three separate methods which exercise the TCP, UNIX and exec paths via the migrate_vms method from MigrationTest.

Also noticed: the patch is missing a Signed-off-by tag. Please add it.

Quoted 87 lines
---
 tests/functional/ppc64/test_pseries.py | 41 ++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 5 deletions(-)
tests/functional/ppc64/test_pseries.py +36 -5
index cb6d25dc81..19f31141b1 100755
@@ -8,8 +8,9 @@
 # later.  See the COPYING file in the top-level directory.
 
 from qemu_test import Asset
-from qemu_test import wait_for_console_pattern
+from qemu_test import wait_for_console_pattern, which
 from migration import MigrationTest
+from qemu_test.ports import Ports
 
 class PseriesMachine(MigrationTest):
 
@@ -88,12 +89,20 @@ 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):
+    def _do_linux_migration(self, dst_uri, src_uri=None):
+        """
+        Boot a pseries kernel on a source VM, wait until Linux is up, then
+        migrate to a destination VM over the given URI(s) and verify the boot
+        continues on the destination.
+        """
         self.set_machine('pseries')
 
         kernel_path = self.ASSET_KERNEL.fetch()
         kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
 
+        if src_uri is None:
+            src_uri = dst_uri
+
         dest_vm = self.get_vm(name="dest-qemu")
         dest_vm.add_args('-incoming', 'defer')
         dest_vm.add_args('-smp', '4')
@@ -111,16 +120,38 @@ def test_ppc64_linux_migration(self):
         source_vm.set_console()
         source_vm.launch()
 
-        # ensure the boot has reached Linux
+        # ensure the boot has reached Linux before migrating
         console_pattern = 'smp: Brought up 1 node, 4 CPUs'
         wait_for_console_pattern(self, console_pattern, self.panic_message,
                                  vm=source_vm)
 
-        self.migration_with_tcp_localhost_vms(dest_vm, source_vm)
+        self.migrate_vms(dst_uri, src_uri, dest_vm, source_vm)
 
-        # ensure the boot proceeds after migration
+        # ensure the boot continues on the destination after migration
         wait_for_console_pattern(self, self.good_message, self.panic_message,
                                  vm=dest_vm)
 
+    def test_ppc64_linux_migration(self):
+        with Ports() as ports:
+            port = ports.find_free_port()
+            if port is None:
+                self.skipTest('Failed to find a free port')
+            self._do_linux_migration('tcp:localhost:%u' % port)
+
+    def test_ppc64_linux_migration_unix(self):
+        self._do_linux_migration(
+            'unix:%s/migration.sock' % self.socket_dir().name)
+
+    def test_ppc64_linux_migration_exec(self):
+        if not which('socat'):
+            self.skipTest('socat is not available')
+        with Ports() as ports:
+            port = ports.find_free_port()
+            if port is None:
+                self.skipTest('Failed to find a free port')
+            self._do_linux_migration(
+                'exec:socat TCP-LISTEN:%u -' % port,
+                'exec:socat - TCP:localhost:%u,forever' % port)
+
 if __name__ == '__main__':
     MigrationTest.main()
Signature · 1 line
2.52.0
Reviewed-by on v2 2/2
#10 lore raw

Re: [PATCH v2 2/2] tests/functional/ppc64: extend ppc64 powernv net device tests

In reply to Aniket Sahu
Quoted 2 lines · Aniket Sahu

Added console checks as the probe log lines will appear before the S14Silence-console init scripts.

Please add your missing SOB. The changes look good to me.

Thanks,
Amit

Quoted 27 lines
---
 tests/functional/ppc64/test_powernv.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tests/functional/ppc64/test_powernv.py +5 -2
index f3e05e4d38..200fd2c894 100755
@@ -201,9 +201,12 @@ def do_test_ppc64_powernv(self, proc):
 
         self.wait_for_console_pattern("CPU: " + proc + " generation processor")
         self.wait_for_console_pattern("INIT: Starting kernel at ")
+        # NVMe, e1000e, and xHCI are probed synchronously by the kernel
+        # during PCI enumeration, after OPAL hands off to Linux.
+        self.wait_for_console_pattern("nvme nvme0")
+        self.wait_for_console_pattern("e1000e")
+        self.wait_for_console_pattern("xhci_hcd")
         self.wait_for_console_pattern("Run /sbin/init as init process")
-        # Device detection output driven by udev probing is sometimes cut off
-        # from console output, suspect S14silence-console init script.
 
     def test_ppc64_powernv_external_dtb(self):
         self.set_machine('powernv11')
Signature · 1 line
2.52.0
#4 lore raw

Re: [PATCH v2 1/2] tests/functional/ppc64: extend pseries migration tests

In reply to Amit Machhiwal
Quoted 110 lines · Amit Machhiwal

Hi Aniket,

Thanks for the patches. Please find my comments inline below.

Quoted 35 lines · Aniket Sahu

Made a few changes to test_pseries.py to extend the migration tests to validate exec (socat) and UNIX paths.

- Refactored test_ppc64_linux_migration to a private method _do_linux_migration(dst_uri, src_uri=None).
- It is then called by three separate methods which exercise the TCP, UNIX and exec paths via the migrate_vms method from MigrationTest.

---
  tests/functional/ppc64/test_pseries.py | 41 ++++++++++++++++++++++----
  1 file changed, 36 insertions(+), 5 deletions(-)
tests/functional/ppc64/test_pseries.py +5 -2
index cb6d25dc81..19f31141b1 100755
@@ -8,8 +8,9 @@
  # later.  See the COPYING file in the top-level directory.
 
  from qemu_test import Asset
-from qemu_test import wait_for_console_pattern
+from qemu_test import wait_for_console_pattern, which
  from migration import MigrationTest
+from qemu_test.ports import Ports
 
  class PseriesMachine(MigrationTest):
 
@@ -88,12 +89,20 @@ 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):
+    def _do_linux_migration(self, dst_uri, src_uri=None):
+        """
+        Boot a pseries kernel on a source VM, wait until Linux is up, then

tests/functional/ppc64/test_pseries.py def test_ppc64_linux_big_boot(self): · line 104

Quoted 10 lines
tests/functional/ppc64/test_pseries.py +5 -0
+        migrate to a destination VM over the given URI(s) and verify the boot
+        continues on the destination.
+        """
          self.set_machine('pseries')
 
          kernel_path = self.ASSET_KERNEL.fetch()
          kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
 
+        if src_uri is None:
+            src_uri = dst_uri

The default behavior of src_uri=None is non-obvious from the docstring. Could you mention that it defaults to dst_uri, and that callers using transports with different source and destination URIs (such as the exec: case below) need to provide src_uri explicitly?

Quoted 33 lines
tests/functional/ppc64/test_pseries.py +15 -3
+
          dest_vm = self.get_vm(name="dest-qemu")
          dest_vm.add_args('-incoming', 'defer')
          dest_vm.add_args('-smp', '4')
@@ -111,16 +120,38 @@ def test_ppc64_linux_migration(self):
          source_vm.set_console()
          source_vm.launch()
 
-        # ensure the boot has reached Linux
+        # ensure the boot has reached Linux before migrating
          console_pattern = 'smp: Brought up 1 node, 4 CPUs'
          wait_for_console_pattern(self, console_pattern, self.panic_message,
                                   vm=source_vm)
 
-        self.migration_with_tcp_localhost_vms(dest_vm, source_vm)
+        self.migrate_vms(dst_uri, src_uri, dest_vm, source_vm)
 
-        # ensure the boot proceeds after migration
+        # ensure the boot continues on the destination after migration
          wait_for_console_pattern(self, self.good_message, self.panic_message,
                                   vm=dest_vm)
 
+    def test_ppc64_linux_migration(self):
+        with Ports() as ports:
+            port = ports.find_free_port()
+            if port is None:
+                self.skipTest('Failed to find a free port')
+            self._do_linux_migration('tcp:localhost:%u' % port)
+
+    def test_ppc64_linux_migration_unix(self):
+        self._do_linux_migration(
+            'unix:%s/migration.sock' % self.socket_dir().name)
+

tests/functional/ppc64/test_pseries.py def test_ppc64_linux_migration(self): · line 154

Quoted 10 lines
tests/functional/ppc64/test_pseries.py +10 -0
+    def test_ppc64_linux_migration_exec(self):
+        if not which('socat'):
+            self.skipTest('socat is not available')
+        with Ports() as ports:
+            port = ports.find_free_port()
+            if port is None:
+                self.skipTest('Failed to find a free port')
+            self._do_linux_migration(
+                'exec:socat TCP-LISTEN:%u -' % port,
+                'exec:socat - TCP:localhost:%u,forever' % port)

I share Thomas's concern about CI cost. With this patch, Linux is fully booted three times — once per transport variant — which significantly increases the wall-clock time of the pseries migration test slot.

The UNIX and exec transport paths are already covered on ppc64 in tests/functional/ppc64/test_migration.py, though against mac99 rather than pseries. If the intent is specifically to validate these transports on the pseries machine, that is a reasonable goal — but does it require a full Linux boot? The transport layer is independent of what the guest is running. A firmware-only pseries migration (as was done in v1) would cover the pseries-specific migration path with substantially lower CI cost.

Quoted 2 lines

Please clarify in the commit message why a full Linux boot is needed here, or consider using a firmware-only guest for the two new tests.\

Hi Amit, Thomas,

I do agree that full boot test cases might be unnecessary, however it was suggested by Harsh during offline discussions that if a full boot test already exists for TCP, so perhaps the best course of action here is to revert back to the firmware-only test cases from v1. I do need suggestions on if we should extend test_migration.py or make a new file for the ppc machines.

Thanks and Regards,
Aniket.

#5 lore raw

Re: [PATCH v2 1/2] tests/functional/ppc64: extend pseries migration tests

Quoted 103 lines · Aniket Sahu
Quoted 101 lines · Amit Machhiwal

Hi Aniket,

Thanks for the patches.  Please find my comments inline below.

Quoted 32 lines · Aniket Sahu

Made a few changes to test_pseries.py to extend the migration tests to validate exec (socat) and UNIX paths.

- Refactored test_ppc64_linux_migration to a private method _do_linux_migration(dst_uri, src_uri=None).
- It is then called by three separate methods which exercise the TCP, UNIX and exec paths via the migrate_vms method from MigrationTest.
---
  tests/functional/ppc64/test_pseries.py | 41 ++++++++++++++++++++++----

  1 file changed, 36 insertions(+), 5 deletions(-)
tests/functional/ppc64/test_pseries.py +0 -0
index cb6d25dc81..19f31141b1 100755
@@ -8,8 +8,9 @@
   # later.  See the COPYING file in the top-level directory.

  from qemu_test import Asset

tests/functional/ppc64/test_pseries.py +1 -1
-from qemu_test import wait_for_console_pattern
+from qemu_test import wait_for_console_pattern, which

  from migration import MigrationTest
+from qemu_test.ports import Ports
  class PseriesMachine(MigrationTest):

tests/functional/ppc64/test_pseries.py +4 -1
@@ -88,12 +89,20 @@ 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):
+    def _do_linux_migration(self, dst_uri, src_uri=None):
+        """
+        Boot a pseries kernel on a source VM, wait until Linux is up, then
+        migrate to a destination VM over the given URI(s) and verify the 
Quoted 8 lines

boot
+        continues on the destination.
+        """
          self.set_machine('pseries')
          kernel_path = self.ASSET_KERNEL.fetch() kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE +        if src_uri is None:
+            src_uri = dst_uri

The default behavior of src_uri=None is non-obvious from the docstring. Could you mention that it defaults to dst_uri, and that callers using transports with different source and destination URIs (such as the exec: case below) need to provide src_uri explicitly?

Quoted 29 lines

+
          dest_vm = self.get_vm(name="dest-qemu")
          dest_vm.add_args('-incoming', 'defer')
          dest_vm.add_args('-smp', '4')

tests/functional/ppc64/test_pseries.py +1 -1
@@ -111,16 +120,38 @@ def test_ppc64_linux_migration(self):
           source_vm.set_console()
           source_vm.launch()
-        # ensure the boot has reached Linux
+        # ensure the boot has reached Linux before migrating

          console_pattern = 'smp: Brought up 1 node, 4 CPUs' wait_for_console_pattern(self, console_pattern, self.panic_message, vm=source_vm)
-        self.migration_with_tcp_localhost_vms(dest_vm, source_vm) +        self.migrate_vms(dst_uri, src_uri, dest_vm, source_vm)
-        # ensure the boot proceeds after migration
+        # ensure the boot continues on the destination after migration wait_for_console_pattern(self, self.good_message, self.panic_message, vm=dest_vm)
+    def test_ppc64_linux_migration(self):
+        with Ports() as ports:
+            port = ports.find_free_port()
+            if port is None:
+                self.skipTest('Failed to find a free port')
+            self._do_linux_migration('tcp:localhost:%u' % port)

tests/functional/ppc64/test_pseries.py +5 -0
+
+    def test_ppc64_linux_migration_unix(self):
+        self._do_linux_migration(
+            'unix:%s/migration.sock' % self.socket_dir().name)
+

tests/functional/ppc64/test_pseries.py def test_ppc64_linux_migration(self): · line 154

Quoted 10 lines
tests/functional/ppc64/test_pseries.py +10 -0
+    def test_ppc64_linux_migration_exec(self):
+        if not which('socat'):
+            self.skipTest('socat is not available')
+        with Ports() as ports:
+            port = ports.find_free_port()
+            if port is None:
+                self.skipTest('Failed to find a free port')
+            self._do_linux_migration(
+                'exec:socat TCP-LISTEN:%u -' % port,
+                'exec:socat - TCP:localhost:%u,forever' % port)

I share Thomas's concern about CI cost.  With this patch, Linux is fully booted three times — once per transport variant — which significantly increases the wall-clock time of the pseries migration test slot.

The UNIX and exec transport paths are already covered on ppc64 in tests/functional/ppc64/test_migration.py, though against mac99 rather than pseries.  If the intent is specifically to validate these transports on the pseries machine, that is a reasonable goal — but does it require a full Linux boot?  The transport layer is independent of what the guest is running.  A firmware-only pseries migration (as was done in v1) would cover the pseries-specific migration path with substantially lower CI cost.

Quoted 6 lines
Quoted 2 lines

Please clarify in the commit message why a full Linux boot is needed here, or consider using a firmware-only guest for the two new tests.\

Hi Amit, Thomas,

I do agree that full boot test cases might be unnecessary, however it was suggested by Harsh during offline discussions that if a full boot test already exists for TCP, so perhaps the best course of action here is to revert back to the firmware-only test cases from v1. I do need suggestions on if we should extend test_migration.py or make a new file for the ppc machines.

I think I'd just turn "mac99" in test_migration_with_unix() and test_migration_with_exec() in test_migration.py into "pseries", and keep the "mac99" in the tcp test there. That should give enough test coverage for both machines in quick test mode.

Thomas

#6 lore raw

Re: [PATCH v2 1/2] tests/functional/ppc64: extend pseries migration tests

Quoted 107 lines · Thomas Huth
Quoted 106 lines · Aniket Sahu
Quoted 104 lines · Amit Machhiwal

Hi Aniket,

Thanks for the patches.  Please find my comments inline below.

Quoted 34 lines · Aniket Sahu

Made a few changes to test_pseries.py to extend the migration tests to validate exec (socat) and UNIX paths.

- Refactored test_ppc64_linux_migration to a private method _do_linux_migration(dst_uri, src_uri=None).
- It is then called by three separate methods which exercise the TCP, UNIX and exec paths via the migrate_vms method from MigrationTest.
---
  tests/functional/ppc64/test_pseries.py | 41
++++++++++++++++++++++----

  1 file changed, 36 insertions(+), 5 deletions(-)
tests/functional/ppc64/test_pseries.py +0 -0
index cb6d25dc81..19f31141b1 100755
@@ -8,8 +8,9 @@
   # later.  See the COPYING file in the top-level directory.

  from qemu_test import Asset

tests/functional/ppc64/test_pseries.py +1 -1
-from qemu_test import wait_for_console_pattern
+from qemu_test import wait_for_console_pattern, which

  from migration import MigrationTest
+from qemu_test.ports import Ports
  class PseriesMachine(MigrationTest):

tests/functional/ppc64/test_pseries.py +3 -1
@@ -88,12 +89,20 @@ 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):
+    def _do_linux_migration(self, dst_uri, src_uri=None):
+        """
+        Boot a pseries kernel on a source VM, wait until Linux is 

up, then
+        migrate to a destination VM over the given URI(s) and

Quoted 8 lines

verify the boot
+        continues on the destination.
+        """
          self.set_machine('pseries')
          kernel_path = self.ASSET_KERNEL.fetch() kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE +        if src_uri is None:
+            src_uri = dst_uri

The default behavior of src_uri=None is non-obvious from the docstring.  Could you mention that it defaults to dst_uri, and that callers using transports with different source and destination URIs (such as the exec: case below) need to provide src_uri explicitly?

Quoted 30 lines

+
          dest_vm = self.get_vm(name="dest-qemu")
          dest_vm.add_args('-incoming', 'defer')
          dest_vm.add_args('-smp', '4')

tests/functional/ppc64/test_pseries.py +1 -1
@@ -111,16 +120,38 @@ def test_ppc64_linux_migration(self):
           source_vm.set_console()
           source_vm.launch()
-        # ensure the boot has reached Linux
+        # ensure the boot has reached Linux before migrating

          console_pattern = 'smp: Brought up 1 node, 4 CPUs' wait_for_console_pattern(self, console_pattern, self.panic_message, vm=source_vm)
-        self.migration_with_tcp_localhost_vms(dest_vm, source_vm) +        self.migrate_vms(dst_uri, src_uri, dest_vm, source_vm)
-        # ensure the boot proceeds after migration
+        # ensure the boot continues on the destination after migration
          wait_for_console_pattern(self, self.good_message, self.panic_message, vm=dest_vm)
+    def test_ppc64_linux_migration(self):
+        with Ports() as ports:
+            port = ports.find_free_port()
+            if port is None:
+                self.skipTest('Failed to find a free port')
+            self._do_linux_migration('tcp:localhost:%u' % port)

tests/functional/ppc64/test_pseries.py +5 -0
+
+    def test_ppc64_linux_migration_unix(self):
+        self._do_linux_migration(
+            'unix:%s/migration.sock' % self.socket_dir().name)
+

tests/functional/ppc64/test_pseries.py

Quoted 10 lines
tests/functional/ppc64/test_pseries.py +10 -0
+    def test_ppc64_linux_migration_exec(self):
+        if not which('socat'):
+            self.skipTest('socat is not available')
+        with Ports() as ports:
+            port = ports.find_free_port()
+            if port is None:
+                self.skipTest('Failed to find a free port')
+            self._do_linux_migration(
+                'exec:socat TCP-LISTEN:%u -' % port,
+                'exec:socat - TCP:localhost:%u,forever' % port)

I share Thomas's concern about CI cost.  With this patch, Linux is fully booted three times — once per transport variant — which significantly increases the wall-clock time of the pseries migration test slot.

The UNIX and exec transport paths are already covered on ppc64 in tests/functional/ppc64/test_migration.py, though against mac99 rather than pseries.  If the intent is specifically to validate these transports on the pseries machine, that is a reasonable goal — but does it require a full Linux boot?  The transport layer is independent of what the guest is running.  A firmware-only pseries migration (as was done in v1) would cover the pseries-specific migration path with substantially lower CI cost.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Please clarify in the commit message why a full Linux boot is needed here, or consider using a firmware-only guest for the two new tests.\

Hi Amit, Thomas,

I do agree that full boot test cases might be unnecessary, however it was suggested by Harsh during offline discussions that if a full boot test already exists for TCP, so perhaps the best course of action here is to revert back to the firmware-only test cases from v1. I do need suggestions on if we should extend test_migration.py or make a new file for the ppc machines.

I think I'd just turn "mac99" in test_migration_with_unix() and test_migration_with_exec() in test_migration.py into "pseries", and keep the "mac99" in the tcp test there. That should give enough test coverage for both machines in quick test mode.

Ack. Writing a follow-up patch with only the following change for covering the alternate path tests for pseries.

tests/functional/ppc64/test_migration.py +0 -0
@@ -15,11 +15,11 @@ def test_migration_with_tcp_localhost(self):

         self.migration_with_tcp_localhost()

     def test_migration_with_unix(self):
-        self.set_machine('mac99')
+        self.set_machine('pseries')
         self.migration_with_unix()

     def test_migration_with_exec(self):
-        self.set_machine('mac99')
+        self.set_machine('pseries')
         self.migration_with_exec()

Regards,
Aniket.