Skip to content

Commit

Permalink
Upgrade SLE12SP3 to SLE15 with zVM
Browse files Browse the repository at this point in the history
Not use 2 chained jobs anymore to perform upgrade on zVM.
Using autoyast to install origin system and then perform
media upgrade or proxyscc upgrade on it.
Upgrade scenarios could be controlled by different autoyast
profile of origin system.

See: https://progress.opensuse.org/issues/29101
  • Loading branch information
mitiao committed Mar 16, 2018
1 parent dd47648 commit 1acbf00
Show file tree
Hide file tree
Showing 12 changed files with 468 additions and 100 deletions.
254 changes: 254 additions & 0 deletions data/autoyast_sle12/autoyast_sles12sp3_defalut_reg_full.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,254 @@
<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
<general>
<mode>
<confirm config:type="boolean">false</confirm>
</mode>
</general>
<dasd>
<devices config:type="list">
<listentry>
<device>DASD</device>
<dev_name>/dev/dasda</dev_name>
<channel>0.0.0150</channel>
<diag config:type="boolean">false</diag>
</listentry>
</devices>
</dasd>
<report>
<errors>
<log config:type="boolean">true</log>
<show config:type="boolean">true</show>
<timeout config:type="integer">0</timeout>
</errors>
<messages>
<log config:type="boolean">true</log>
<show config:type="boolean">true</show>
<timeout config:type="integer">0</timeout>
</messages>
<warnings>
<log config:type="boolean">true</log>
<show config:type="boolean">true</show>
<timeout config:type="integer">0</timeout>
</warnings>
<yesno_messages>
<log config:type="boolean">true</log>
<show config:type="boolean">true</show>
<timeout config:type="integer">0</timeout>
</yesno_messages>
</report>
<services-manager>
<default_target>graphical</default_target>
<services>
<enable config:type="list">
<service>sshd</service>
</enable>
</services>
</services-manager>
<keyboard>
<keyboard_values>
<delay/>
<discaps config:type="boolean">false</discaps>
<numlock>bios</numlock>
<rate/>
</keyboard_values>
<keymap>english-us</keymap>
</keyboard>
<kdump>
<add_crash_kernel config:type="boolean">true</add_crash_kernel>
<crash_kernel>112M</crash_kernel>
<crash_xen_kernel>112M\&lt;4G</crash_xen_kernel>
<general>
<KDUMPTOOL_FLAGS/>
<KDUMP_COMMANDLINE/>
<KDUMP_COMMANDLINE_APPEND/>
<KDUMP_CONTINUE_ON_ERROR>true</KDUMP_CONTINUE_ON_ERROR>
<KDUMP_COPY_KERNEL>yes</KDUMP_COPY_KERNEL>
<KDUMP_CPUS/>
<KDUMP_DUMPFORMAT>lzo</KDUMP_DUMPFORMAT>
<KDUMP_DUMPLEVEL>31</KDUMP_DUMPLEVEL>
<KDUMP_FREE_DISK_SIZE>64</KDUMP_FREE_DISK_SIZE>
<KDUMP_HOST_KEY/>
<KDUMP_IMMEDIATE_REBOOT>yes</KDUMP_IMMEDIATE_REBOOT>
<KDUMP_KEEP_OLD_DUMPS>5</KDUMP_KEEP_OLD_DUMPS>
<KDUMP_KERNELVER/>
<KDUMP_NETCONFIG>auto</KDUMP_NETCONFIG>
<KDUMP_NET_TIMEOUT>30</KDUMP_NET_TIMEOUT>
<KDUMP_NOTIFICATION_CC/>
<KDUMP_NOTIFICATION_TO/>
<KDUMP_POSTSCRIPT/>
<KDUMP_PRESCRIPT/>
<KDUMP_REQUIRED_PROGRAMS/>
<KDUMP_SAVEDIR>/var/crash</KDUMP_SAVEDIR>
<KDUMP_SMTP_PASSWORD/>
<KDUMP_SMTP_SERVER/>
<KDUMP_SMTP_USER/>
<KDUMP_TRANSFER/>
<KDUMP_VERBOSE>3</KDUMP_VERBOSE>
<KEXEC_OPTIONS/>
</general>
</kdump>
<language>
<language>en_US</language>
<languages/>
</language>
<ntp-client>
<ntp_policy>auto</ntp_policy>
<peers config:type="list"/>
</ntp-client>
<software>
<image/>
<install_recommended config:type="boolean">true</install_recommended>
<instsource/>
<packages config:type="list">
<package>snapper</package>
<package>sles-release</package>
<package>openssh</package>
<package>kexec-tools</package>
<package>kdump</package>
<package>iproute2</package>
<package>grub2</package>
<package>glibc</package>
<package>e2fsprogs</package>
<package>btrfsprogs</package>
<package>SuSEfirewall2</package>
</packages>
<patterns config:type="list">
<pattern>32bit</pattern>
<pattern>Minimal</pattern>
<pattern>apparmor</pattern>
<pattern>base</pattern>
<pattern>documentation</pattern>
<pattern>gnome-basic</pattern>
<pattern>sles-Minimal-32bit</pattern>
<pattern>sles-apparmor-32bit</pattern>
<pattern>sles-base-32bit</pattern>
<pattern>sles-documentation-32bit</pattern>
<pattern>sles-x11-32bit</pattern>
<pattern>x11</pattern>
<pattern>yast2</pattern>
</patterns>
</software>
<suse_register>
<do_registration config:type="boolean">true</do_registration>
<reg_code>25af9a31773574ab</reg_code>
<install_updates config:type="boolean">true</install_updates>
</suse_register>
<networking>
<dhcp_options>
<dhclient_client_id/>
<dhclient_hostname_option>AUTO</dhclient_hostname_option>
</dhcp_options>
<dns>
<dhcp_hostname config:type="boolean">true</dhcp_hostname>
<domain>suse</domain>
<hostname>linux-gspv</hostname>
<nameservers config:type="list">
<nameserver>10.160.0.1</nameserver>
</nameservers>
<resolv_conf_policy>auto</resolv_conf_policy>
<write_hostname config:type="boolean">false</write_hostname>
</dns>
<interfaces config:type="list">
<interface>
<bootproto>static</bootproto>
<device>eth0</device>
<ipaddr>{{HostIP}}</ipaddr>
<netmask>255.255.240.0</netmask>
<prefixlen>20</prefixlen>
<startmode>auto</startmode>
</interface>
<interface>
<bootproto>static</bootproto>
<device>lo</device>
<firewall>no</firewall>
<ipaddr>127.0.0.1</ipaddr>
<netmask>255.0.0.0</netmask>
<network>127.0.0.0</network>
<prefixlen>8</prefixlen>
<startmode>nfsroot</startmode>
<usercontrol>no</usercontrol>
</interface>
</interfaces>
<ipv6 config:type="boolean">true</ipv6>
<keep_install_network config:type="boolean">true</keep_install_network>
<managed config:type="boolean">false</managed>
<net-udev config:type="list">
<rule>
<name>eth0</name>
<rule>KERNELS</rule>
<value>0.0.0700</value>
</rule>
</net-udev>
<routing>
<ipv4_forward config:type="boolean">false</ipv4_forward>
<ipv6_forward config:type="boolean">false</ipv6_forward>
<routes config:type="list">
<route>
<destination>default</destination>
<device>eth0</device>
<gateway>10.161.159.254</gateway>
<netmask>-</netmask>
</route>
</routes>
</routing>
<s390-devices config:type="list">
<listentry>
<chanids>0.0.0700 0.0.0701 0.0.0702</chanids>
<portname>no portname required</portname>
<type>qeth</type>
</listentry>
<listentry>
<chanids> </chanids>
<type/>
</listentry>
</s390-devices>
</networking>
<firewall>
<enable_firewall config:type="boolean">false</enable_firewall>
<start_firewall config:type="boolean">false</start_firewall>
</firewall>
<timezone>
<hwclock>UTC</hwclock>
<timezone>Europe/Berlin</timezone>
</timezone>
<users config:type="list">
<user>
<encrypted config:type="boolean">false</encrypted>
<fullname>Bernhard M. Wiedemann</fullname>
<gid>100</gid>
<home>/home/bernhard</home>
<password_settings>
<expire/>
<flag/>
<inact>-1</inact>
<max>99999</max>
<min>0</min>
<warn>7</warn>
</password_settings>
<shell>/bin/bash</shell>
<uid>1000</uid>
<user_password>nots3cr3t</user_password>
<username>bernhard</username>
</user>
<user>
<encrypted config:type="boolean">false</encrypted>
<fullname>root</fullname>
<gid>0</gid>
<home>/root</home>
<password_settings>
<expire/>
<flag/>
<inact/>
<max/>
<min/>
<warn/>
</password_settings>
<shell>/bin/bash</shell>
<uid>0</uid>
<user_password>nots3cr3t</user_password>
<username>root</username>
</user>
</users>
</profile>
83 changes: 83 additions & 0 deletions lib/utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ use strict;
use testapi qw(is_serial_terminal :DEFAULT);
use mm_network;
use version_utils qw(is_caasp is_leap is_tumbleweed is_sle is_sle12_hdd_in_upgrade sle_version_at_least is_storage_ng);
use serial_terminal 'get_login_message';
use Mojo::UserAgent;

