Debian: Factor out di_special_kernel from ts-host-install
PATCH 1/11 Debian: Factor out di_special_kernel from ts-host-install
No functional change.
--- Osstest/Debian.pm | 31 +++++++++++++++++++++++++++++++ ts-host-install | 29 +++++------------------------ 2 files changed, 36 insertions(+), 24 deletions(-)
Osstest/Debian.pm +31 -0
@@ -34,6 +34,7 @@ BEGIN { $VERSION = 1.00; @ISA = qw(Exporter); @EXPORT = qw(debian_boot_setup + di_special_kernel setupboot_bootloader_edited_rune debian_overlays debian_guest_suite debian_guest_di_version
@@ -1043,6 +1044,36 @@ END return create_webfile($ho, "preseed$sfx", $preseed_file); } +sub di_special_kernel ($$$) { + my ($ho, $d_i, $fn) = @_; + # calls $fn->($kernel, $cpio) # either or both may be undef + foreach my $kp (keys %{ $ho->{Flags} }) { + my $kernel; + # Backwards compatibility + $kp = "need-kernel-deb-wheezy-backports" if $kp eq "need-kernel-deb-armmp"; + $kp =~ s/need-kernel-deb-$ho->{Suite}-// or next; + my $kern= "$ho->{Tftp}{Path}/$d_i/linux.$kp"; + if (stat $kern) { + logm("using kernel from: $kern"); + $kernel = "/$d_i/linux.$kp"; + } elsif ($! == &ENOENT) { + logm("warning: no kernel found for $kp at $kern"); + } else { + die "$kp $kern $!"; + } + my $cpio= "$ho->{Tftp}{Path}/$d_i/$kp.cpio.gz"; + if (stat $cpio) { + logm("using kernel modules from: $cpio"); + } elsif ($! == &ENOENT) { + logm("warning: no kernel module cpio found for $kp at $cpio"); + $cpio = undef; + } else { + die "$kp $cpio $!"; + } + $fn->($kernel, $cpio); + } +} + sub preseed_create ($$;@) { my ($ho, $sfx, %xopts) = @_;
ts-host-install +5 -24
@@ -181,30 +181,11 @@ sub setup_netboot_firstboot($) { } } - foreach my $kp (keys %{ $ho->{Flags} }) { - # Backwards compatibility - $kp = "need-kernel-deb-wheezy-backports" if $kp eq "need-kernel-deb-armmp"; - $kp =~ s/need-kernel-deb-$ho->{Suite}-// or next; - my $kern= "$ho->{Tftp}{Path}/$d_i/linux.$kp"; - if (stat $kern) { - logm("using kernel from: $kern"); - $kernel = "/$d_i/linux.$kp"; - } elsif ($! == &ENOENT) { - logm("warning: no kernel found for $kp at $kern"); - } else { - die "$kp $kern $!"; - } - - my $cpio= "$ho->{Tftp}{Path}/$d_i/$kp.cpio.gz"; - if (stat $cpio) { - logm("using kernel modules from: $cpio"); - push @initrds, $cpio; - } elsif ($! == &ENOENT) { - logm("warning: no kernel module cpio found for $kp at $cpio"); - } else { - die "$kp $cpio $!"; - } - } + di_special_kernel($ho, $d_i, sub { + my ($k, $cpio) = @_; + $kernel = $k if defined $k; + push @initrds, $cpio if defined $cpio; + }); $kernel = "/$d_i/linux" unless $kernel;
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 2/11 di_special_kernel: Pass $kp to $fn
Adjust the one current caller. No functional change
--- Osstest/Debian.pm | 4 ++-- ts-host-install | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
Osstest/Debian.pm +2 -2
@@ -1046,7 +1046,7 @@ END sub di_special_kernel ($$$) { my ($ho, $d_i, $fn) = @_; - # calls $fn->($kernel, $cpio) # either or both may be undef + # calls $fn->($kp, $kernel, $cpio) # $kernel and/or $cpio may be undef foreach my $kp (keys %{ $ho->{Flags} }) { my $kernel; # Backwards compatibility
@@ -1070,7 +1070,7 @@ sub di_special_kernel ($$$) { } else { die "$kp $cpio $!"; } - $fn->($kernel, $cpio); + $fn->($kp, $kernel, $cpio); } }
ts-host-install +1 -1
@@ -182,7 +182,7 @@ sub setup_netboot_firstboot($) { } di_special_kernel($ho, $d_i, sub { - my ($k, $cpio) = @_; + my ($kp, $k, $cpio) = @_; $kernel = $k if defined $k; push @initrds, $cpio if defined $cpio; });
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 3/11 di_special_kernel: Replace open-coding in ts-host-install
In reply to Ian JacksonThe effect is simply to reuse the loop in di_special_kernel. The extra tests etc. to compute $k and $c in di_special_kernel are of no import here, and are harmless. We have already called di_special_kernel so if it was going to fail due to this extra computation, it would do so earlier.
No overall functional change.
--- ts-host-install | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
ts-host-install +3 -6
@@ -214,14 +214,11 @@ END my %xopts; - foreach my $kp (keys %{ $ho->{Flags} }) { - # Backwards compatibility - $kp = "need-kernel-deb-wheezy-backports" if $kp eq "need-kernel-deb-armmp"; - $kp =~ s/need-kernel-deb-$ho->{Suite}-// or next; - + di_special_kernel($ho, $d_i, sub { + my ($kp,$k,$c) = @_; $xopts{dtbs} = "/$d_i/$kp-dtbs" if -e "$ho->{Tftp}{Path}/$d_i/$kp-dtbs"; - } + }); $xopts{dtbs} = "/$d_i/dtbs" if !$xopts{dtbs} && -e "$ho->{Tftp}{Path}/$d_i/dtbs";
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 4/11 di_installer_path: Break out of preseed_create
In reply to Ian JacksonNo functional change.
--- Osstest/Debian.pm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
Osstest/Debian.pm +12 -4
@@ -34,7 +34,7 @@ BEGIN { $VERSION = 1.00; @ISA = qw(Exporter); @EXPORT = qw(debian_boot_setup - di_special_kernel + di_installer_path di_special_kernel setupboot_bootloader_edited_rune debian_overlays debian_guest_suite debian_guest_di_version
@@ -1044,6 +1044,16 @@ END return create_webfile($ho, "preseed$sfx", $preseed_file); } +sub di_installer_path ($) { + # returns a path within $ho->{Tftp}{Path}, which is therefore + # useable for constructing host paths as well as guest paths + my ($ho) = @_; + + return $ho->{Tftp}{DiBase}.'/'.$r{arch}.'/'. + ($ho->{DiVersion} // cfg_tftp_di_version($ho->{Suite})) + .'-'.$ho->{Suite}; +} + sub di_special_kernel ($$$) { my ($ho, $d_i, $fn) = @_; # calls $fn->($kp, $kernel, $cpio) # $kernel and/or $cpio may be undef
@@ -1080,9 +1090,7 @@ sub preseed_create ($$;@) { my $disk= $xopts{DiskDevice} || '/dev/sda'; my $suite= $ho->{Suite}; - my $d_i= $ho->{Tftp}{Path}.'/'.$ho->{Tftp}{DiBase}.'/'.$r{arch}.'/'. - ($ho->{DiVersion} // cfg_tftp_di_version($ho->{Suite})) - .'-'.$ho->{Suite}; + my $d_i = $ho->{Tftp}{Path}.'/'.di_installer_path($ho); preseed_hook_installscript($ho, $sfx, '/lib/partman/init.d', '000override-parted-devices', <<END);
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 5/11 di_installer_path: Use in ts-host-install
In reply to Ian JacksonNo significant functional change. We now honour cfg_tftp_di_version if the $ho doesn't have the information.
--- ts-host-install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ts-host-install +1 -1
@@ -158,7 +158,7 @@ END sub setup_netboot_firstboot($) { my ($ps_url) = @_; - my $d_i= $ho->{Tftp}{DiBase}.'/'.$r{arch}.'/'.$ho->{DiVersion}.'-'.$ho->{Suite}; + my $d_i= di_installer_path($ho); my @dicmdline= qw(vga=normal); push @dicmdline, di_installcmdline_core($ho, $ps_url, %xopts);
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 6/11 di_special_kernel: Use di_installer_path
In reply to Ian JacksonThis avoids the caller having to supply $d_i. This is good because there is a site we want to call this from which uses that name for a different value!
No functional change.
--- Osstest/Debian.pm | 5 +++-- ts-host-install | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-)
Osstest/Debian.pm +3 -2
@@ -1054,9 +1054,10 @@ sub di_installer_path ($) { .'-'.$ho->{Suite}; } -sub di_special_kernel ($$$) { - my ($ho, $d_i, $fn) = @_; +sub di_special_kernel ($$) { + my ($ho, $fn) = @_; # calls $fn->($kp, $kernel, $cpio) # $kernel and/or $cpio may be undef + my $d_i = di_installer_path($ho); foreach my $kp (keys %{ $ho->{Flags} }) { my $kernel; # Backwards compatibility
ts-host-install +2 -2
@@ -181,7 +181,7 @@ sub setup_netboot_firstboot($) { } } - di_special_kernel($ho, $d_i, sub { + di_special_kernel($ho, sub { my ($kp, $k, $cpio) = @_; $kernel = $k if defined $k; push @initrds, $cpio if defined $cpio;
@@ -214,7 +214,7 @@ END my %xopts; - di_special_kernel($ho, $d_i, sub { + di_special_kernel($ho, sub { my ($kp,$k,$c) = @_; $xopts{dtbs} = "/$d_i/$kp-dtbs" if -e "$ho->{Tftp}{Path}/$d_i/$kp-dtbs";
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 7/11 di_special_kernel: Provide $tp; Regularise $kernel, $cpio
In reply to Ian JacksonMake both of these paths relative to $ho->{Tftp}{Path}. Previously $kernel was relative to that, but $cpio contained it.
Adjust all callers, so no functional change.
--- Osstest/Debian.pm | 28 ++++++++++++++++------------ ts-host-install | 8 ++++---- 2 files changed, 20 insertions(+), 16 deletions(-)
Osstest/Debian.pm +16 -12
@@ -1056,32 +1056,36 @@ sub di_installer_path ($) { sub di_special_kernel ($$) { my ($ho, $fn) = @_; - # calls $fn->($kp, $kernel, $cpio) # $kernel and/or $cpio may be undef + # calls $fn->($kp, $tp, $kernel, $cpio) + # $kp is "special" or "backports" or similar + # $tp is $ho->{Tftp}{Path}, for convenience + # $kernel and/or $cpio may be undef, and do not contain $tp my $d_i = di_installer_path($ho); + my $tp = $ho->{Tftp}{Path}; foreach my $kp (keys %{ $ho->{Flags} }) { my $kernel; # Backwards compatibility $kp = "need-kernel-deb-wheezy-backports" if $kp eq "need-kernel-deb-armmp"; $kp =~ s/need-kernel-deb-$ho->{Suite}-// or next; - my $kern= "$ho->{Tftp}{Path}/$d_i/linux.$kp"; - if (stat $kern) { - logm("using kernel from: $kern"); - $kernel = "/$d_i/linux.$kp"; + my $kernel= "$d_i/linux.$kp"; + if (stat "$tp/$kernel") { + logm("using kernel from: $tp/$kernel"); } elsif ($! == &ENOENT) { - logm("warning: no kernel found for $kp at $kern"); + logm("warning: no kernel found for $kp at $tp/$kernel"); + $kernel = undef; } else { - die "$kp $kern $!"; + die "$kp $kernel $!"; } - my $cpio= "$ho->{Tftp}{Path}/$d_i/$kp.cpio.gz"; - if (stat $cpio) { - logm("using kernel modules from: $cpio"); + my $cpio= "$d_i/$kp.cpio.gz"; + if (stat "$tp/$cpio") { + logm("using kernel modules from: $tp/$cpio"); } elsif ($! == &ENOENT) { - logm("warning: no kernel module cpio found for $kp at $cpio"); + logm("warning: no kernel module cpio found for $kp at $tp/$cpio"); $cpio = undef; } else { die "$kp $cpio $!"; } - $fn->($kp, $kernel, $cpio); + $fn->($kp, $tp, $kernel, $cpio); } }
ts-host-install +4 -4
@@ -182,9 +182,9 @@ sub setup_netboot_firstboot($) { } di_special_kernel($ho, sub { - my ($kp, $k, $cpio) = @_; + my ($kp, $tp, $k, $cpio) = @_; $kernel = $k if defined $k; - push @initrds, $cpio if defined $cpio; + push @initrds, "$tp/$cpio" if defined $cpio; }); $kernel = "/$d_i/linux" unless $kernel;
@@ -215,9 +215,9 @@ END my %xopts; di_special_kernel($ho, sub { - my ($kp,$k,$c) = @_; + my ($kp,$tp,$k,$c) = @_; $xopts{dtbs} = "/$d_i/$kp-dtbs" - if -e "$ho->{Tftp}{Path}/$d_i/$kp-dtbs"; + if -e "$tp/$d_i/$kp-dtbs"; }); $xopts{dtbs} = "/$d_i/dtbs"
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 8/11 di_special_kernel: Use in preseed_create
In reply to Ian JacksonThis abolishes yet another open-coding of need-kernel-deb-* handling.
Again, there is little functional change. A significant change is that now if the special kernel deb does not exist, we do not fail.
--- Osstest/Debian.pm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
Osstest/Debian.pm +4 -6
@@ -1195,10 +1195,8 @@ END my $backports_kernel; - foreach my $kp (keys %{ $ho->{Flags} }) { - # Backwards compatibility - $kp = "need-kernel-deb-wheezy-backports" if $kp eq "need-kernel-deb-armmp"; - $kp =~ s/need-kernel-deb-$ho->{Suite}-// or next; + di_special_kernel($ho, sub { + my ($kp, $tp, $kernel, $cpio_ignored) = @_; if ($kp eq 'backports') { $backports_kernel = 1;
@@ -1231,7 +1229,7 @@ END }; my $kern = "$d_i/$kp.deb"; - $kdeb->("kernel", $kern); + $kdeb->("kernel", $kern) if defined $kernel; my $ird = "$d_i/initramfs-tools.deb"; if (stat $ird) {
@@ -1249,7 +1247,7 @@ in-target apt-get install -f -y END preseed_hook_command($ho, 'late_command', $sfx, $cmds); - } + }); if ( $ho->{Flags}{'need-uboot-bootscr'} ) { my @bootargs = uboot_common_kernel_bootargs($ho);
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 9/11 mg-debian-installer-update: Introduce $specialkernel
In reply to Ian Jackson* In the first half of the backports kernel processing, set the new variable specialkernel to the string "backports". (This token occurs in the output .deb and kernel name, and is also referenced by hostflags of the form need-kernel-deb-<suite>-backports.)
* Break out the second half of the backports procesing into its own section, conditional on $specialkernel.
* Replace occurrences of the "backports" token, after that point, with $specialkernel.
Overall, this will allow other kinds of special kernel to be introduced. But there is, for now, no functional change.
--- mg-debian-installer-update | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
mg-debian-installer-update +11 -8
@@ -134,8 +134,11 @@ if [ x$bpok != x ]; then # source and not a meta package from 'linux-latest' fetch_debian_package $site Packages.gz -Pe ^linux-image-.*-${bpok}$ \ >backports.deb - dpkg-deb -x backports.deb x - cp x/boot/vmlinuz-* linux.backports + specialkernel=backports +fi +if [ "x$specialkernel" != x ]; then + dpkg-deb -x $specialkernel.deb x + cp x/boot/vmlinuz-* linux.$specialkernel # The full set of modules is pretty large and not that # useful. Just pull in the ones we need for our particular # preseed, which is basically disk, net, filesystems and LVM.
@@ -166,14 +169,14 @@ if [ x$bpok != x ]; then -path \*/kernel/drivers/usb/host/\* \) \ |pax -x sv4cpio -s '%lib%/lib%' -d -w -M norm >../cpio; cd .. gzip -9nf cpio - mv cpio.gz backports.cpio.gz + mv cpio.gz $specialkernel.cpio.gz if [ -d x/usr/lib/linux-image-*-${bpok}/ ] ; then - rm -rf backports-dtbs/ - mkdir backports-dtbs/ + rm -rf $specialkernel-dtbs/ + mkdir $specialkernel-dtbs/ find x/usr/lib/linux-image-*-${bpok} -name '*.dtb' -print0 | \ - xargs -0r sh -ec 'mv -- "$@" backports-dtbs/' x - tar --mtime=./x/usr/lib -cf backports-dtbs.tar backports-dtbs - gzip -9nf backports-dtbs.tar + xargs -0r sh -ec 'mv -- "$@" '$specialkernel'-dtbs/' x + tar --mtime=./x/usr/lib -cf $specialkernel-dtbs.tar $specialkernel-dtbs + gzip -9nf $specialkernel-dtbs.tar fi rm -rf x fi
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 10/11 mg-debian-installer-update: Honour OSSTEST_SPECIALKERNELDEB_<suite>_<arch>
In reply to Ian JacksonThis variable can be set to the absolute pathname of a kernel .deb to use. It will be used only for hosts for which the corresponding hostflag "need-kernel-deb-<suite>-special" is set.
There is not currently any facility for more than one special kernel for each architecture.
As with backports kernels, the normal (Debian-supplied) kernel is available too, and is used for hosts without any special hostflag.
--- mg-debian-installer-update | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
mg-debian-installer-update +8 -1
@@ -114,7 +114,14 @@ case ${suite}_${arch} in wheezy_armhf) bpok=armmp; need_initramfs=y;; jessie_arm64) bpok=arm64 ;; esac -if [ x$bpok != x ]; then +eval "specialdeb=\${OSSTEST_SPECIALKERNELDEB_${suite}_${arch}}" +if [ "x$specialdeb" != x ]; then + echo "using special kernel $specialdeb" + cp $specialdeb special.deb + specialkernel=special + bpok='' +fi +if [ x$bpok != x ] && [ "x$specialkernel" = x ]; then bp="$sbase-backports" pfile=$bp/main/binary-$arch/Packages.gz
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 11/11 production-config: Update jessie amd64 kernel for NUMA bugfix
In reply to Ian JacksonBump TftpDiVersion_jessie. This installer was generated by me today, with the git branch including the di_special_kernel series, using this rune:
OSSTEST_SPECIALKERNELDEB_jessie_amd64=$PWD/linux-image-3.16.0-4-amd64_3.16.51-3~a.test_amd64.deb ./mg-debian-installer-update-all
The file linux-image-3.16.0-4-amd64_3.16.51-3~a.test_amd64.deb came from here
apropos of this comment in the Debian bug report:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=883938#170
--- production-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
production-config +1 -1
@@ -92,7 +92,7 @@ TftpNetGrubTemplatesReal Netgrub.cfg/%ether% TftpNetbootGroup osstest # Update with ./mg-debian-installer-update(-all) TftpDiVersion_wheezy 2016-06-08 -TftpDiVersion_jessie 2017-12-11 +TftpDiVersion_jessie 2017-12-14 # For ISO installs DebianImageVersion_wheezy 7.2.0
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [OSSTEST PATCH 11/11] production-config: Update jessie amd64 kernel for NUMA bugfix
Ian Jackson writes ("[OSSTEST PATCH 11/11] production-config: Update jessie amd64 kernel for NUMA bugfix"):
Quoted 4 lines
Bump
TftpDiVersion_jessie. This installer was generated by me today, with the git branch including thedi_special_kernelseries, using this rune:
Quoted 8 lines
OSSTEST_SPECIALKERNELDEB_jessie_amd64=$PWD/linux-image-3.16.0-4-amd64_3.16.51-3~a.test_amd64.deb ./mg-debian-installer-update-all
The file linux-image-3.16.0-4-amd64_3.16.51-3~a.test_amd64.deb came from here
apropos of this comment in the Debian bug report:
I have pushed this to production. For my reference: I still have nocera{0,1} allocated, and the affected hosts are still unblessed.
After this passes the push gate, I should re-bless hosts with the flag jessie-kernel-broken (which I set temporarily), and free the noceras.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel