Skip to content
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

kernel: Add support for transactional systems to update_kernel module #18012

Merged
merged 3 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
czerw marked this conversation as resolved.
Show resolved Hide resolved
# 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;
czerw marked this conversation as resolved.
Show resolved Hide resolved
} 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.");
czerw marked this conversation as resolved.
Show resolved Hide resolved
} 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);
}
Comment on lines +114 to +121
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess instances of this is where the follow ups to https://progress.opensuse.org/issues/117028 are to be added, right?

something to note would be that patch is also something that has to be there too.

@fgerling Can you add a ticket to our backlog about this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something to note would be that patch is also something that has to be there too.

I made comment in mentioned ticket regarding patch.

}
}

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