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 <[email protected]> --- 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): + 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() + + 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
