Skip to content

Commit fc91820

Browse files
committed
migration: Add case to test stopping virtqemud during migration
To test stopping virtqemud on the source/destination during migration. VIRT-17322 - [Migration] Stop SRC libvirtd during Perform Phase of live migration - p2p migration RHEL-201764 - [Migration] Stop DST libvirtd during Perform Phase of live migration - p2p migration Signed-off-by: lcheng <[email protected]>
1 parent d4a34d0 commit fc91820

File tree

2 files changed

+121
-0
lines changed

2 files changed

+121
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
- migration.destructive_operations_around_live_migration.stop_virtqemud_during_performphase:
2+
type = stop_virtqemud_during_performphase
3+
migration_setup = 'yes'
4+
storage_type = 'nfs'
5+
setup_local_nfs = 'yes'
6+
disk_type = "file"
7+
disk_source_protocol = "netfs"
8+
mnt_path_name = ${nfs_mount_dir}
9+
# Console output can only be monitored via virsh console output
10+
only_pty = True
11+
take_regular_screendumps = no
12+
# Extra options to pass after <domain> <desturi>
13+
virsh_migrate_extra = ''
14+
# SSH connection time out
15+
ssh_timeout = 60
16+
# Local URI
17+
virsh_migrate_connect_uri = 'qemu:///system'
18+
virsh_migrate_dest_state = "running"
19+
virsh_migrate_src_state = "shut off"
20+
image_convert = 'no'
21+
server_ip = "${migrate_dest_host}"
22+
server_user = "root"
23+
server_pwd = "${migrate_dest_pwd}"
24+
check_network_accessibility_after_mig = "yes"
25+
migrate_desturi_port = "16509"
26+
migrate_desturi_type = "tcp"
27+
virsh_migrate_desturi = "qemu+tcp://${migrate_dest_host}/system"
28+
status_error = "yes"
29+
service_name = "virtqemud"
30+
migrate_again_status_error = "no"
31+
migrate_speed = "5"
32+
simple_disk_check_after_mig = "yes"
33+
service_operations = "stop"
34+
action_during_mig = '[{"func": "libvirt_service.control_service", "func_param": "params", "after_event": "migration-iteration"}]'
35+
expected_dest_state = "nonexist"
36+
expected_src_state = "running"
37+
variants:
38+
- p2p:
39+
virsh_migrate_options = '--live --p2p --verbose'
40+
- non_p2p:
41+
virsh_migrate_options = '--live --verbose'
42+
variants:
43+
- with_precopy:
44+
variants test_case:
45+
- stop_src_virtqemud:
46+
err_msg = "Disconnected from qemu:///system due to end of file"
47+
- stop_dst_virtqemud:
48+
service_on_dst = "yes"
49+
err_msg = "Unable to read from socket: Connection reset by peer"
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2+
#
3+
# Copyright Redhat
4+
#
5+
# SPDX-License-Identifier: GPL-2.0
6+
#
7+
# Author: Liping Cheng <[email protected]>
8+
#
9+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10+
11+
from virttest import remote
12+
from virttest import utils_libvirtd
13+
from virttest import virsh
14+
15+
from virttest.utils_test import libvirt
16+
17+
from provider.migration import base_steps
18+
19+
20+
def run(test, params, env):
21+
"""
22+
This case is to test stopping virtqemud on the source/destination
23+
during migration.
24+
25+
:param test: test object
26+
:param params: Dictionary with the test parameters
27+
:param env: Dictionary with test environment.
28+
"""
29+
def verify_test():
30+
"""
31+
Verify migration result
32+
33+
"""
34+
server_ip = params.get("server_ip")
35+
server_user = params.get("server_user", "root")
36+
server_pwd = params.get("server_pwd")
37+
dest_uri = params.get("virsh_migrate_desturi")
38+
expected_src_state = params.get("expected_src_state")
39+
expected_dest_state = params.get("expected_dest_state")
40+
test_case = params.get("test_case")
41+
42+
func_returns = dict(migration_obj.migration_test.func_ret)
43+
migration_obj.migration_test.func_ret.clear()
44+
test.log.debug("Migration returns function results: %s", func_returns)
45+
if test_case == "stop_dst_virtqemud":
46+
dst_session = remote.wait_for_login('ssh', server_ip, '22',
47+
server_user, server_pwd,
48+
r"[\#\$]\s*$")
49+
utils_libvirtd.Libvirtd("virtqemud", session=dst_session).start()
50+
dst_session.close()
51+
if expected_dest_state and expected_dest_state == "nonexist":
52+
virsh.domstate(vm_name, uri=dest_uri, debug=True)
53+
if virsh.domain_exists(vm_name, uri=dest_uri):
54+
test.fail("The domain on target host is found, but expected not.")
55+
if test_case == "stop_src_virtqemud":
56+
utils_libvirtd.Libvirtd("virtqemud").start()
57+
if expected_src_state:
58+
if not libvirt.check_vm_state(vm.name, expected_src_state, uri=migration_obj.src_uri):
59+
test.fail("Migrated VM failed to be in %s state at source." % expected_src_state)
60+
61+
vm_name = params.get("migrate_main_vm")
62+
vm = env.get_vm(vm_name)
63+
migration_obj = base_steps.MigrationBase(test, vm, params)
64+
65+
try:
66+
migration_obj.setup_connection()
67+
migration_obj.run_migration()
68+
verify_test()
69+
migration_obj.run_migration_again()
70+
migration_obj.verify_default()
71+
finally:
72+
migration_obj.cleanup_connection()

0 commit comments

Comments
 (0)