[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 3/3] mg-hosts mknetbootdir: Introduce and require -F<firmware>



If one runs
  ./mg-hosts mknetbootdir HOST
before having sorted out all the host configuration, it uses the
default configuration value for the host's firmware kind, which is
"bios".  If the configuration is then changed, things don't work.
This is confusing.

So ask the user to specify one or more -F<firmware>, or -Fany.

CC: Dominic Brekau <dominic.brekau@xxxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 mg-hosts | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/mg-hosts b/mg-hosts
index d68f7b4e..14f816ae 100755
--- a/mg-hosts
+++ b/mg-hosts
@@ -19,7 +19,7 @@
 
 # Usages:
 #
-#  ./mg-hosts mknetbootdir HOST...
+#  ./mg-hosts mknetbootdir -Fany | -F<firmware>... HOST...
 #               Create directories for netboot as expected by the rest
 #               of osstest.  Will use "sudo". The HOST(s) must be
 #               allocated (via mg-allocate HOST).
@@ -121,19 +121,29 @@ sub l ($) { return split /,/, $_[0]; }
 
 sub cmd_mknetbootdir () {
     my $dryrun = 0;
+    my %expect_firmware;
     while (@ARGV && $ARGV[0] =~ m/^-/) {
        $_ = shift @ARGV;
        last if $_ =~ m/^--?$/;
        while (m/^-./) {
            if (s/^-n/-/) { $dryrun= 1; }
+           elsif (s/^-F(.*)//) { $expect_firmware{$1} = 1 }
            else { die "unknown mknetbootdir option $_"; }
        }
     }
+    die "need at least one -F<firmware> or -Fany option"
+       unless %expect_firmware;
     die unless @ARGV>=1;
     my $sudo = $ENV{'OSSTEST_SUDO'} // 'sudo';
     foreach my $hn (@ARGV) {
         my $ho= selecthost("host=$hn");
        my ($dir, $file) = host_netboot_file($ho);
+       if (!$expect_firmware{any}) {
+           my $got_firmware = get_host_property($ho, "firmware");
+           die
+ "host $hn configuration says firmware \`$got_firmware', not as expected\n"
+               unless $expect_firmware{$got_firmware};
+       }
         die unless defined $dir;
        my ($rdir, $realfile) = host_netboot_file($ho, 'TemplatesReal');
        $realfile //= $file;
-- 
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®.