-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4987 from cliping/tls-dest
migration: Add cases about live migration with copy storage
- Loading branch information
Showing
4 changed files
with
224 additions
and
0 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
libvirt/tests/cfg/migration_with_copy_storage/network_data_transport/tls_destination.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
- migration_with_copy_storage.network_data_transport.tls.tls_destination: | ||
type = tls | ||
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 <domain> <desturi> | ||
virsh_migrate_extra = '' | ||
# SSH connection time out | ||
ssh_timeout = 60 | ||
# 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}" | ||
status_error = "yes" | ||
check_network_accessibility_after_mig = "yes" | ||
migrate_desturi_port = "16509" | ||
migrate_desturi_type = "tcp" | ||
virsh_migrate_desturi = "qemu+tcp://${migrate_dest_host}/system" | ||
transport_type = "tls" | ||
setup_nfs = "no" | ||
nfs_mount_dir = | ||
custom_pki_path = "/etc/pki/qemu" | ||
qemu_tls = "yes" | ||
server_cn = "copy-storage-test.com.cn" | ||
client_cn = "ENTER.YOUR.EXAMPLE.CLIENT_CN" | ||
err_msg = "Certificate does not match the hostname" | ||
status_error = "yes" | ||
migrate_again = "yes" | ||
test_case = "tls_destination" | ||
virsh_migrate_extra = "--tls" | ||
|
||
variants: | ||
- p2p: | ||
virsh_migrate_options = '--live --p2p --verbose' | ||
- non_p2p: | ||
virsh_migrate_options = '--live --verbose' | ||
variants: | ||
- copy_storage_all: | ||
copy_storage_option = "--copy-storage-all" | ||
- copy_storage_inc: | ||
copy_storage_option = "--copy-storage-inc" | ||
variants: | ||
- correct_value: | ||
virsh_migrate_extra_mig_again = "--tls --tls-destination ${server_cn}" | ||
- wrong_value: | ||
migrate_again_status_error = "yes" | ||
virsh_migrate_extra_mig_again = "--tls --tls-destination fake${server_cn}" | ||
err_msg_again = "Certificate does not match the hostname" |
54 changes: 54 additions & 0 deletions
54
.../cfg/migration_with_copy_storage/network_data_transport/tls_wrong_cert_configurations.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
- migration_with_copy_storage.network_data_transport.tls.wrong_cert_configurations: | ||
type = tls | ||
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 <domain> <desturi> | ||
virsh_migrate_extra = '' | ||
# SSH connection time out | ||
ssh_timeout = 60 | ||
# Local URI | ||
virsh_migrate_connect_uri = 'qemu:///system' | ||
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}" | ||
migrate_desturi_port = "16509" | ||
migrate_desturi_type = "tcp" | ||
virsh_migrate_desturi = "qemu+tcp://${migrate_dest_host}/system" | ||
transport_type = "tls" | ||
setup_nfs = "no" | ||
nfs_mount_dir = | ||
custom_pki_path = "/etc/pki/qemu" | ||
qemu_tls = "yes" | ||
server_cn = "ENTER.YOUR.EXAMPLE.SERVER_CN" | ||
client_cn = "ENTER.YOUR.EXAMPLE.CLIENT_CN" | ||
err_msg = "Certificate does not match the hostname" | ||
status_error = "yes" | ||
test_case = "wrong_cert_configuration" | ||
virsh_migrate_extra = "--tls" | ||
|
||
variants: | ||
- p2p: | ||
virsh_migrate_options = '--live --p2p --verbose' | ||
- non_p2p: | ||
virsh_migrate_options = '--live --verbose' | ||
variants: | ||
- copy_storage_all: | ||
copy_storage_option = "--copy-storage-all" | ||
- copy_storage_inc: | ||
copy_storage_option = "--copy-storage-inc" | ||
variants cert_configuration: | ||
- no_client_cert_on_src: | ||
cert_path = "${custom_pki_path}/client-cert.pem" | ||
err_msg = "Cannot read from TLS channel: Software caused connection abort" | ||
- no_server_cert_on_target: | ||
cert_path = "${custom_pki_path}/server-cert.pem" | ||
err_msg = "unable to execute QEMU command 'object-add': Unable to access credentials ${cert_path}: No such file or directory" | ||
- wrong_cn_in_cert: | ||
server_cn = "test.com.cn" | ||
err_msg = "Certificate does not match the hostname" |
58 changes: 58 additions & 0 deletions
58
libvirt/tests/src/migration_with_copy_storage/network_data_transport/tls.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
from avocado.utils import process | ||
|
||
from virttest import remote | ||
|
||
from provider.migration import base_steps | ||
|
||
|
||
def run(test, params, env): | ||
""" | ||
Test live migration with copy storage - network data transport - TLS. | ||
:param test: test object | ||
:param params: Dictionary with the test parameters | ||
:param env: Dictionary with test environment. | ||
""" | ||
def setup_wrong_cert_configuration(): | ||
""" | ||
Setup for wrong cert configuration | ||
""" | ||
cert_configuration = params.get("cert_configuration", '') | ||
custom_pki_path = params.get("custom_pki_path") | ||
cert_path = params.get("cert_path") | ||
|
||
test.log.info("Setup for wrong cert configuration.") | ||
migration_obj.setup_connection() | ||
cmd = "rm -f %s" % cert_path | ||
if cert_configuration == "no_client_cert_on_src": | ||
process.run(cmd, shell=True) | ||
elif cert_configuration == "no_server_cert_on_target": | ||
remote.run_remote_cmd(cmd, params, ignore_status=False) | ||
|
||
def cleanup_test(): | ||
""" | ||
Cleanup steps | ||
""" | ||
migration_obj.cleanup_connection() | ||
base_steps.cleanup_disks_remote(params, vm) | ||
|
||
test_case = params.get('test_case', '') | ||
migrate_again = "yes" == params.get("migrate_again", "no") | ||
vm_name = params.get("migrate_main_vm") | ||
|
||
vm = env.get_vm(vm_name) | ||
migration_obj = base_steps.MigrationBase(test, vm, params) | ||
setup_test = eval("setup_%s" % test_case) if "setup_%s" % test_case in \ | ||
locals() else migration_obj.setup_connection | ||
|
||
try: | ||
setup_test() | ||
base_steps.prepare_disks_remote(params, vm) | ||
migration_obj.run_migration() | ||
if migrate_again: | ||
migration_obj.run_migration_again() | ||
migration_obj.verify_default() | ||
finally: | ||
cleanup_test() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters