From: Ian Campbell Date: Mon, 23 Nov 2015 11:54:11 +0000 (+0000) Subject: Set {ident}_suite runvar when install a Debian guest. X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b58a037f15a128584872f97a194ebce2bde32857;p=people%2Fiwj%2Fosstest.git Set {ident}_suite runvar when install a Debian guest. Currently those places which want this open code a lookup of the {ident}_suite runvar with a fallback to the configuration file. However selecthost was missing such a lookup in the case where it is constructing a nested L1 host (which begins from the selectguest template), which lead to ts-xen-install on Jessie missing the installation of libnl-route-3-200. Fix this by providing debian_guest_suite($gho) which as well as initialising $gho->{Suite} stores an {ident}_suite runvar (taking care to handle the case where one is already set by e.g. make-flight). For convenience debian_guest_suite() also returns the suite name. ts-debian-install, ts-debian-di-install and ts-debian-hvm-install now use debian_guest_suite instead of open coding the lookup. The final piece of the puzzle is to have selectguest() pickup the {ident}_suite runvar (if it is set) and initialise $gho->{Suite} from it. Signed-off-by: Ian Campbell Acked-by: Ian Jackson --- diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm index 317f6633..cee0d887 100644 --- a/Osstest/Debian.pm +++ b/Osstest/Debian.pm @@ -35,6 +35,7 @@ BEGIN { @ISA = qw(Exporter); @EXPORT = qw(debian_boot_setup debian_overlays + debian_guest_suite %preseed_cmds preseed_base preseed_create @@ -1335,4 +1336,17 @@ sub preseed_hook_cmds () { return $preseed; } +sub debian_guest_suite ($) { + my ($gho) = @_; + + $gho->{Suite} //= guest_var($gho,'suite',undef); + + if (!$gho->{Suite}) { + $gho->{Suite} = $c{GuestDebianSuite}; + store_runvar("$gho->{Guest}_suite", $gho->{Suite}); + } + + return $gho->{Suite}; +} + 1; diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index d1f7d368..61e885ab 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -1453,6 +1453,7 @@ sub selectguest ($$) { CfgPath => $r{"${gn}_cfgpath"}, Tftp => $ho->{Tftp}, Host => $ho, + Suite => $r{"${gn}_suite"}, }; foreach my $opt (guest_var_commalist($gho,'options')) { $gho->{Options}{$opt}++; diff --git a/ts-debian-di-install b/ts-debian-di-install index 64b5d44a..a9b3b200 100755 --- a/ts-debian-di-install +++ b/ts-debian-di-install @@ -190,7 +190,7 @@ END if ( $method eq "netboot" ) { - my $suite= $r{"$gho->{Guest}_suite"}; + my $suite= debian_guest_suite($gho); logm("$method $suite/$arch"); $method_cfg = setup_netboot($tmpdir, $arch, $suite); diff --git a/ts-debian-hvm-install b/ts-debian-hvm-install index 2c7580c1..96190a18 100755 --- a/ts-debian-hvm-install +++ b/ts-debian-hvm-install @@ -199,7 +199,7 @@ sub prep () { $disk_mb + 1, 200); - $gsuite = guest_var($gho,'suite',$c{GuestDebianSuite}); + $gsuite = debian_guest_suite($gho); $kernel = iso_path('kernel', 'vmlinuz'); $ramdisk = iso_path('ramdisk', 'initrd.gz'); diff --git a/ts-debian-install b/ts-debian-install index 0dfe40c2..f42edbfb 100755 --- a/ts-debian-install +++ b/ts-debian-install @@ -19,6 +19,7 @@ use strict qw(vars); use DBI; use Osstest; use Osstest::TestSupport; +use Osstest::Debian; tsreadconfig(); @@ -47,7 +48,7 @@ sub prep () { sub ginstall () { my $arch= $r{"$gho->{Guest}_arch"}; my $archarg= defined($arch) ? "--arch $arch" : ''; - my $gsuite= guest_var($gho,'suite',$c{GuestDebianSuite}); + my $gsuite= debian_guest_suite($gho); my $kernpath = guest_var($gho,'kernel_path',$r{xen_kernel_path}); my $initrd = guest_var($gho,'initrd_path',$r{xen_initrd_path});