Skip to content

Commit

Permalink
Merge pull request #18012 from czerw/sle-micro-maintenance
Browse files Browse the repository at this point in the history
kernel: Add support for transactional systems to update_kernel module
  • Loading branch information
czerw committed Oct 24, 2023
2 parents 63f8b71 + f312e88 commit 1501176
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 21 deletions.
12 changes: 6 additions & 6 deletions lib/bootloader_setup.pm
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,18 @@ sub add_custom_grub_entries {
if (check_var('VERSION', '12-SP4') && is_aarch64) {
$distro = 'SLE-HPC' . ' \\?' . get_required_var('VERSION');
}
elsif (check_var('SLE_PRODUCT', 'slert')) {
$distro = "SLE_RT" . ' \\?' . get_required_var('VERSION');
}
elsif (is_sle()) {
$distro = "SLES" . ' \\?' . get_required_var('VERSION');
}
elsif (is_alp()) {
$distro = "ALP";
}
elsif (is_sle_micro()) {
$distro = "SLE Micro";
}
elsif (check_var('SLE_PRODUCT', 'slert')) {
$distro = "SLE_RT" . ' \\?' . get_required_var('VERSION');
}
elsif (is_sle()) {
$distro = "SLES" . ' \\?' . get_required_var('VERSION');
}

bmwqemu::diag("Trying to trigger purging old kernels before changing grub menu");
script_run('/sbin/purge-kernels');
Expand Down
29 changes: 19 additions & 10 deletions lib/utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use warnings;
use testapi qw(is_serial_terminal :DEFAULT);
use lockapi 'mutex_wait';
use mm_network;
use version_utils qw(is_sle_micro is_microos is_leap is_public_cloud is_sle is_sle12_hdd_in_upgrade is_storage_ng is_jeos package_version_cmp);
use version_utils qw(is_sle_micro is_microos is_leap is_public_cloud is_sle is_sle12_hdd_in_upgrade is_storage_ng is_jeos package_version_cmp is_transactional);
use Utils::Architectures;
use Utils::Systemd qw(systemctl disable_and_stop_service);
use Utils::Backends;
Expand Down Expand Up @@ -775,17 +775,26 @@ sub fully_patch_system {
return;
}

# Repeatedly call zypper patch until it returns something other than 103 (package manager updates)
my $ret = 1;
# Add -q to reduce the unnecessary log output.
# Reduce the pressure of serial port when running hyperv test with sle15.
# poo#115454
my $zypp_opt = check_var('VIRSH_VMM_FAMILY', 'hyperv') ? '-q' : '';
for (1 .. 3) {
$ret = zypper_call("$zypp_opt patch --with-interactive -l", exitcode => [0, 4, 102, 103], timeout => 6000);
last if $ret != 103;
if (is_transactional) {
# Update package manager first, not possible to detect package manager update bsc#1216504
transactional::trup_call('patch');
transactional::reboot_on_changes();
# Continue with patch
transactional::trup_call('patch');
transactional::reboot_on_changes();
return;
} else {
# Repeatedly call zypper patch until it returns something other than 103 (package manager updates)
# Add -q to reduce the unnecessary log output.
# Reduce the pressure of serial port when running hyperv test with sle15.
# poo#115454
my $zypp_opt = check_var('VIRSH_VMM_FAMILY', 'hyperv') ? '-q' : '';
for (1 .. 3) {
$ret = zypper_call("$zypp_opt patch --with-interactive -l", exitcode => [0, 4, 102, 103], timeout => 6000);
last if $ret != 103;
}
}

if (($ret == 4) && is_sle('>=12') && is_sle('<15')) {
record_soft_failure 'bsc#1176655 openQA test fails in patch_sle - binutils-devel-2.31-9.29.1.aarch64 requires binutils = 2.31-9.29.1';
my $para = '';
Expand Down
24 changes: 19 additions & 5 deletions tests/kernel/update_kernel.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ use base 'opensusebasetest';
use testapi;
use serial_terminal 'select_serial_terminal';
use utils;
use version_utils qw(is_sle package_version_cmp);
use version_utils qw(is_sle is_transactional package_version_cmp);
use qam;
use kernel 'remove_kernel_packages';
use klp;
use power_action_utils 'power_action';
use repo_tools 'add_qa_head_repo';
use Utils::Backends;
use LTP::utils;
use transactional;

sub check_kernel_package {
my $kernel_name = shift;
Expand Down Expand Up @@ -85,7 +86,11 @@ sub update_kernel {
fully_patch_system;

if (check_var('SLE_PRODUCT', 'slert')) {
zypper_call('in kernel-devel-rt');
if (is_transactional) {
record_info("There is no kernel-devel-rt available on transactional system.");
} else {
zypper_call('in kernel-devel-rt');
}
}
elsif (is_sle('12+')) {
zypper_call('in kernel-devel');
Expand All @@ -106,7 +111,14 @@ sub update_kernel {
}
else {
# Use single patch or patch list
zypper_call("in -l -t patch $patches", exitcode => [0, 102, 103], log => 'zypper.log', timeout => 1400);
if (is_transactional) {
# Proceed with transactional-update patch
trup_call("patch");
# Reboot system after patch, to make sure that further checks are done on updated system
reboot_on_changes;
} else {
zypper_call("in -l -t patch $patches", exitcode => [0, 102, 103], log => 'zypper.log', timeout => 1400);
}
}
}

Expand Down Expand Up @@ -388,7 +400,7 @@ sub boot_to_console {
sub run {
my $self = shift;

if (is_ipmi && get_var('LTP_BAREMETAL')) {
if ((is_ipmi && get_var('LTP_BAREMETAL')) || is_transactional) {
# System is already booted after installation, just switch terminal
select_serial_terminal;
} else {
Expand Down Expand Up @@ -454,7 +466,9 @@ sub run {

check_kernel_package($kernel_package);

if (!get_var('KGRAFT')) {
if (is_transactional) {
reboot_on_changes;
} elsif (!get_var('KGRAFT')) {
power_action('reboot', textmode => 1);
$self->wait_boot if get_var('LTP_BAREMETAL');
}
Expand Down

0 comments on commit 1501176

Please sign in to comment.