Skip to content

Commit

Permalink
Support in place upgrade from RHEL9 to RHEL10
Browse files Browse the repository at this point in the history
Signed-off-by: Miriam Deng <[email protected]>
  • Loading branch information
MiriamDeng committed Nov 5, 2024
1 parent 9a57983 commit afe9f4b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
5 changes: 5 additions & 0 deletions qemu/tests/cfg/in_place_upgrade.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@
# com_ins_leapp = "yum install leapp-upgrade"
- upstream_install:
com_install = "no"
com_ins_leapp_9 = "dnf install leapp-upgrade-el9toel10 -y"
variants:
- without_rhsm:
rhsm_type = "no_rhsm"
- with_rhsm:
rhsm_type = "rhsm"
- without_rhsm_rhel8_to_rhel9:
rhsm_type = "no_rhsm"
pre_upgrade_no_rhsm = "leapp preupgrade --debug --no-rhsm"
Expand Down
36 changes: 20 additions & 16 deletions qemu/tests/in_place_upgrade.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import logging

from avocado.utils import process
from virttest import data_dir, error_context, storage

from virttest import data_dir
from virttest import error_context
from virttest import storage
from avocado.utils import process
from provider.in_place_upgrade_base import IpuTest

LOG_JOB = logging.getLogger("avocado.test")

LOG_JOB = logging.getLogger('avocado.test')


@error_context.context_aware
Expand Down Expand Up @@ -44,7 +47,8 @@ def run(test, params, env):
pre_release = params.get("pre_release")
release_chk = params.get("release_check")
if pre_release not in upgrade_test.run_guest_cmd(release_chk):
test.cancel("your image is not for rhel 8 product, please check")
test.cancel("your image is not for rhel %s, please check"
% pre_release)
post_release = params.get("post_release")
# create an assistant user
upgrade_test.create_ipuser(test)
Expand All @@ -62,7 +66,10 @@ def run(test, params, env):
# this parameter should contain the repo files,
# by which you can upgrade old system to the newer version
# before you really do in place upgade
old_custom_repo = params.get("old_custom_internal_repo")
if pre_release == "release 9":
old_custom_repo = params.get("old_custom_internal_repo_9")
else:
old_custom_repo = params.get("old_custom_internal_repo")
if params.get_boolean("com_install"):
upgrade_test.run_guest_cmd(params.get("com_ins_leapp"))
upgrade_test.run_guest_cmd(params.get("prepare_env"))
Expand Down Expand Up @@ -93,22 +100,18 @@ def run(test, params, env):
ipu_timeout = int(params.get("ipu_after_timeout"))
usr = params.get("user_assistant")
passwd = params.get("user_assistant_pw")
upgrade_test.session = vm.wait_for_login(
timeout=ipu_timeout, username=usr, password=passwd
)
upgrade_test.session = vm.wait_for_login(timeout=ipu_timeout,
username=usr, password=passwd)
# restore settings in the guest
upgrade_test.post_upgrade_restore(test)
# post checking
upgrade_test.post_upgrade_check(test, post_release)
post_rhel_ver = upgrade_test.run_guest_cmd(check_rhel_ver)
vm.verify_kernel_crash()
if params.get("device_cio_free_check_cmd"):
cio_status = str(
upgrade_test.session.cmd_status_output(
params.get("device_cio_free_check_cmd")
)
)
if "inactive" in cio_status:
cio_status = str(upgrade_test.session.cmd_status_output(
params.get("device_cio_free_check_cmd")))
if 'inactive' in cio_status:
test.fail("device_cio_free is not enabled after upgrading")
finally:
vm.graceful_shutdown(timeout=300)
Expand All @@ -118,6 +121,7 @@ def run(test, params, env):
image_path = params.get("images_base_dir", data_dir.get_data_dir())
old_name = storage.get_image_filename(image_params, image_path)
upgraded_name = old_name.replace(pre_rhel_ver, post_rhel_ver)
process.run(params.get("image_clone_command") % (old_name, upgraded_name))
process.run(params.get("image_clone_command") %
(old_name, upgraded_name))
except Exception as error:
test.log.warning("Failed to rename upgraded image:%s", str(error))
test.log.warning("Failed to rename upgraded image:%s" % str(error))

0 comments on commit afe9f4b

Please sign in to comment.