From e1df08b3ba1544017ea1e7685ba2756ef748dc85 Mon Sep 17 00:00:00 2001 From: Wang Jun Date: Thu, 10 Nov 2022 17:18:16 +0800 Subject: [PATCH] Add sap autoyast installation profile for sle15 --- .../create_hdd/create_hdd_sap.xml.ep | 303 ++++++++++++++++++ lib/migration.pm | 2 +- lib/registration.pm | 3 +- lib/services/registered_addons.pm | 9 +- lib/utils.pm | 2 +- schedule/migration/migration_offline_sap.yaml | 59 ++++ schedule/migration/migration_online_sap.yaml | 36 +++ schedule/yast/autoyast/autoyast_sap.yaml | 51 +++ tests/console/check_system_info.pm | 1 + 9 files changed, 461 insertions(+), 5 deletions(-) create mode 100644 data/autoyast_sle15/create_hdd/create_hdd_sap.xml.ep create mode 100644 schedule/migration/migration_offline_sap.yaml create mode 100644 schedule/migration/migration_online_sap.yaml create mode 100644 schedule/yast/autoyast/autoyast_sap.yaml diff --git a/data/autoyast_sle15/create_hdd/create_hdd_sap.xml.ep b/data/autoyast_sle15/create_hdd/create_hdd_sap.xml.ep new file mode 100644 index 000000000000..aa20282f6acd --- /dev/null +++ b/data/autoyast_sle15/create_hdd/create_hdd_sap.xml.ep @@ -0,0 +1,303 @@ + + + + + true + true + false + % if ($check_var->('SLE_PRODUCT', 'sles4sap')) { + <%= $get_var->('SCC_REGCODE_SLES4SAP') %> + % } else { + <%= $get_var->('SCC_REGCODE') %> + % } + <%= $get_var->('SCC_URL') %> + % if (keys %$addons) { + + % while (my ($key, $addon) = each (%$addons)) { + + <%= $addon->{name} %> + <%= $addon->{version} %> + <%= $addon->{arch} %> + % if ($key eq 'we' and $check_var->('SLE_PRODUCT', 'sles')) { + <%= $get_var->('SCC_REGCODE_WE') %> + % } + % if ($key eq 'we' and $check_var->('SLE_PRODUCT', 'sled')) { + <%= $get_var->('SCC_REGCODE') %> + % } + % if ($key eq 'rt') { + <%= $get_var->('SCC_REGCODE_RT') %> + % } + % if ($key eq 'ltss') { + <%= $get_var->('SCC_REGCODE_LTSS') %> + % } + % if ($key eq 'sapapp') { + <%= $get_var->('SCC_REGCODE_LTSS') %> + % } + % if ($key eq 'ha') { + % if ($check_var->('SLE_PRODUCT', 'sles4sap')) { + <%= $get_var->('SCC_REGCODE_SLES4SAP') %> + % } else { + <%= $get_var->('SCC_REGCODE_HA') %> + % } + % } + + % } + % if ($check_var->('SLE_PRODUCT', 'sles4sap')) { + + sle-module-sap-applications + {{VERSION}} + {{ARCH}} + + % } + + %} + + + + -1 + + % if ($check_var->('UEFI', '1')) { + grub2-efi + % } + % unless ($check_var->('UEFI', '1')) { + grub2 + % } + + + + % if ($check_var->('BACKEND', 'ipmi') or $check_var->('BACKEND', 'svirt')) { + true + % } + false + + + true + true + true + true + + + + + gpt + true + % if ($check_var->('ARCH', 's390x')) { + true + CT_DISK + + + true + true + ext2 + /boot/zipl + acl,user_xattr + path + 131 + 1 + primary + 500M + + + true + swap + true + swap + uuid + 130 + 2 + primary + 2G + + + true + true + / + uuid + 131 + 3 + primary + max + + + % } + % unless ($check_var->('ARCH', 's390x')) { + + % if ($check_var->('ARCH', 'aarch64') or $check_var->('UEFI', '1')) { + + uuid + true + vfat + true + umask=0002,utf8=true + /boot/efi + 512M + + % } + + true + swap + true + swap + uuid + 130 + false + 2G + + + true + true + btrfs + true + / + uuid + 131 + false + max + + + % } + all + + + + + + dhcp + eth0 + yes + auto + + + + + true + true + + + + true + true + 0 + + + true + true + 0 + + + true + true + 0 + + + true + true + 0 + + + + + + false + bios + + + english-us + + + en_US + + + + auto + + + + % if ($check_var->('SLE_PRODUCT','sles4sap')) { + SLES_SAP + % } else { + <%= uc $get_var->('SLE_PRODUCT') %> + % } + + + + % foreach (values %$addons) { + <%= lc($_->{name}) %>-release + % } + + % if ($check_var->('SLE_PRODUCT', 'sles4sap')) { + sle-module-sap-applications-release + % } + + + % for my $pattern (@$patterns) { + <%= $pattern %> + % } + + + + % if ($check_var->('DESKTOP', 'gnome')) { + graphical + % } + % if ($check_var->('DESKTOP', 'textmode')) { + multi-user + % } + + + + sshd + + + + + UTC + Europe/Berlin + + + % unless ($check_var->('ROOTONLY', '1')) { + + + true + % if ($check_var->('ARCH', 'ppc64le')) { + Bernhard M. Wiedemann + % } + % unless ($check_var->('ARCH', 'ppc64le')) { + bernhard + % } + 100 + /home/bernhard + + + + -1 + 99999 + 0 + 7 + + /bin/bash + 1000 + $6$vYbbuJ9WMriFxGHY$gQ7shLw9ZBsRcPgo6/8KmfDvQ/lCqxW8/WnMoLCoWGdHO6Touush1nhegYfdBbXRpsQuy/FTZZeg7gQL50IbA/ + bernhard + + % } + + + true + root + 0 + /root + + + + + + + + + /bin/bash + 0 + $6$gdDHoMtVLjs4CCzf$2tSvAdgvqrKo84pA59bEjZRh7IGMfv4u0Yl4hrRzPgFPWLd8RXWdn/boT7yM3K3BlTk57qyR0TZ/nMb9rlpzx1 + root + + + diff --git a/lib/migration.pm b/lib/migration.pm index dcda4468af25..32fe28605830 100644 --- a/lib/migration.pm +++ b/lib/migration.pm @@ -93,7 +93,7 @@ sub register_system_in_textmode { register_addons_cmd(); } else { - yast_scc_registration(); + yast_scc_registration(yast2_opts => '--ncurses'); } # Once SCC registration is done, disable IN_PATCH_SLE so it does not interfere # with further calls to accept_addons_license (in upgrade for example) diff --git a/lib/registration.pm b/lib/registration.pm index bac7dbde73c4..d2432f2c1587 100644 --- a/lib/registration.pm +++ b/lib/registration.pm @@ -279,7 +279,8 @@ sub register_product { if (get_var('SMT_URL')) { assert_script_run('SUSEConnect --url ' . get_var('SMT_URL') . ' ' . uc(get_var('SLE_PRODUCT')) . '/' . scc_version(get_var('HDDVERSION')) . '/' . get_var('ARCH'), 200); } else { - assert_script_run('SUSEConnect -r ' . get_required_var('SCC_REGCODE'), 200); + my $scc_reg_code = is_sles4sap ? get_required_var('SCC_REGCODE_SLES4SAP') : get_required_var('SCC_REGCODE'); + assert_script_run('SUSEConnect -r ' . $scc_reg_code, 200); } } diff --git a/lib/services/registered_addons.pm b/lib/services/registered_addons.pm index 530a1200dd2e..f2c86c38f569 100644 --- a/lib/services/registered_addons.pm +++ b/lib/services/registered_addons.pm @@ -29,7 +29,12 @@ sub suseconnect_ls { sub check_registered_system { my ($system) = @_; my $pro = uc get_var('SLE_PRODUCT'); - $pro = 'SLE_' . $pro if ($pro eq 'HPC'); + if ($pro eq 'HPC') { + $pro = 'SLE_' . $pro; + } + elsif ($pro eq 'SLES4SAP') { + $pro = 'SLES_SAP'; + } suseconnect_ls($pro); my $ver = $system =~ s/\-SP/./r; script_run("SUSEConnect -s | grep " . $ver, die_on_timeout => 0); @@ -88,7 +93,7 @@ sub check_suseconnect_cmd { my $status_out = script_output("SUSEConnect --status-text", 120); diag "$status_out"; for (my $i = 0; $i < @addons; $i = $i + 1) { - next if ($addons[$i] =~ /^SLE(S|D|_HPC)$|^sle-module-packagehub-subpackages$/); + next if ($addons[$i] =~ /^SLE(S|D|_HPC|S_SAP)$|^sle-module-packagehub-subpackages$/); diag "$addons[$i]"; die "$addons[$i] is not existed at SUSEConnect --list-extensions" if ($ls_out !~ /Deactivate(.*)$addons[$i]/); die "$addons[$i] is not existed at SUSEConnect --status-text" if ($status_out !~ /$addons[$i]/); diff --git a/lib/utils.pm b/lib/utils.pm index 63111ac51901..bed2b8a51b3a 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -681,7 +681,7 @@ Enables the install DVDs if they were used during the installation. sub zypper_enable_install_dvd { # If DVD Packages is used we need to (re-)enable the local repos # see FATE#325541 - zypper_call('mr -e -l') if (is_sle('15+') and (get_var('ISO_1', '') =~ /SLE-.*-Packages-.*\.iso/ || check_var('FLAVOR', 'Full'))); + zypper_call('mr -e -l') if (is_sle('15+') and (get_var('ISO_1', '') =~ /SLE-.*-Packages-.*\.iso/ || check_var('FLAVOR', 'Full') || ((get_required_var('FLAVOR') =~ /Migration/) && get_var('MEDIA_UPGRADE', '')))); zypper_call 'ref'; } diff --git a/schedule/migration/migration_offline_sap.yaml b/schedule/migration/migration_offline_sap.yaml new file mode 100644 index 000000000000..2bc40f6915fc --- /dev/null +++ b/schedule/migration/migration_offline_sap.yaml @@ -0,0 +1,59 @@ +--- +name: migration_offline_sap +description: > + SAP offline migration with netweaver +vars: + NW: 'nfs://1c119.qa.suse.de/srv/nfs/sap/NW75_CLUSTER' + INSTANCE_ID: '00' + INSTANCE_SID: 'QAD' + INSTANCE_TYPE: 'ASCS' + SHUTDOWN_NEEDS_AUTH: '0' + DM_NEEDS_USERNAME: '1' + ROOTONLY: '1' +schedule: + - '{{handle_bootimg}}' + - installation/bootloader + - installation/welcome + - installation/upgrade_select + - installation/scc_registration + - installation/addon_products_sle + - installation/resolve_dependency_issues + - installation/installation_overview + - installation/disable_grub_timeout + - installation/start_install + - installation/await_install + - installation/logs_from_installation_system + - installation/reboot_after_installation + - '{{handle_reboot}}' + - installation/first_boot + - migration/post_upgrade + - console/system_prepare + - console/consoletest_setup + - console/zypper_lr + - '{{test_sles4sap}}' + - boot/grub_test_snapshot + - boot/snapper_rollback + +conditional_schedule: + handle_bootimg: + BACKEND: + qemu: + - migration/version_switch_origin_system + - boot/boot_to_desktop + - update/patch_sle + - migration/record_disk_info + - migration/reboot_to_upgrade + - migration/version_switch_upgrade_target + handle_reboot: + ARCH: + ppc64le: + - installation/handle_reboot + x86_64: + - installation/grub_test + test_sles4sap: + TEST_SLES4SAP: + 1: + - sles4sap/patterns + - sles4sap/saptune + - sles4sap/netweaver_test_instance + - sles4sap/sapconf diff --git a/schedule/migration/migration_online_sap.yaml b/schedule/migration/migration_online_sap.yaml new file mode 100644 index 000000000000..87e9aa307d43 --- /dev/null +++ b/schedule/migration/migration_online_sap.yaml @@ -0,0 +1,36 @@ +--- +name: migration_online_sap +description: > + SAP online migration with netweaver +vars: + NW: 'nfs://1c119.qa.suse.de/srv/nfs/sap/NW75_CLUSTER' + INSTANCE_ID: '00' + INSTANCE_SID: 'QAD' + INSTANCE_TYPE: 'ASCS' + SHUTDOWN_NEEDS_AUTH: '0' + DM_NEEDS_USERNAME: '1' + ROOTONLY: '1' +schedule: + - migration/version_switch_origin_system + - installation/bootloader + - migration/online_migration/online_migration_setup + - migration/online_migration/register_system + - migration/online_migration/zypper_patch + - installation/install_service + - migration/version_switch_upgrade_target + - migration/online_migration/pre_migration + - migration/online_migration/zypper_migration + - migration/online_migration/post_migration + - console/system_prepare + - '{{test_sles4sap}}' + - boot/grub_test_snapshot + - boot/snapper_rollback + +conditional_schedule: + test_sles4sap: + TEST_SLES4SAP: + 1: + - sles4sap/patterns + - sles4sap/saptune + - sles4sap/netweaver_test_instance + - sles4sap/sapconf diff --git a/schedule/yast/autoyast/autoyast_sap.yaml b/schedule/yast/autoyast/autoyast_sap.yaml new file mode 100644 index 000000000000..0398ab8d4c7d --- /dev/null +++ b/schedule/yast/autoyast/autoyast_sap.yaml @@ -0,0 +1,51 @@ +--- +name: create_hdd_sap +description: > + SAP autoYaST installation and publish qcow for SAP migration standalone + cases. +vars: + AUTOYAST: autoyast_sle15/create_hdd/create_hdd_sap.xml.ep + AUTOYAST_PREPARE_PROFILE: '1' + NW: 'nfs://1c119.qa.suse.de/srv/nfs/sap/NW75_CLUSTER' + INSTANCE_ID: '00' + INSTANCE_SID: 'QAD' + INSTANCE_TYPE: 'ASCS' + QEMU_VIRTIO_RNG: '0' +schedule: + - autoyast/prepare_profile + - installation/bootloader_start + - autoyast/installation + - autoyast/console + - autoyast/login + - autoyast/wicked + - autoyast/repos + - autoyast/clone + - autoyast/logs + - '{{handle_reboot}}' + - '{{test_sles4sap}}' + - console/system_prepare + - console/hostname + - console/force_scheduled_tasks + - '{{handle_deregistration}}' + - shutdown/grub_set_bootargs + - shutdown/cleanup_before_shutdown + - shutdown/shutdown + +conditional_schedule: + handle_reboot: + ARCH: + x86_64: + - autoyast/autoyast_reboot + - installation/grub_test + - installation/first_boot + handle_deregistration: + SCC_DEREGISTER: + 1: + - console/scc_deregistration + test_sles4sap: + TEST_SLES4SAP: + 1: + - console/system_prepare + - sles4sap/patterns + - sles4sap/netweaver_install + - sles4sap/netweaver_test_instance diff --git a/tests/console/check_system_info.pm b/tests/console/check_system_info.pm index 5463202a78a6..0783c258c9e2 100644 --- a/tests/console/check_system_info.pm +++ b/tests/console/check_system_info.pm @@ -49,6 +49,7 @@ sub check_product { SLES => 'SLES' . $myver, SLED => 'SLED' . $myver, SLE_HPC => 'SLE-Product-HPC-' . $myver, + SLES4SAP => 'SLE-' . $myver . '-SAP', leap => "openSUSE-Leap", Media_HPC => $myver . '-HPC', );