-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
migration: Add 3 migration cases to check disks port option #3343
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
from avocado.utils import process | ||
|
||
from virttest import libvirt_version | ||
from virttest import libvirt_vm | ||
from virttest import utils_misc | ||
from virttest import migration | ||
|
@@ -13,6 +14,7 @@ | |
from virttest.libvirt_xml import vm_xml | ||
from virttest.utils_test import libvirt | ||
from virttest.utils_libvirt import libvirt_config | ||
from virttest.utils_libvirt import libvirt_network | ||
|
||
|
||
def run(test, params, env): | ||
|
@@ -24,6 +26,9 @@ def run(test, params, env): | |
3) Copy only the top image for storage migration with backing chain | ||
4) Migrate vm with copy storage - Native TLS(--tls) - inconsistent CN and | ||
server hostname | ||
5) Migrate vm with copy storage over TCP transport - Specified IP | ||
6) Migrate vm with copy storage over TCP transport - Specified IP+Port | ||
7) Migrate vm with copy storage over TCP transport - Specified disks_uri | ||
|
||
:param test: test object | ||
:param params: Dictionary with the test parameters | ||
|
@@ -107,6 +112,7 @@ def prepare_nfs_backingfile(vm, params): | |
log_file = params.get("log_outputs", "/var/log/libvirt/libvirtd.log") | ||
daemon_conf_dict = eval(params.get("daemon_conf_dict", '{}')) | ||
cancel_migration = "yes" == params.get("cancel_migration", "no") | ||
check_disks_port = "yes" == params.get("check_disks_port", "no") | ||
migrate_again = "yes" == params.get("migrate_again", "no") | ||
precreation = "yes" == params.get("precreation", "yes") | ||
tls_recovery = "yes" == params.get("tls_auto_recovery", "yes") | ||
|
@@ -125,6 +131,8 @@ def prepare_nfs_backingfile(vm, params): | |
remove_dict = {} | ||
src_libvirt_file = None | ||
|
||
libvirt_version.is_libvirt_feature_supported(params) | ||
|
||
# params for migration connection | ||
params["virsh_migrate_desturi"] = libvirt_vm.complete_uri( | ||
params.get("migrate_dest_host")) | ||
|
@@ -141,6 +149,8 @@ def prepare_nfs_backingfile(vm, params): | |
extra_args.update({'func_params': params}) | ||
if cancel_migration: | ||
func_name = migration_test.do_cancel | ||
elif check_disks_port: | ||
func_name = libvirt_network.check_established | ||
|
||
# For safety reasons, we'd better back up xmlfile. | ||
vmxml = vm_xml.VMXML.new_from_inactive_dumpxml(vm_name) | ||
|
@@ -150,7 +160,6 @@ def prepare_nfs_backingfile(vm, params): | |
if backingfile_type: | ||
if backingfile_type == "nfs": | ||
prepare_nfs_backingfile(vm, params) | ||
|
||
if extra.count("copy-storage-all") and precreation: | ||
blk_source = vm.get_first_disk_devices()['source'] | ||
vsize = utils_misc.get_image_info(blk_source).get("vsize") | ||
|
@@ -204,7 +213,7 @@ def prepare_nfs_backingfile(vm, params): | |
migration_test.check_result(mig_result, params) | ||
|
||
if migrate_again and status_error: | ||
logging.debug("Sleeping 10 seconds before rerun migration") | ||
logging.debug("Sleeping 10 seconds before rerunning the migration.") | ||
time.sleep(10) | ||
if cancel_migration: | ||
func_name = None | ||
|
@@ -229,12 +238,10 @@ def prepare_nfs_backingfile(vm, params): | |
# Clean VM on destination and source | ||
try: | ||
migration_test.cleanup_dest_vm(vm, vm.connect_uri, dest_uri) | ||
if vm.is_alive(): | ||
vm.destroy(gracefully=False) | ||
except Exception as err: | ||
logging.error(err) | ||
|
||
logging.info("Recovery VM XML configration") | ||
if vm.is_alive(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the purpose to move this part out of try block? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please see my answer above. |
||
vm.destroy(gracefully=False) | ||
orig_config_xml.sync() | ||
|
||
if daemon_conf: | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose to move this part out of try block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When an exception is thrown while destroying a remote VM, the vm on local will not be destroyed in previous code.