diff --git a/libvirt/tests/cfg/migration_with_copy_storage/async_job/abort_job.cfg b/libvirt/tests/cfg/migration_with_copy_storage/async_job/abort_job.cfg new file mode 100644 index 00000000000..7452e865e02 --- /dev/null +++ b/libvirt/tests/cfg/migration_with_copy_storage/async_job/abort_job.cfg @@ -0,0 +1,77 @@ +- migration_with_copy_storage.async_job.abort_job: + type = abort_job + migration_setup = 'yes' + # Console output can only be monitored via virsh console output + only_pty = True + take_regular_screendumps = no + # Extra options to pass after + virsh_migrate_extra = "" + # SSH connection time out + ssh_timeout = 60 + start_vm = "yes" + # Local URI + virsh_migrate_connect_uri = qemu:///system" + virsh_migrate_dest_state = "running" + virsh_migrate_src_state = "shut off" + image_convert = "no" + server_ip = "${migrate_dest_host}" + server_user = "root" + server_pwd = "${migrate_dest_pwd}" + client_ip = "${migrate_source_host}" + client_user = "root" + client_pwd = "${migrate_source_pwd}" + simple_disk_check_after_mig = "yes" + status_error = "yes" + setup_nfs = "no" + nfs_mount_dir = + setup_local_nfs = "no" + storage_type = "" + port_to_check = "49153" + migrate_again = "yes" + migrate_again_status_error = 'no' + stress_package = "stress" + stress_args = "--cpu 8 --io 4 --vm 4 --vm-bytes 128M --timeout 50s" + action_during_mig_again = '[{"func": "libvirt_network.check_established", "func_param": "params", "need_sleep_time": "1"}]' + domjobabort_on_src = "yes" + variants: + - p2p: + virsh_migrate_options = "--live --p2p --verbose" + - non_p2p: + virsh_migrate_options = "--live --verbose" + variants: + - with_precopy: + variants: + - tcp: + migrate_desturi_port = "16509" + migrate_desturi_type = "tcp" + virsh_migrate_desturi = "qemu+tcp://${migrate_dest_host}/system" + - unix_proxy: + desturi_socket_path = "/tmp/desturi-socket" + migrateuri_socket_path = "/var/lib/libvirt/qemu/migrateuri-socket" + disks_uri_socket_path = "/var/lib/libvirt/qemu/disks-uri-socket" + migrate_desturi_type = "unix_proxy" + virsh_migrate_desturi = "qemu+unix:///system?socket=${desturi_socket_path}" + variants: + - copy_storage_all: + virsh_migrate_extra = "--copy-storage-all" + - copy_storage_inc: + virsh_migrate_extra = "--copy-storage-inc" + variants: + - with_tls: + virsh_migrate_extra = "${virsh_migrate_extra} --tls" + transport_type = "tls" + custom_pki_path = "/etc/pki/qemu" + qemu_tls = "yes" + server_cn = "ENTER.YOUR.EXAMPLE.SERVER_CN" + client_cn = "ENTER.YOUR.EXAMPLE.CLIENT_CN" + - without_tls: + variants: + - abort_in_storage_copy_phase: + action_during_mig = '[{"func": "libvirt_network.check_established", "func_param": "params", "need_sleep_time": "3"}, {"func": "do_domjobabort", "func_param": "params"}]' + expected_event_src = ["block-job.*Block Copy for.* failed", "block-job-2.*Block Copy for vda failed"] + expected_event_target = ["lifecycle.*Stopped Failed"] + err_msg = "operation aborted: migration out: canceled by client" + - abort_in_memory_copy_phase: + action_during_mig = '[{"func": "libvirt_network.check_established", "after_event": "migration-iteration", "func_param": "params", "wait_for_after_event_timeout": "600"}, {"func": "do_domjobabort", "func_param": "params"}]' + expected_event_target = ["lifecycle.*Stopped Failed"] + err_msg = "operation aborted: job 'migration out' canceled by client" diff --git a/libvirt/tests/src/migration_with_copy_storage/async_job/abort_job.py b/libvirt/tests/src/migration_with_copy_storage/async_job/abort_job.py new file mode 100644 index 00000000000..8c8a56a609d --- /dev/null +++ b/libvirt/tests/src/migration_with_copy_storage/async_job/abort_job.py @@ -0,0 +1,43 @@ +import os + +from provider.migration import base_steps +from provider.migration import migration_base + + +def run(test, params, env): + """ + To verify that vm live migration with copying storage can be aborted + successfully, and related resource can be cleaned up so next migration + can succeed. + + """ + def verify_test(): + """ + Verify test + + """ + migration_obj.verify_default() + # Check event output + migration_base.check_event_output(params, test, virsh_session, remote_virsh_session) + + vm_name = params.get("migrate_main_vm") + migrate_again = "yes" == params.get("migrate_again", "no") + + virsh_session = None + remote_virsh_session = None + + vm = env.get_vm(vm_name) + migration_obj = base_steps.MigrationBase(test, vm, params) + + try: + migration_obj.setup_connection() + base_steps.prepare_disks_remote(params, vm) + # Monitor event on source/target host + virsh_session, remote_virsh_session = migration_base.monitor_event(params) + migration_obj.run_migration() + if migrate_again: + migration_obj.run_migration_again() + verify_test() + finally: + base_steps.cleanup_disks_remote(params, vm) + migration_obj.cleanup_connection()