Skip to content

Commit

Permalink
Merge pull request autotest#5754 from cliping/stress
Browse files Browse the repository at this point in the history
migration: Update for stress
  • Loading branch information
Yingshun authored Jul 3, 2024
2 parents d27aa67 + 2d49575 commit 890c1bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 33 deletions.
14 changes: 2 additions & 12 deletions libvirt/tests/src/migration/migrate_options_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import time
import math
import re
import threading
import platform
import tempfile
import copy
Expand Down Expand Up @@ -1324,17 +1323,8 @@ def cancel_bg_migration():
test.error("Failed to install tpm2-tools in vm")

if stress_in_vm:
pkg_name = 'stress'
logging.debug("Check if stress tool is installed")
pkg_mgr = utils_package.package_manager(vm_session, pkg_name)
if not pkg_mgr.is_installed(pkg_name):
logging.debug("Stress tool will be installed")
if not pkg_mgr.install():
test.error("Package '%s' installation fails" % pkg_name)

stress_thread = threading.Thread(target=run_stress_in_vm,
args=())
stress_thread.start()
params.update({"stress_package": "stress"})
migration_test.run_stress_in_vm(vm, params)

# Check maxdowntime before migration
if check_default_maxdowntime:
Expand Down
23 changes: 2 additions & 21 deletions libvirt/tests/src/virsh_cmd/domain/virsh_migrate_option_mix.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from virttest import utils_selinux
from virttest import virsh
from virttest import utils_package
from virttest import migration
from virttest.utils_conn import TLSConnection
from virttest.utils_test import libvirt
Expand Down Expand Up @@ -227,26 +226,8 @@ def cleanup_vm(vm, vm_name='', uri=''):
# Prepare for postcopy migration: install and run stress in VM
if postcopy and src_vm_status == "running":
logging.debug("Install and run stress in vm for postcopy migration")
pkg_name = 'stress'

# Get a vm session
logging.debug("Get a vm session")
vm_session = vm.wait_for_login()
if not vm_session:
test.error("Can't get a vm session successfully")

# Install package stress if it is not installed in vm
logging.debug("Check if stress tool is installed for postcopy migration")
pkg_mgr = utils_package.package_manager(vm_session, pkg_name)
if not pkg_mgr.is_installed(pkg_name):
logging.debug("Stress tool will be installed")
if not pkg_mgr.install():
test.error("Package '%s' installation fails" % pkg_name)

# Run stress in vm
logging.debug("Run stress in vm")
stress_args = params.get("stress_args")
vm_session.cmd('stress %s' % stress_args)
params.update({"stress_package": "stress"})
obj_migration.run_stress_in_vm(vm, params)

# Prepare for --xml <updated_xml_file>.
if xml_option:
Expand Down

0 comments on commit 890c1bb

Please sign in to comment.