-
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 case about destroy vm #5935
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
65 changes: 65 additions & 0 deletions
65
libvirt/tests/cfg/migration/async_ops/destroy_vm_during_performphase.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,65 @@ | ||
- migration.async_ops.destroy_vm_during_performphase: | ||
type = destroy_vm_during_performphase | ||
migration_setup = 'yes' | ||
storage_type = 'nfs' | ||
setup_local_nfs = 'yes' | ||
disk_type = "file" | ||
disk_source_protocol = "netfs" | ||
mnt_path_name = ${nfs_mount_dir} | ||
# 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}" | ||
check_network_accessibility_after_mig = "yes" | ||
migrate_desturi_port = "16509" | ||
migrate_desturi_type = "tcp" | ||
virsh_migrate_desturi = "qemu+tcp://${migrate_dest_host}/system" | ||
status_error = "yes" | ||
migrate_again = "yes" | ||
migrate_again_status_error = "no" | ||
variants: | ||
- p2p: | ||
virsh_migrate_options = '--live --p2p --verbose' | ||
- non_p2p: | ||
virsh_migrate_options = '--live --verbose' | ||
variants: | ||
- with_precopy: | ||
variants: | ||
- destroy_dst_vm_before_vm_paused: | ||
virsh_migrate_extra = "--bandwidth 1" | ||
expected_event_src = ["migration-iteration"] | ||
expected_event_target = ["lifecycle.*Stopped Destroyed"] | ||
expected_dest_state = "nonexist" | ||
expected_src_state = "running" | ||
action_during_mig = [{"func": "virsh.destroy", "after_event": "iteration: '1'", "func_param": {"name": "${main_vm}", "uri": "${virsh_migrate_desturi}"}, "need_sleep_time": "1"}] | ||
err_msg = "domain is not running|Unable to read from socket: Connection reset by peer|domain.* is not processing incoming migration" | ||
virsh_migrate_extra_mig_again = " " | ||
- destroy_dst_vm_after_vm_paused: | ||
migrate_speed = "10" | ||
action_during_mig = [{"func": "virsh.destroy", "after_event": "Suspended Migrated", "func_param": {"name": "${main_vm}", "uri": "${virsh_migrate_desturi}"}}] | ||
virsh_migrate_extra = "--timeout 2 --timeout-suspend" | ||
expected_event_src = ["lifecycle.*Suspended Migrated", "lifecycle.*Resumed Migrated"] | ||
expected_event_target = ["lifecycle.*Stopped Destroyed"] | ||
expected_dest_state = "nonexist" | ||
expected_src_state = "running" | ||
err_msg = "domain is no longer running|Unable to read from socket: Connection reset by peer|domain.* is not processing incoming migration" | ||
- destroy_src_vm: | ||
migrate_speed = "10" | ||
virsh_migrate_extra = "--timeout 2 --timeout-suspend" | ||
expected_event_src = ["lifecycle.*Stopped Destroyed"] | ||
expected_event_target = ["lifecycle.*Started Migrated", "lifecycle.*Stopped Failed"] | ||
expected_dest_state = "nonexist" | ||
expected_src_state = "shut off" | ||
action_during_mig = [{"func": "virsh.destroy", "after_event": "iteration: '1'", "func_param": {"name": "${main_vm}"}}] | ||
err_msg = "domain is not running" |
53 changes: 53 additions & 0 deletions
53
libvirt/tests/src/migration/async_ops/destroy_vm_during_performphase.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,53 @@ | ||
from virttest import virsh | ||
|
||
from virttest.utils_test import libvirt | ||
|
||
from provider.migration import base_steps | ||
from provider.migration import migration_base | ||
|
||
|
||
def run(test, params, env): | ||
""" | ||
This case is to verify that if destroying vm during PerformPhase of precopy | ||
migration, migration will fail. | ||
:param test: test object | ||
:param params: Dictionary with the test parameters | ||
:param env: Dictionary with test environment. | ||
""" | ||
def verify_test(): | ||
""" | ||
Verify steps | ||
""" | ||
expected_dest_state = params.get("expected_dest_state") | ||
expected_src_state = params.get("expected_src_state") | ||
dest_uri = params.get("virsh_migrate_desturi") | ||
|
||
test.log.info("Verify steps.") | ||
if not libvirt.check_vm_state(vm.name, expected_src_state, uri=migration_obj.src_uri): | ||
test.faile("Check vm state on source host fail.") | ||
dest_vm_list = virsh.dom_list(options="--all --persistent", debug=True, uri=dest_uri) | ||
if expected_dest_state == "nonexist": | ||
if vm_name in dest_vm_list.stdout.strip(): | ||
test.fail("%s should not exist." % vm_name) | ||
|
||
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() | ||
virsh_session, remote_virsh_session = migration_base.monitor_event(params) | ||
migration_obj.run_migration() | ||
verify_test() | ||
if migrate_again: | ||
migration_obj.run_migration_again() | ||
migration_obj.verify_default() | ||
migration_base.check_event_output(params, test, virsh_session, remote_virsh_session) | ||
finally: | ||
migration_obj.cleanup_connection() |
Oops, something went wrong.
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.
stupid question ... isn't this typo? added "e" at the end of test.faile.
Also the message is not very descriptive.
I would suggest to give more details.
test.fail(f"Check of expected VM state ({expected_src_state}) on source host failed.")
it would be good to to see actual state of the VM .. not sure if it is also listed anywhere around in log.
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.
@hholoubk , thanks for pointing this out. I submitted a PR to fix this issue. Please take a look, thanks.
#5958
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.
I agree. I will submit a PR to avocado-vt to print actual state of the VM. Thanks.