[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST PATCH 2/3] host properties: Firmware: Move default to selecthost
Drop the explicit default from all the call sites. This centralises the default. This is going to be the new scheme for host properties in general. (Two of the call sites had a different default, "", which in their context was semantically equivalent to "bios".) Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- Osstest/Debian.pm | 4 ++-- Osstest/TestSupport.pm | 13 +++++++++---- ts-xen-install | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm index 911d8905..79aa2d24 100644 --- a/Osstest/Debian.pm +++ b/Osstest/Debian.pm @@ -443,7 +443,7 @@ sub setupboot_grub2 ($$$$) { # Grub2 on jessie/stretch ARM* doesn't do multiboot, so we must chainload. my $need_uefi_chainload = - get_host_property($ho, "firmware", "") eq "uefi" && + get_host_property($ho, "firmware") eq "uefi" && $ho->{Suite} =~ m/jessie|stretch/ && $ho->{Arch} =~ m/^arm/; my $parsemenu= sub { @@ -1498,7 +1498,7 @@ END preseed_microcode($ho,$sfx); - if (get_host_property($ho, "firmware",'') eq "uefi") { + if (get_host_property($ho, "firmware") eq "uefi") { die unless $ho->{Suite} =~ m/jessie|stretch/; # Prevent grub-install from making a new Debian boot entry, so # we always reboot from the network. Debian bug #789798 proposes a diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index e554af38..b629fb7d 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -1218,7 +1218,10 @@ sub selecthost ($;$) { #----- calculation of the host's properties ----- - $ho->{Properties} = { }; + # Firstly, hardcoded defaults + $ho->{Properties} = { + Firmware => 'bios', + }; my $setprop = sub { my ($pn,$val) = @_; $ho->{Properties}{$pn} = $val; @@ -1363,6 +1366,8 @@ sub propname_check ($) { # It is fine to call this on a guest object too, in which case it will # always return $defval. +# Ideally all uses of $defval would be replaced by defaults in the +# initial array in selecthost. sub get_host_property ($$;$) { my ($ho, $prop, $defval) = @_; return $defval unless $ho->{Properties}; @@ -2811,7 +2816,7 @@ sub host_netboot_file ($;$) { # in array context, returns (dir, pathtail) # where dir does not depend on $templatekeytail my %v = %r; - my $firmware = get_host_property($ho, "firmware", "bios"); + my $firmware = get_host_property($ho, "firmware"); my $templatekeybase = $firmware eq 'uefi' ? 'NetGrub' : 'Pxe'; $templatekeytail //= 'Templates'; my $templatekey = $templatekeybase.$templatekeytail; @@ -2937,7 +2942,7 @@ END sub setup_netboot_local ($) { my ($ho) = @_; - my $firmware = get_host_property($ho, "firmware", "bios"); + my $firmware = get_host_property($ho, "firmware"); $firmware =~ s/-/_/g; no strict qw(refs); return &{"setup_netboot_local_${firmware}"}($ho); @@ -2945,7 +2950,7 @@ sub setup_netboot_local ($) { sub setup_netboot_di ($$$$$;%) { my ($ho,$kern,$initrd,$dicmd,$hocmd,%xopts) = @_; - my $firmware = get_host_property($ho, "firmware", "bios"); + my $firmware = get_host_property($ho, "firmware"); $firmware =~ s/-/_/g; no strict qw(refs); return &{"setup_netboot_di_${firmware}"}($ho,$kern,$initrd, diff --git a/ts-xen-install b/ts-xen-install index 2d3c644d..154f78c7 100755 --- a/ts-xen-install +++ b/ts-xen-install @@ -114,7 +114,7 @@ sub extradebs () { some_extradebs([ 'DebianExtraPackages', $suite ]); # $c{ DebianExtraPackages_<firmware>_<arch>_<suite> } - my $firmware = get_host_property($ho, "firmware", "bios"); + my $firmware = get_host_property($ho, "firmware"); some_extradebs([ 'DebianExtraPackages', $firmware, $ho->{Arch}, $suite ]); } -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |