Skip to contentSkip to conversation

UEFI and commissioning fixes

PATCH Superseded Ian Jackson 2 participants 16 messages May 17, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover UEFI and commissioning fixes

From: Ian Jackson <[email protected]>

I am trying to commission some new hosts. These patches fix problems I encountered. There are fixes to:

* Better support UEFI x86 hosts.
* Improve the commissioning instructions in README.dev.
* Handle the new FreeBSD anointments system in make-*-flight in production (Executive) mode.

Ian Jackson (10):
Osstest/TestSupport: Use right arch for UEFI grub setup Osstest/Debian: preseed: Force UEFI install regardless README.dev: Fix a typo
README.dev: Discuss setting Firmware for UEFI machines README.dev: Make example commisioning runes use $hn variable Perl @INC path: fix a few more scripts to use BEGIN
mg-anoint: Make readonly operations "work" in standalone mode
mg-anoint: Support mg-anoint retrieve --tolerate-unprepared
mfi-common: set_freebsd_runvars: Never set freebsd_distpath to

    `/amd64' etc.

mfi-common: Fall back to anointed builds in Executive mode

 Osstest/Debian.pm           |  1 +
 Osstest/JobDB/Executive.pm  |  2 ++
 Osstest/JobDB/Standalone.pm |  2 ++
 Osstest/TestSupport.pm      |  4 ++--
 README.dev                  | 21 +++++++++++++--------
 mfi-common                  | 19 ++++++++++++++++---
 mg-anoint                   | 34 ++++++++++++++++++++++++++++++----
 ts-examine-hostprops-save   |  2 +-
 ts-freebsd-host-install     |  2 +-
 9 files changed, 68 insertions(+), 19 deletions(-)
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH 1/10 Osstest/TestSupport: Use right arch for UEFI grub setup

---
 Osstest/TestSupport.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Osstest/TestSupport.pm +2 -2
index 6d5e667..983bb17 100644
@@ -2646,8 +2646,8 @@ menuentry 'local' {
   insmod part_gpt
   insmod part_msdos
   set root=(hd0,gpt1)
-  echo "Chainloading (\${root})/EFI/BOOT/BOOTAA64.EFI"
-  chainloader (\${root})/EFI/BOOT/BOOTAA64.EFI
+  echo "Chainloading (\${root})/EFI/BOOT/BOOT$efi.EFI"
+  chainloader (\${root})/EFI/BOOT/BOOT$efi.EFI
   boot
 }
 END
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#2 lore raw

PATCH 2/10 Osstest/Debian: preseed: Force UEFI install regardless

In reply to Ian Jackson

This suppresses:

Partition disks
---------------

This machine's firmware has started the installer in UEFI mode but it looks like there may be existing operating systems already installed using "BIOS compatibility mode". If you continue to install Debian in UEFI mode, it might be difficult to reboot the machine into any BIOS-mode operating systems later.

If you wish to install in UEFI mode and don't care about keeping the ability to boot one of the existing systems, you have the option to force that here. If you wish to keep the option to boot an existing operating system, you should choose NOT to force UEFI installation here.
Force UEFI installation?
1: Yes 2: No
Prompt: '?' for help>

---
 Osstest/Debian.pm | 1 +
 1 file changed, 1 insertion(+)
Osstest/Debian.pm +1 -0
index b46d222..cbd10d3 100644
@@ -1333,6 +1333,7 @@ d-i partman-auto/disk string $disk
 
 d-i partman-ext3/no_mount_point boolean false
 d-i partman-basicmethods/method_only boolean false
+d-i partman-efi/non_efi_system true
 
 d-i partman-auto/expert_recipe string					\\
 	boot-root ::							\\
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#3 lore raw

PATCH 3/10 README.dev: Fix a typo

In reply to Ian Jackson
---
 README.dev | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
README.dev +2 -2
index 95fc66c..0f7fccd 100644
@@ -30,8 +30,8 @@ Keeps running for the duration, so run it in a screen on the osstest VM.
 
 Or you can use mg-allocate.
 
-Commisioning a new machine
-==========================
+Commissioning a new machine
+===========================
 
 Firstly, arrange that it is hooked up to network, serial, and pdu.
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#4 lore raw

PATCH 4/10 README.dev: Discuss setting Firmware for UEFI machines

In reply to Ian Jackson

This must occur before mknetbootdir, or mknetbootdir does not set things up for UEFI booting.

---
 README.dev | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
README.dev +5 -1
index 0f7fccd..a2b93e0 100644
@@ -97,7 +97,11 @@ For example, one might need something like this:
 (Many of these things are not needed in Massachusetts as the ansible
 playbook will provide it via an autogenerated config file - see above.)
 
-Create the tftp directory:
+Set the firmware, if it's UEFI:
+
+ $ ./mg-hosts setprops albana{0,1} -- Firmware uefi
+
+Create the tftp directory (must be done after firmware is set):
 
  $ ./mg-hosts mknetbootdir mudcake{0,1}
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#5 lore raw

PATCH 5/10 README.dev: Make example commisioning runes use $hn variable

In reply to Ian Jackson

This makes them better for cutting-and-pasting.

---
 README.dev | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
README.dev +6 -5
index a2b93e0..441eee8 100644
@@ -112,9 +112,10 @@ Firstly, a basic "host examination" that checks that we can install
 and boot Xen:
 
  $ basis=113124   # pick last good xen-unstable or osstest flight
- $ flight=`./make-hosts-flight play xen-unstable blessed-commission-mudcake commission-mudcake $basis`; echo $flight
+ $ hn=mudcake
+ $ flight=`./make-hosts-flight play xen-unstable blessed-commission-$hn commission-$hn $basis`; echo $flight
  113155
- $ ./mg-execute-flight -Bcommission-mudcake [email protected] $flight
+ $ ./mg-execute-flight -Bcommission-$hn [email protected] $flight
 
 This will email the specified address.  The examination should pass,
 completely.  If it does not then you may need to change the BIOS
@@ -130,8 +131,8 @@ right permissions set up.
 If that works, a more thorough test:
 
  $ basis=113124   # pick last good xen-unstable or osstest flight
- $ flight=`./cs-adjust-flight new:commission-mudcake copy $basis`; echo $flight
- $ ./mg-execute-flight -Bcommission-mudcake [email protected] -f$basis $flight
+ $ flight=`./cs-adjust-flight new:commission-$hn copy $basis`; echo $flight
+ $ ./mg-execute-flight -Bcommission-$hn [email protected] -f$basis $flight
 
 This should show no regressions.  (Or, at least, none that are a cause
 for concern.)
@@ -139,7 +140,7 @@ for concern.)
 For a new architecture, there may not be an existing flight with
 suitable jobs.  In that case, something like this can be useful:
 
- $ OSSTEST_BLESSING=commission-mudcake DAILY_BRANCH_PREEXEC_HOOK=false OSSTEST_BASELINES_ONLY=y ./cr-daily-branch xen-unstable
+ $ OSSTEST_BLESSING=commission-$hn DAILY_BRANCH_PREEXEC_HOOK=false OSSTEST_BASELINES_ONLY=y ./cr-daily-branch xen-unstable
 
 You'll need to fish the flight number out of the debug spew.
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#6 lore raw

PATCH 6/10 Perl @INC path: fix a few more scripts to use BEGIN

In reply to Ian Jackson

Three more files which missed out on
dea987c5ab11 "PERLLIB, @INC: Use BEGIN { }"

CC Roger Pau Monné <[email protected]>
---
 mg-anoint                 | 2 +-
 ts-examine-hostprops-save | 2 +-
 ts-freebsd-host-install   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
mg-anoint +1 -1
index 837e608..b007ab4 100755
@@ -63,7 +63,7 @@
 
 use strict qw(vars refs);
 use DBI;
-unshift @INC, qw(.);
+BEGIN { unshift @INC, qw(.); }
 use Osstest;
 use Osstest::TestSupport;
 use Osstest::Executive;
ts-examine-hostprops-save +1 -1
index 188773f..55d2339 100755
@@ -19,7 +19,7 @@ use strict qw(vars);
 use DBI;
 use POSIX;
 
-unshift @INC, qw(.);
+BEGIN { unshift @INC, qw(.); }
 use Osstest;
 use Osstest::TestSupport;
 
ts-freebsd-host-install +1 -1
index cac8be9..984bdf0 100755
@@ -35,7 +35,7 @@ use strict qw(vars);
 use DBI;
 use POSIX;
 
-unshift @INC, qw(.);
+BEGIN { unshift @INC, qw(.); }
 use Osstest;
 use Osstest::TestSupport;
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#8 lore raw

PATCH 7/10 mg-anoint: Make readonly operations "work" in standalone mode

In reply to Ian Jackson

This makes `mg-anoint' in standalone mode a view onto an empty set of anointments. So now it becomes ok to call mg-anoint in make-*-flight.