our @EXPORT = qw(
check_console_font
Expand Down Expand Up @@ -71,6 +73,8 @@ our @EXPORT = qw(
ensure_serialdev_permissions
assert_and_click_until_screen_change
exec_and_insert_password
shorten_url
reconnect_s390
);


Expand Down Expand Up @@ -1026,6 +1030,85 @@ sub exec_and_insert_password {
send_key "ret";
}

=head2 shorten_url
shotren url via schort(s.qa.suse.de)
This mainly use for autoyast url shorten to avoid limit of x3270 xedit
=cut
sub shorten_url {
my ($url, %args) = @_;
$args{wishid} //= '';

my $ua = Mojo::UserAgent->new;

my $tx = $ua->post('s.qa.suse.de' => form => {url => $url, wishId => $args{wishid}});
if (my $res = $tx->success) {
return $res->body;
}
else {
my $err = $tx->error;
die "Shorten url got $err->{code} response: $err->{message}" if $err->{code};
die "Connection error when shorten url: $err->{message}";
}
}

sub _handle_login_not_found {
my ($str) = @_;
diag 'Expected welcome message not found, investigating bootup log content: ' . $str;
diag 'Checking for bootloader';
diag "WARNING: bootloader grub menue not found" unless $str =~ /GNU GRUB/;
diag 'Checking for ssh daemon';
diag "WARNING: ssh daemon in SUT is not available" unless $str =~ /Started OpenSSH Daemon/;
diag 'Checking for any welcome message';
die "no welcome message found, system seems to have never passed the bootloader (stuck or not enough waiting time)" unless $str =~ /Welcome to/;
diag 'Checking login target reached';
die "login target not reached" unless $str =~ /Reached target Login Prompts/;
diag 'Checking for login prompt';
die "no login prompt found" unless $str =~ /login:/;
diag 'Checking for known failure';
return record_soft_failure 'bsc#1040606 - incomplete message when LeanOS is implicitly selected instead of SLES'
if $str =~ /Welcome to SUSE Linux Enterprise 15/;
die "unknown error, system couldn't boot";
}

=head2 reconnect_s390
After each reboot we have to reconnect to s390 host
=cut
sub reconnect_s390 {
my (%args) = @_;
$args{timeout} //= 300;

my $login_ready = get_login_message();
console('installation')->disable_vnc_stalls;

# different behaviour for z/VM and z/KVM
if (check_var('BACKEND', 's390x')) {
my $r;
eval { $r = console('x3270')->expect_3270(output_delim => $login_ready, timeout => $args{timeout}); };
if ($@) {
my $ret = $@;
_handle_login_not_found($ret);
}
reset_consoles;

# reconnect the ssh for serial grab
select_console('iucvconn');
}
else {
my $r = wait_serial($login_ready, 300);
if ($r =~ qr/Welcome to SUSE Linux Enterprise 15/) {
record_soft_failure('bsc#1040606');
}
elsif (is_sle) {
$r =~ qr/Welcome to SUSE Linux Enterprise Server/ || die "Correct welcome string not found";
}
}

# SLE >= 15 does not offer auto-started VNC server in SUT, only login prompt as in textmode
if (!check_var('DESKTOP', 'textmode') && !sle_version_at_least('15')) {
select_console('x11', await_console => 0);
}
}

1;

# vim: sw=4 et
Loading

0 comments on commit 1acbf00

Please sign in to comment.