[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


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Date: Thu, 29 Aug 2019 10:17:18 +0100
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@xxxxxxxxxxxxx; spf=Pass smtp.mailfrom=Ian.Jackson@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxx
  • Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Delivery-date: Thu, 29 Aug 2019 09:18:25 +0000
  • Ironport-sdr: q2TmiDP+cVgXgsjXLCLeIVRgfxEeOsYFtHeKnwg5B2Q54xccrna8h/4JrB+8X+HfhRPZN1vPao zeSBEomTEwfkpaYhk1jDbpkaAwMZheWKQlGcbKkUbuGqcmuIT8h7rqKj09iG09hqmZOR7t21uJ qAowfkDWA2VqViTJckfvr//hrBvAi/sXNmdBUZEZOI7jIbbjwngM93l2qDPrP2LzU0xoBocm8B XuB5iinzFNfrUmt558fP2siL53sZU/BPCdimC7Imy/geXSuj6I2d3ol7mTrqajT5/wvZTyrPTT eno=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.