CC Roger Pau Monné <[email protected]>
---
 Osstest/JobDB/Executive.pm  |  2 ++
 Osstest/JobDB/Standalone.pm |  2 ++
 mg-anoint                   | 20 +++++++++++++++++++-
 3 files changed, 23 insertions(+), 1 deletion(-)
Osstest/JobDB/Executive.pm +2 -0
index a7a6696..fe8e7f6 100644
@@ -409,4 +409,6 @@ sub jobdb_db_glob ($$) { #method
     return "LIKE E'$str'";
 }
 
+sub can_anoint ($) { return 1; }
+
 1;
Osstest/JobDB/Standalone.pm +2 -0
index d9a90fc..4f320cc 100644
@@ -133,4 +133,6 @@ sub jobdb_db_glob ($) { #method
     return "GLOB '$str'";
 }
 
+sub can_anoint ($) { return 0; }
+
 1;
mg-anoint +19 -1
index b007ab4..522cbdd 100755
@@ -66,7 +66,6 @@ use DBI;
 BEGIN { unshift @INC, qw(.); }
 use Osstest;
 use Osstest::TestSupport;
-use Osstest::Executive;
 use IO::Handle;
 use Text::Glob qw(glob_to_regex);
 
@@ -93,6 +92,15 @@ END
 our $task_q;
 our $mostrecent_q;
 
