@@ -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;
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@credativ.de> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> --- mg-hosts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)