Skip to content

Commit

Permalink
Merge pull request os-autoinst#18911 from tinawang123/leap
Browse files Browse the repository at this point in the history
Add package conflict workaround for yast migration
  • Loading branch information
jknphy authored and jlausuch committed Mar 22, 2024
2 parents d513b08 + dd2a66e commit dc81cf2
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 3 deletions.
17 changes: 17 additions & 0 deletions schedule/sles4sap/slcs/test_slcs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: test_scls
description: >
SLCS test suite for SLES4SAP.
vars:
BOOTFROM: c
BOOT_HDD_IMAGE: '1'
INSTANCE_ID: '00'
INSTANCE_SID: QAD
INSTANCE_TYPE: ASCS
# Below have to be entered in the OpenQA UI because it doesn't read this YAML
# HDD_1: SLE-%VERSION%-%ARCH%-Build%BUILD%-sles4sap-%DESKTOP%.qcow2
schedule:
- boot/boot_to_desktop
- console/system_prepare
- sles4sap/patterns
- sles4sap/slcs_setup
6 changes: 3 additions & 3 deletions tests/migration/online_migration/yast2_migration.pm
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ sub run {
my $timeout = 7200;
my @tags = qw(
yast2-migration-wrongdigest yast2-migration-packagebroken yast2-migration-internal-error
yast2-migration-finish yast2-migration-notifications
yast2-migration-finish yast2-migration-notifications yast2-migration-sle-packageconflict
);
while (1) {
assert_screen \@tags, $timeout;
Expand All @@ -269,8 +269,8 @@ sub run {
send_key "alt-n";
return;
}
elsif (match_has_tag("yast2-migration-notifications")) {
# close notification window
elsif (match_has_tag("yast2-migration-notifications") || match_has_tag("yast2-migration-sle-packageconflict")) {
# close notification/packageconflict window
send_key "alt-o";
# wait a second after pressing close button
wait_still_screen(1);
Expand Down
133 changes: 133 additions & 0 deletions tests/sles4sap/slcs_setup.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# SUSE's openQA tests
#
# Copyright 2017-2021 SUSE LLC
# SPDX-License-Identifier: FSFAP

# Summary: Perform an unattended installation of SAP NetWeaver
# Requires: ENV variable NW pointing to installation media
# Maintainer: QE-SAP <qe-sap@suse.de>

use base "sles4sap";
use testapi;
use serial_terminal 'select_serial_terminal';
use lockapi;
use hacluster;
use strict;
use warnings;

sub run {
my ($self) = @_;
my ($proto, $path) = $self->fix_path(get_required_var('NW'));
my $instance_type = get_required_var('INSTANCE_TYPE');
my $instance_id = get_required_var('INSTANCE_ID');
my $sid = get_required_var('INSTANCE_SID');
my $hostname = get_var('INSTANCE_ALIAS', '$(hostname)');
my $params_file = "/sapinst/$instance_type.params";
# set timeout as 1800 as workaround for slow nfs
my $timeout = bmwqemu::scale_timeout(1800); # Time out for NetWeaver's sources related commands
my $product_id = undef;

# Set Product ID depending on the type of Instance
if ($instance_type eq 'ASCS') {
$product_id = 'NW_ABAP_ASCS';
}
elsif ($instance_type eq 'ERS') {
$product_id = 'NW_ERS';
}
else {
die "Unknown SAP NetWeaver instance type $instance_type";
}

my @sapoptions = qw(SAPINST_START_GUISERVER=false SAPINST_SKIP_DIALOGS=true SAPINST_SLP_MODE=false IS_HOST_LOCAL_USING_STRING_COMPARE=true);
push @sapoptions, "SAPINST_USE_HOSTNAME=$hostname";
push @sapoptions, "SAPINST_INPUT_PARAMETERS_URL=$params_file";
push @sapoptions, "SAPINST_EXECUTE_PRODUCT_ID=$product_id:NW750.HDB.ABAPHA";

select_serial_terminal;

# This installs Netweaver's ASCS. Start by making sure the correct
# SAP profile and solution are configured in the system
$self->prepare_profile('NETWEAVER');

# Mount media
$self->mount_media($proto, $path, '/sapinst');

# Define a valid hostname/IP address in /etc/hosts, but not in HA
$self->add_hostname_to_hosts if (!get_var('HA_CLUSTER'));

# Use the correct Hostname and InstanceNumber in SAP's params file
# Note: $hostname can be '$(hostname)', so we need to protect with '"'
assert_script_run "sed -i -e \"s/%HOSTNAME%/$hostname/g\" -e 's/%INSTANCE_ID%/$instance_id/g' -e 's/%INSTANCE_SID%/$sid/g' $params_file";

# Create an appropiate start_dir.cd file and an unattended installation directory
my $cmd = 'cd /sapinst ; ls -1 | grep -xv patch | while read d; do if [ -d "$d" -a ! -h "$d" ]; then echo $d; fi ; done | sed -e "s@^@/sapinst/@" ; cd -';
assert_script_run 'mkdir -p /sapinst/unattended';
assert_script_run "($cmd) > /sapinst/unattended/start_dir.cd";
script_run 'cd -';

# Create sapinst group
assert_script_run "groupadd sapinst";
assert_script_run "chgrp -R sapinst /sapinst/unattended";

# setting permissions as per sapnote 2589600
assert_script_run "chmod -Rv 0775 /sapinst/unattended";

# Start the installation
enter_cmd "cd /sapinst/unattended";
$cmd = '../SWPM/sapinst ' . join(' ', @sapoptions) . " | tee sapinst_$instance_type.log";

# Synchronize with other nodes
if (get_var('HA_CLUSTER') && !is_node(1)) {
my $cluster_name = get_cluster_name;
barrier_wait("ASCS_INSTALLED_$cluster_name");
}

validate_script_output(
$cmd,
qr{
# On older SAP versions (known bad: NW75, known good: NW753) we have to
# workaround an installation issue:
# ERS installation on the second node tries to stop the ASCS server
# but that doesn't work because ASCS is running on the first node.
# It's "normal" and documentation says that we have to install ERS on
# the 2nd node in order to have the SAP environment correctly set up.
# Therefore we accept a failing return code and check the output instead.
(
# This is the success pattern for newer versions (which succeed on install).
(
enserver,.EnqueueServer,.GREEN,.Running.*[\r\n]+
msg_server,.MessageServer,.GREEN,.Running.*[\r\n]+
) | (
msg_server,.MessageServer,.GREEN,.Running.*[\r\n]+
enserver,.EnqueueServer,.GREEN,.Running.*[\r\n]+
)
.*[\r\n]+
.*[\r\n]+
Startup.of.instance.${sid}/.*.finished:.\[ACTIVE\]
) | (
# And for older versions we also allow the ASCS stop error message.
# ASCS00 is intentionally not a var, because this error occours on the other node.
stopInstanceRemote.errno=CJS-20081.*[\r\n]+
.*Error.when.stopping.instance.*Cannot.stop.instance.*ASCS00
)
}x,
proceed_on_failure => 1, # this is needed to succeed on faulty SAP NW versions
timeout => $timeout,
title => "start ${sid}",
fail_message => "Instance ${sid}/* (${instance_type}${instance_id}) start did not succeed."
);

$self->upload_nw_install_log;

# Synchronize with other nodes
if (get_var('HA_CLUSTER') && is_node(1)) {
my $cluster_name = get_cluster_name;
barrier_wait("ASCS_INSTALLED_$cluster_name");
}

# Allow SAP Admin user to inform status via $testapi::serialdev
$self->set_sap_info($sid, $instance_id);
$self->ensure_serialdev_permissions_for_sap;
}

1;

0 comments on commit dc81cf2

Please sign in to comment.