From d464c4fc6c1365ee9f2b13dcf91183d9ff56f841 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 16 Mar 2021 16:08:35 -0400 Subject: [PATCH 1/5] Add support for SLES15 SP2 --- xCAT-server/lib/perl/xCAT/Template.pm | 3 +++ xCAT-server/share/xcat/install/sles/compute.sle15.pkglist | 1 + 2 files changed, 4 insertions(+) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 0da104fa0..bbfec6d95 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -342,6 +342,9 @@ sub subvars { $product_dir=$subdir; if($subdir =~ /^Module-/){ $product_name="sle-".lc($subdir); + }elsif($subdir =~ /^Product-SUSE-Manager-Server|^Product-SLES_SAP/){ + # Skip product directories that are not "SLES", causes conflict on SLE15.2 + next; }elsif($subdir =~ /^Product-/){ $subdir=~s/Product-//; $product_name=$subdir; diff --git a/xCAT-server/share/xcat/install/sles/compute.sle15.pkglist b/xCAT-server/share/xcat/install/sles/compute.sle15.pkglist index 1e72952ac..9fee9c520 100644 --- a/xCAT-server/share/xcat/install/sles/compute.sle15.pkglist +++ b/xCAT-server/share/xcat/install/sles/compute.sle15.pkglist @@ -6,3 +6,4 @@ insserv-compat net-tools-deprecated rsyslog nfs-client +wget From 42ffdddf9b3007e23974e32dd84987398beaa44b Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 16 Mar 2021 17:33:13 -0400 Subject: [PATCH 2/5] For x86 also need to exclude Product-SLED --- xCAT-server/lib/perl/xCAT/Template.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index bbfec6d95..1069de7d7 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -342,7 +342,7 @@ sub subvars { $product_dir=$subdir; if($subdir =~ /^Module-/){ $product_name="sle-".lc($subdir); - }elsif($subdir =~ /^Product-SUSE-Manager-Server|^Product-SLES_SAP/){ + }elsif($subdir =~ /^Product-SUSE-Manager-Server|^Product-SLES_SAP|^Product-SLED/){ # Skip product directories that are not "SLES", causes conflict on SLE15.2 next; }elsif($subdir =~ /^Product-/){ From e6a7a2d33250ca55ff41022fa3c1cf326026d8f2 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 18 Mar 2021 16:59:23 -0400 Subject: [PATCH 3/5] Add repositories for diskless image generation --- xCAT-server/share/xcat/netboot/sles/genimage | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 049c1b681..7f299e84b 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -299,12 +299,20 @@ unless ($onlyinitrd) { if (-d "$dir/1") { $ddir .= "/1"; } - system("zypper -R $rootimg_dir $non_interactive ar file:$ddir $osver-$i"); - $i++; - if (-d "$dir/2") { - $ddir = $dir . "/2"; + if ($osver =~ "^sle15.2") { + # For SLE15 SP2 need 'baseurl' to point to a 3 module subdirs + system("zypper -R $rootimg_dir $non_interactive ar file:$ddir/Product-SLES $osver-$i-Product-SLES"); + system("zypper -R $rootimg_dir $non_interactive ar file:$ddir/Module-Basesystem $osver-$i-Module-Basesystem"); + system("zypper -R $rootimg_dir $non_interactive ar file:$ddir/Module-Legacy $osver-$i-Module-Legacy"); + + } else { system("zypper -R $rootimg_dir $non_interactive ar file:$ddir $osver-$i"); $i++; + if (-d "$dir/2") { + $ddir = $dir . "/2"; + system("zypper -R $rootimg_dir $non_interactive ar file:$ddir $osver-$i"); + $i++; + } } } From 237c7fee91001e0366e1ad8f021f7d96198df62b Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 19 Mar 2021 15:56:07 -0400 Subject: [PATCH 4/5] Additional packages locations for diskless image generation --- xCAT-server/share/xcat/netboot/sles/genimage | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 7f299e84b..1e944441d 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -2006,7 +2006,13 @@ sub generic_post { # This function is meant to leave the image in a state approx print $cfgfile "NETWORKING=yes\n"; close($cfgfile); - # SLE15 has a symlink to /run/netconfig/resolv.conf and does not need a dummy file + # SLE15.2 has a symlink to /run/netconfig/resolv.conf but still need a dummy file + if (-l "$rootimg_dir/etc/resolv.conf" && $osver =~ "15.2") { + # Remove resolv.conf, so that link is gone and code below will + # create a dummy file + unlink("$rootimg_dir/etc/resolv.conf"); + } + # SLE15.0 has a symlink to /run/netconfig/resolv.conf and does not need a dummy file if (! -l "$rootimg_dir/etc/resolv.conf") { open($cfgfile, ">", "$rootimg_dir/etc/resolv.conf"); print $cfgfile "#Dummy resolv.conf to make boot cleaner"; From c2220cd6958abe49763694089e5907a3d351257c Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 26 Mar 2021 12:34:50 -0400 Subject: [PATCH 5/5] Eliminate specifically checking for OS version --- xCAT-server/share/xcat/netboot/sles/genimage | 23 +++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 1e944441d..c3f623ae9 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -299,8 +299,8 @@ unless ($onlyinitrd) { if (-d "$dir/1") { $ddir .= "/1"; } - if ($osver =~ "^sle15.2") { - # For SLE15 SP2 need 'baseurl' to point to a 3 module subdirs + if (-d "$ddir/Product-SLES" && -d "$ddir/Module-Basesystem" && -d "$ddir/Module-Legacy") { + # If "Modile" and "Product" directories are there, use them for package repositories system("zypper -R $rootimg_dir $non_interactive ar file:$ddir/Product-SLES $osver-$i-Product-SLES"); system("zypper -R $rootimg_dir $non_interactive ar file:$ddir/Module-Basesystem $osver-$i-Module-Basesystem"); system("zypper -R $rootimg_dir $non_interactive ar file:$ddir/Module-Legacy $osver-$i-Module-Legacy"); @@ -2006,14 +2006,21 @@ sub generic_post { # This function is meant to leave the image in a state approx print $cfgfile "NETWORKING=yes\n"; close($cfgfile); - # SLE15.2 has a symlink to /run/netconfig/resolv.conf but still need a dummy file - if (-l "$rootimg_dir/etc/resolv.conf" && $osver =~ "15.2") { - # Remove resolv.conf, so that link is gone and code below will - # create a dummy file - unlink("$rootimg_dir/etc/resolv.conf"); + # Check resolv.conf file. + # If it is a link and link leads to an empty file, remove that link + # If it is a link and link leads to a non emply file, leave it alone + # If it is not a link, fill it it with some "dummy" text + if (-l "$rootimg_dir/etc/resolv.conf" ) { + my $link_file = readlink "$rootimg_dir/etc/resolv.conf"; + if (-z "$rootimg_dir/$link_file") { + # Link leading to an empty file + # Remove resolv.conf, so that link is gone and code below will + # create a dummy file + unlink("$rootimg_dir/etc/resolv.conf"); + } } - # SLE15.0 has a symlink to /run/netconfig/resolv.conf and does not need a dummy file if (! -l "$rootimg_dir/etc/resolv.conf") { + # Not a link, fill in with "dummy" text open($cfgfile, ">", "$rootimg_dir/etc/resolv.conf"); print $cfgfile "#Dummy resolv.conf to make boot cleaner"; close($cfgfile);