All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Fabiano Rosas <farosas@suse.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH 2/3] tests/functional/migration: Accept vm objects in do_migrate
Date: Wed, 28 Jan 2026 14:35:10 -0500	[thread overview]
Message-ID: <aXpk7m4LXpAdMOb8@x1.local> (raw)
In-Reply-To: <20260128142829.25326-3-farosas@suse.de>

On Wed, Jan 28, 2026 at 11:28:28AM -0300, Fabiano Rosas wrote:
> Allow MigrationTest.do_migrate() to receive objects for virtual
> machines already created. This will allow MigrationTest to provide the
> migration functionality for tests that are defined in a separate
> module and require extra setup (e.g. arch-specific) to the virtual
> machines before migration.
> 
> The next patches will instantiate MigrationTest from another test
> class.
> 
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>  tests/functional/migration.py | 21 ++++++++++++++-------
>  1 file changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/functional/migration.py b/tests/functional/migration.py
> index 0aa873edba..ac6feeeefb 100644
> --- a/tests/functional/migration.py
> +++ b/tests/functional/migration.py
> @@ -40,15 +40,22 @@ 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 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 do_migrate(self, dest_uri, src_uri=None, source_vm=None, dest_vm=None):

Nit: maybe good to always have dst, then src, or vice versa.

> +        if dest_vm:
> +            dest_vm.qmp('migrate-incoming', uri=dest_uri)
> +        else:
> +            dest_vm = self.get_vm('-incoming', dest_uri, name="dest-qemu")
> +            dest_vm.add_args('-nodefaults')
> +            dest_vm.launch()

Maybe this is a chance to switch to -incoming defer and always use
"migrate-incoming" QMP?

Then we can have _do_migrate() (or some better name..) do the real
migration commands, always taking VMs + URIs, making do_migrate() only
create two VMs and pass it over.

> +
> +        if not source_vm:
> +            source_vm = self.get_vm(name="source-qemu")
> +            source_vm.add_args('-nodefaults')
> +            source_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)
>  
> -- 
> 2.51.0
> 

-- 
Peter Xu



  reply	other threads:[~2026-01-28 19:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-28 14:28 [PATCH 0/3] tests/functional: Fix ppc64 issue with make -j Fabiano Rosas
2026-01-28 14:28 ` [PATCH 1/3] tests/functional/migration: Use socket_dir Fabiano Rosas
2026-01-28 19:37   ` Peter Xu
2026-01-28 14:28 ` [PATCH 2/3] tests/functional/migration: Accept vm objects in do_migrate Fabiano Rosas
2026-01-28 19:35   ` Peter Xu [this message]
2026-01-28 14:28 ` [PATCH 3/3] tests/functional/ppc64: Remove custom migration routine Fabiano Rosas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aXpk7m4LXpAdMOb8@x1.local \
    --to=peterx@redhat.com \
    --cc=farosas@suse.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.