mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:46:10 +00:00
tests/functional/migration: add VM launch/configure hooks
Introduce configure_machine, launch_source_vm and assert_dest_vm methods to allow child classes to override some pieces of source/dest VMs creation, start and check logic. Reviewed-by: Peter Xu <peterx@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@futurfusion.io> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
This commit is contained in:
committed by
Klaus Jensen
parent
034baf047f
commit
cb8f285ce9
@@ -40,19 +40,36 @@ class MigrationTest(QemuSystemTest):
|
||||
self.assertEqual(dst_vm.cmd('query-status')['status'], 'running')
|
||||
self.assertEqual(src_vm.cmd('query-status')['status'],'postmigrate')
|
||||
|
||||
# Can be overridden by subclasses to configure both source/dest VMs.
|
||||
def configure_machine(self, vm):
|
||||
vm.add_args('-nodefaults')
|
||||
|
||||
# Can be overridden by subclasses to prepare the source VM before
|
||||
# migration, e.g. by running some workload inside the source VM
|
||||
# to see if it continues to run properly after migration.
|
||||
def launch_source_vm(self, vm):
|
||||
vm.launch()
|
||||
|
||||
# Can be overridden by subclasses to check the destination VM after
|
||||
# migration, e.g. by checking if the workload is still running after
|
||||
# migration.
|
||||
def assert_dest_vm(self, vm):
|
||||
pass
|
||||
|
||||
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)
|
||||
self.assert_dest_vm(dst_vm)
|
||||
|
||||
def migrate(self, dst_uri, src_uri=None):
|
||||
dst_vm = self.get_vm('-incoming', 'defer', name="dst-qemu")
|
||||
dst_vm.add_args('-nodefaults')
|
||||
self.configure_machine(dst_vm)
|
||||
dst_vm.launch()
|
||||
|
||||
src_vm = self.get_vm(name="src-qemu")
|
||||
src_vm.add_args('-nodefaults')
|
||||
src_vm.launch()
|
||||
self.configure_machine(src_vm)
|
||||
self.launch_source_vm(src_vm)
|
||||
|
||||
if src_uri is None:
|
||||
src_uri = dst_uri
|
||||
|
||||
Reference in New Issue
Block a user