+sub empty_unless_can_anoint () {
+    return if $mjobdb->can_anoint();
+    exit 0;
+}
+sub fail_unless_can_anoint () {
+    return if $mjobdb->can_anoint();
+    die "anointments not supported in this mode ($c{JobDB})\n"
+}
+
 sub prep_queries {
     $task_q = $dbh_tests->prepare(<<END);
         SELECT taskid, refinfo FROM tasks WHERE type='anoint' AND refkey=?
@@ -121,6 +129,9 @@ sub cmd_prepare {
     }
     die "usage: mg-anoint prepare [OPTIONS] 'SCOPE DETAILS...' DESCRIPTION"
 	unless @ARGV==2 || $ARGV[0] =~ m/ /;
+
+    fail_unless_can_anoint();
+
     my ($refkey, $description) = @ARGV;
     my $dq = $dbh_tests->prepare(<<END);
         DELETE FROM tasks WHERE type='anoint' AND refkey=?
@@ -142,6 +153,7 @@ sub cmd_destroy {
     die unless @ARGV==1;
     die if $ARGV[0] =~ m/^-/;
     my ($refkey) = @ARGV;
+    fail_unless_can_anoint();
     my $rdq = $dbh_tests->prepare(<<END);
         DELETE FROM resources
               WHERE restype='share-flight'
@@ -178,6 +190,7 @@ sub cmd_anoint {
     die unless @ARGV==3;
     my ($refkey, $flight, $job) = @ARGV;
 
+    fail_unless_can_anoint();
     prep_queries();
 
     my $newflight_q = $dbh_tests->prepare(<<END);
@@ -285,6 +298,7 @@ sub cmd_retrieve {
     die if $ARGV[0] =~ m/^-/;
     my ($refkey) = @ARGV;
 
+    empty_unless_can_anoint();
     prep_queries();
 
     db_retry($dbh_tests, [], sub {
@@ -307,6 +321,8 @@ sub cmd_retrieve {
 sub cmd_list {
     die "no options to list" if @ARGV;
 
+    empty_unless_can_anoint();
+
     my $tq = $dbh_tests->prepare(<<END);
         SELECT *
           FROM tasks
@@ -347,6 +363,8 @@ sub cmd_list_prepared {
     my ($pat) = @ARGV;
     my $re = glob_to_regex $pat;
 
+    empty_unless_can_anoint();
+
     my $tq = $dbh_tests->prepare(<<END);
         SELECT *
           FROM tasks
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 7/10
#9 lore raw

Re: [OSSTEST PATCH 07/10] mg-anoint: Make readonly operations "work" in standalone mode

Quoted 4 lines · Ian Jackson

This makes `mg-anoint' in standalone mode a view onto an empty set of anointments. So now it becomes ok to call mg-anoint in make-*-flight.

Thanks.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#10 lore raw

PATCH 8/10 mg-anoint: Support mg-anoint retrieve --tolerate-unprepared

In reply to Ian Jackson

make-*-flight is going to want this.

CC Roger Pau Monné <[email protected]>
---
 mg-anoint | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
mg-anoint +10 -2
index 522cbdd..d09124b 100755
@@ -15,10 +15,12 @@
 #        --allow-blessed=BLESSING,...       default is from `prepare'
 #        --allow-job-status=STATUS,...      default is only `pass'
 #
-#  ./mg-anoint retrieve REFKEY
+#  ./mg-anoint retrieve [--tolerate-unprepared] REFKEY
 #      => FLIGHT JOB
 #         if nothing anointed yet, prints nothing and exits 0
 #         if anointment not prepared, fails
+#      With --tolerate-unprepared, it is not an error if nothing is
+#      reported because the anointment has not been prepared.
 #
 #  ./mg-anoint list-prepared REFKEY-GLOB
 #      => possibly empty list of REFKEYs
@@ -294,6 +296,11 @@ END
 }    
 
 sub cmd_retrieve {
+    my $tolerate_unprepared;
+    if (@ARGV && $ARGV[0] eq '--tolerate-unprepared') {
+	shift @ARGV;
+	$tolerate_unprepared = 1;
+    }
     die unless @ARGV==1;
     die if $ARGV[0] =~ m/^-/;
     my ($refkey) = @ARGV;
@@ -305,7 +312,8 @@ sub cmd_retrieve {
         @o = ();
         $task_q->execute($refkey);
 	my ($task) = $task_q->fetchrow_array();
-	die "no such anointment kind \`$refkey'" unless defined $task;
+	die "no such anointment kind \`$refkey'"
+	    unless defined $task or $tolerate_unprepared;
 
 	$mostrecent_q->execute($task);
 	my $row = $mostrecent_q->fetchrow_hashref();
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 8/10
#11 lore raw

Re: [OSSTEST PATCH 08/10] mg-anoint: Support mg-anoint retrieve --tolerate-unprepared

Quoted 3 lines · Ian Jackson

make-*-flight is going to want this.

Just a style comment below.

Quoted 23 lines
---
 mg-anoint | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
mg-anoint +3 -1
index 522cbdd..d09124b 100755
@@ -15,10 +15,12 @@
 #        --allow-blessed=BLESSING,...       default is from `prepare'
 #        --allow-job-status=STATUS,...      default is only `pass'
 #
-#  ./mg-anoint retrieve REFKEY
+#  ./mg-anoint retrieve [--tolerate-unprepared] REFKEY
 #      => FLIGHT JOB
 #         if nothing anointed yet, prints nothing and exits 0
 #         if anointment not prepared, fails
+#      With --tolerate-unprepared, it is not an error if nothing is
+#      reported because the anointment has not been prepared.
 #
 #  ./mg-anoint list-prepared REFKEY-GLOB
 #      => possibly empty list of REFKEYs

mg-anoint END · line 303

Quoted 8 lines
mg-anoint +5 -0
@@ -294,6 +296,11 @@ END
 }    
 
 sub cmd_retrieve {
+    my $tolerate_unprepared;
+    if (@ARGV && $ARGV[0] eq '--tolerate-unprepared') {
+	shift @ARGV;
+	$tolerate_unprepared = 1;
+    }

There seems to be a mix between hard and soft tabs in the chunk above (and below).

Thanks.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#12 lore raw

PATCH 9/10 mfi-common: set_freebsd_runvars: Never set freebsd_distpath to `/amd64' etc.

In reply to Ian Jackson

Logically, the final branch of the if should be qualified with a check for the emptiness of FreeBSDDist. This is awkward in the current structure, since we really want to do the distpath lookup only if needed. (This is not very important right now, but we are about to add another case which will do a more-likely-to-bomb-out and more-likely-to-block-on-the-db lookup.) So refactor into `return' style. This lets us introduce local variables in each branch.

Now gate the final branch appropriately. The overall result is that if no useful FreeBSD build is found, we simply do not set the freebsd_* runvars, rather than setting them to wrong values (eg, `freebsd_distpath=/i386'.

CC Roger Pau Monné <[email protected]>
---
 mfi-common | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
mfi-common +8 -3
index cef28ad..17b1b50 100644
@@ -133,14 +133,19 @@ set_freebsd_runvars () {
     local envvar="FREEBSD_${arch^^}_BUILDJOB"
     if [ -n "${!envvar}" ]; then
         freebsd_runvars="freebsdbuildjob=${!envvar}"
-    elif [ -n "$FREEBSD_DIST" ] && [ -n "$FREEBSD_VERSION" ]; then
+        return
+    fi
+    if [ -n "$FREEBSD_DIST" ] && [ -n "$FREEBSD_VERSION" ]; then
         freebsd_runvars="freebsd_distpath=$FREEBSD_DIST/$arch \
                          freebsd_version=$FREEBSD_VERSION"
-    else
-        local distpath=`getconfig "FreeBSDDist"`
+        return
+    fi
+    local distpath=`getconfig "FreeBSDDist"`
+    if [ -n "$distpath" ]; then
         local version=`getconfig "FreeBSDVersion"`
         freebsd_runvars="freebsd_distpath=$distpath/$arch \
                          freebsd_version=$version"
+        return
     fi
 }
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 9/10
#13 lore raw

Re: [OSSTEST PATCH 09/10] mfi-common: set_freebsd_runvars: Never set freebsd_distpath to `/amd64' etc.

Quoted 8 lines · Ian Jackson

Logically, the final branch of the if should be qualified with a check for the emptiness of FreeBSDDist. This is awkward in the current structure, since we really want to do the distpath lookup only if needed. (This is not very important right now, but we are about to add another case which will do a more-likely-to-bomb-out and more-likely-to-block-on-the-db lookup.) So refactor into `return' style. This lets us introduce local variables in each branch.

Quoted 6 lines

Now gate the final branch appropriately. The overall result is that if no useful FreeBSD build is found, we simply do not set the freebsd_* runvars, rather than setting them to wrong values (eg, `freebsd_distpath=/i386'.

Thanks.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#14 lore raw

PATCH 10/10 mfi-common: Fall back to anointed builds in Executive mode

In reply to Ian Jackson

Previously, `make-*-flight' would not work unless FREEBSD_*_BUILDJOB was set. Now we use the anointed values if we can find them.

If we can't, mg-anoint retrieve will print a warning.

CC Roger Pau Monné <[email protected]>
---
 mfi-common | 8 ++++++++
 1 file changed, 8 insertions(+)
mfi-common +8 -0
index 17b1b50..fddd1ce 100644
@@ -130,6 +130,8 @@ set_freebsd_runvars () {
     # 3. Config file FreeBSDDist, FreeBSDVersion: same as 2. except that
     # they are set on the config file.
     #
+    # 4. Look for an anointed build of FreeBSD `master' (Executive only)
+    #
     local envvar="FREEBSD_${arch^^}_BUILDJOB"
     if [ -n "${!envvar}" ]; then
         freebsd_runvars="freebsdbuildjob=${!envvar}"
@@ -147,6 +149,12 @@ set_freebsd_runvars () {
                          freebsd_version=$version"
         return
     fi
+    local anointment="freebsd build master $arch"
+    local flightjob=`./mg-anoint retrieve --tolerate-unprepared "$anointment"`
+    if [ -n "$flightjob" ]; then
+        freebsd_runvars="freebsdbuildjob=${flightjob/ /.}"
+        return
+    fi
 }
 
 create_build_jobs () {
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 10/10
#15 lore raw

Re: [OSSTEST PATCH 10/10] mfi-common: Fall back to anointed builds in Executive mode

Quoted 6 lines · Ian Jackson

Previously, `make-*-flight' would not work unless FREEBSD_*_BUILDJOB was set. Now we use the anointed values if we can find them.

If we can't, mg-anoint retrieve will print a warning.

LGTM

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel