From patchwork Tue Mar 18 10:23:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 26474 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f69.google.com (mail-pb0-f69.google.com [209.85.160.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 556E4203C3 for ; Tue, 18 Mar 2014 10:25:25 +0000 (UTC) Received: by mail-pb0-f69.google.com with SMTP id md12sf17387058pbc.8 for ; Tue, 18 Mar 2014 03:25:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id :mime-version:cc:subject:precedence:list-id:list-unsubscribe :list-post:list-help:list-subscribe:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=gN3Ahtx+OTes5PyeRzfFkMcT2dKlzALS2aQ1Q4K7EJQ=; b=ZBLGaqEOQz4SseLs04wGtyeTBGHUTzKAebUb9rAZvkXZHkVkX2oE1Q43kbogYzBDi+ lNMp/wUSrbSdmIoP4q4t3xaoosnc/S1RhT6wl6zZkopizVHcNwVDQKIMUSrFTi1s9QdH t0kCjrXw+j5fxLzVlm9b3ANKscQYCAWk0iyuiA4Vk9C8suIEx9f8ORjNpciYYUwI0KME EGXcgv8w7YWmZ/LTqikNGP2l9mChGAl6Gqv7Jjrzyr8t8fYzfgRC8o642yhZUtLB3auW nLxxnq0wCllC2PmHudAhkVJJ5OKjWN9CfsBuuD089zftjUoKXdvuz9syoCubeVCSXrYD oOzw== X-Gm-Message-State: ALoCoQmYJ9KXaAKkaBeKWh+AuE/LibYdh5CmZmUXX6bH2VAJh+kdHq/T8VayUIn8NkRSf+6gOm9K X-Received: by 10.66.52.80 with SMTP id r16mr11064700pao.15.1395138324608; Tue, 18 Mar 2014 03:25:24 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.42.138 with SMTP id c10ls1967994qga.63.gmail; Tue, 18 Mar 2014 03:25:24 -0700 (PDT) X-Received: by 10.220.147.16 with SMTP id j16mr5279574vcv.28.1395138324469; Tue, 18 Mar 2014 03:25:24 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id rl1si6310726vcb.149.2014.03.18.03.25.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Mar 2014 03:25:24 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id hu19so7164850vcb.1 for ; Tue, 18 Mar 2014 03:25:24 -0700 (PDT) X-Received: by 10.58.123.70 with SMTP id ly6mr3684021veb.26.1395138324365; Tue, 18 Mar 2014 03:25:24 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp193688vck; Tue, 18 Mar 2014 03:25:23 -0700 (PDT) X-Received: by 10.58.178.238 with SMTP id db14mr3668459vec.25.1395138323606; Tue, 18 Mar 2014 03:25:23 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id v2si721862vet.34.2014.03.18.03.25.23 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 18 Mar 2014 03:25:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WPrAw-0004dI-4C; Tue, 18 Mar 2014 10:23:14 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WPrAu-0004co-Sk for xen-devel@lists.xen.org; Tue, 18 Mar 2014 10:23:13 +0000 Received: from [85.158.139.211:27193] by server-5.bemta-5.messagelabs.com id 8D/72-06049-09E18235; Tue, 18 Mar 2014 10:23:12 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-6.tower-206.messagelabs.com!1395138189!1683673!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 25773 invoked from network); 18 Mar 2014 10:23:11 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-6.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 18 Mar 2014 10:23:11 -0000 X-IronPort-AV: E=Sophos;i="4.97,677,1389744000"; d="scan'208";a="111016423" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 18 Mar 2014 10:23:10 +0000 Received: from norwich.cam.xci-test.com (10.80.248.129) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.2.342.4; Tue, 18 Mar 2014 06:23:08 -0400 Received: from spare.cam.xci-test.com ([10.80.2.80] helo=kazak.uk.xensource.com.) by norwich.cam.xci-test.com with esmtp (Exim 4.72) (envelope-from ) id 1WPrAq-0007Ad-M0; Tue, 18 Mar 2014 10:23:08 +0000 From: Ian Campbell To: Date: Tue, 18 Mar 2014 10:23:08 +0000 Message-ID: <1395138188-20176-1-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.8.5.2 MIME-Version: 1.0 X-DLP: MIA1 Cc: Ian Campbell , xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH OSSTEST v2] Allow per-host TFTP setup X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: I run osstest against machines which are in both the XenServer and XenClient administrative domains, and hence which have different TFTP servers, accessible locally via different NFS mounted paths. Make it possible to specify various bits of TFTP path via ~/.xen-osstest/config by introducing the idea of Tftp "scope" and allowing that to be configurable on a per-host basis. For example I have: TftpDefaultScope xenserver TftpPath_xenserver /usr/groups/netboot/ TftpPxeDir_xenserver pxelinux.cfg/ TftpPath_xenclient /home/xc_tftpboot/pxe/ TftpPxeDir_xenclient / TftpPxeTemplates_xenclient %ipaddrhex%/pxelinux.cfg HostProp_marilith-n4_TftpScope xenclient and I am now able to install on both cam-st16 (a xenserver world test box) and marilith-n4 (an osstest machine hosted in the xenclient network) without messing around with my configuration every time. I ran build-$ARCH, build-$ARCH-pvops and test-$ARCH-$ARCH-xl in both cases. Per-host Tftp settings are now in the $ho->{Tftp} hash instead of in $c. $c{TftpHost} is unused -- remove the setting of its default. Signed-off-by: Ian Campbell Acked-by: Ian Jackson --- v2: Do not allow TftpDiVersion to be a host var, this must be push gated. Implement scope scheme README updates --- Osstest.pm | 3 ++- Osstest/Debian.pm | 3 ++- Osstest/TestSupport.pm | 22 +++++++++++++++++++--- README | 25 +++++++++++++++++++++++++ mg-hosts | 4 ++-- ts-host-install | 14 +++++++------- 6 files changed, 57 insertions(+), 14 deletions(-) diff --git a/Osstest.pm b/Osstest.pm index 4600709..1033dd1 100644 --- a/Osstest.pm +++ b/Osstest.pm @@ -161,8 +161,9 @@ sub readglobalconfig () { chomp($nodename) or die; my $myfqdn = "$nodename.$c{DnsDomain}"; + $c{TftpDefaultScope} ||= "default"; + $c{TftpPath} ||= "/tftpboot/"; - $c{TftpHost} ||= $myfqdn; $c{TftpPxeDir} ||= "pxelinux.cfg/"; $c{TftpPxeTemplates} ||= '%ipaddrhex% 01-%etherhyph%'; $c{TftpPlayDir} ||= "$whoami/osstest/"; diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm index 336043c..1ca6fb0 100644 --- a/Osstest/Debian.pm +++ b/Osstest/Debian.pm @@ -554,7 +554,8 @@ END foreach my $kp (keys %{ $ho->{Flags} }) { $kp =~ s/need-kernel-deb-// or next; - my $d_i= $c{TftpPath}.'/'.$c{TftpDiBase}.'/'.$r{arch}.'/'.$c{TftpDiVersion}.'-'.$ho->{Suite}; + my $d_i= $ho->{Tftp}{Path}.'/'.$ho->{Tftp}{DiBase}.'/'.$r{arch}.'/'. + $c{TftpDiVersion}.'-'.$ho->{Suite}; my $kurl = create_webfile($ho, "kernel", sub { copy("$d_i/$kp.deb", $_[0]) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index b6a6fb5..f6c2bef 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -795,6 +795,21 @@ sub selecthost ($) { } $ho->{Ip}= $ho->{IpStatic}; + #----- tftp ----- + + my $tftpscope = get_host_property($ho, 'TftpScope', $c{TftpDefaultScope}); + logm("TftpScope is $tftpscope"); + $ho->{Tftp} = { + Path => $c{"TftpPath_$tftpscope"} || $c{TftpPath}, + TmpDir => $c{"TftpTmpDir_$tftpscope"} || $c{TftpTmpDir}, + PxeDir => $c{"TftpPxeDir_$tftpscope"} || $c{TftpPxeDir}, + PxeGroup => $c{"TftpPxeGroup_$tftpscope"} || $c{TftpPxeGroup}, + PxeTemplates => $c{"TftpPxeTemplates_$tftpscope"} || $c{TftpPxeTemplates}, + DiBase => $c{"TftpDiBase_$tftpscope"} || $c{TftpDiBase}, + }; + + #----- finalise ----- + $mjobdb->host_check_allocated($ho); logm("host: selected $ho->{Name} ". @@ -1181,6 +1196,7 @@ sub selectguest ($$) { Guest => $gn, Name => $r{"${gn}_hostname"}, CfgPath => $r{"${gn}_cfgpath"}, + Tftp => $ho->{Tftp}, Host => $ho, }; foreach my $opt (guest_var_commalist($gho,'options')) { @@ -1841,7 +1857,7 @@ sub host_pxefile ($) { $v{'ipaddr'} = $ip; $v{'ipaddrhex'} = sprintf "%02X%02X%02X%02X", split /\./, $ip; } - foreach my $pat (split /\s+/, $c{TftpPxeTemplates}) { + foreach my $pat (split /\s+/, $ho->{Tftp}{PxeTemplates}) { # we skip patterns that contain any references to undefined %var%s $pat =~ s{\%(\w*)\%}{ $1 eq '' ? '%' : @@ -1851,14 +1867,14 @@ sub host_pxefile ($) { # and return the first pattern we managed to completely substitute return $pat; } - die "no pxe template matched $c{TftpPxeTemplates} ". + die "no pxe template matched $ho->{Tftp}{PxeTemplates} ". (join ",", sort keys %v)." ?"; } sub setup_pxeboot ($$) { my ($ho, $bootfile) = @_; my $f= host_pxefile($ho); - file_link_contents("$c{TftpPath}$c{TftpPxeDir}$f", $bootfile); + file_link_contents("$ho->{Tftp}{Path}$ho->{Tftp}{PxeDir}$f", $bootfile); } sub setup_pxeboot_local ($) { diff --git a/README b/README index 60379c4..8325975 100644 --- a/README +++ b/README @@ -326,6 +326,10 @@ HostProp__RebootTimeExtra where Xen takes really long time to boot (typically because of the "Scrubbing free RAM" phase). +HostProp__TftpScope + Defines the Tftp scope (i.e. subnet) where this host resides. See + "TftpFoo_ and TftpFoo" below. + DebianPreseed Text to add to the debian-installer preseed file. Optional but you will need to set some NTP servers here if your firewall @@ -391,6 +395,27 @@ GuestDebianSuite defaults to DebianSuite DebianPreseed added to existing preseed file +TftpFoo_ and TftpFoo + + Describes various properties relating to Tftp in a given , + where a is a given subnet, DHCP server etc. Valid + properties are: + + Path The path to the root of the directory which is exposed by + the tftpserver (e.g. /tftpboot). + TmpDir A directory under `Path' to use for temporary files. + + PxeDir The path under `Path' to the PXE configuration directory + (e.g. pxelinux.cfg) + PxeGroup The Unix group which should own files under `PxeDir'. + PxeTemplates See TftpPxeTemplates + + DiBase The path under `Path' to the root of the debian installer + images. + + The is a host property which defaults to TftpDefaultScope + or "default". TftpFoo_default takes precedence of TftpFoo. + TftpPxeTemplates List (space-separated) of template filenames for writing The templates contain variable substitutions %var% diff --git a/mg-hosts b/mg-hosts index e409201..d7223a1 100755 --- a/mg-hosts +++ b/mg-hosts @@ -44,8 +44,8 @@ sub cmd_mkpxedir () { $macdir =~ s/\:/-/g; system_checked(<{Tftp}{Path}$ho->{Tftp}{PxeDir} + sudo chown root.$ho->{Tftp}{PxeGroup} $macdir sudo chmod 2775 $macdir sudo rm -f $hn sudo ln -s $macdir $hn diff --git a/ts-host-install b/ts-host-install index 8e119ca..95ce845 100755 --- a/ts-host-install +++ b/ts-host-install @@ -122,19 +122,19 @@ END sub setup_pxeboot_firstboot($) { my ($ps_url) = @_; - my $d_i= $c{TftpDiBase}.'/'.$r{arch}.'/'.$c{TftpDiVersion}.'-'.$ho->{Suite}; + my $d_i= $ho->{Tftp}{DiBase}.'/'.$r{arch}.'/'.$c{TftpDiVersion}.'-'.$ho->{Suite}; my @installcmdline= qw(vga=normal); push @installcmdline, di_installcmdline_core($ho, $ps_url, %xopts); my $src_initrd= "$d_i/initrd.gz"; - my @initrds= "$c{TftpPath}/$src_initrd"; + my @initrds= "$ho->{Tftp}{Path}/$src_initrd"; my $kernel; foreach my $fp (keys %{ $ho->{Flags} }) { $fp =~ s/^need-firmware-deb-// or next; - my $cpio= "$c{TftpPath}/$d_i/$fp.cpio.gz"; + my $cpio= "$ho->{Tftp}{Path}/$d_i/$fp.cpio.gz"; if (stat $cpio) { logm("using firmware from: $cpio"); push @initrds, $cpio; @@ -147,7 +147,7 @@ sub setup_pxeboot_firstboot($) { foreach my $kp (keys %{ $ho->{Flags} }) { $kp =~ s/need-kernel-deb-// or next; - my $kern= "$c{TftpPath}/$d_i/linux.$kp"; + my $kern= "$ho->{Tftp}{Path}/$d_i/linux.$kp"; if (stat $kern) { logm("using kernel from: $kern"); $kernel = "/$d_i/linux.$kp"; @@ -157,7 +157,7 @@ sub setup_pxeboot_firstboot($) { die "$kp $kern $!"; } - my $cpio= "$c{TftpPath}/$d_i/$kp.cpio.gz"; + my $cpio= "$ho->{Tftp}{Path}/$d_i/$kp.cpio.gz"; if (stat $cpio) { logm("using kernel modules from: $cpio"); push @initrds, $cpio; @@ -196,8 +196,8 @@ END push @initrds, "$initrd_overlay.cpio.gz"; logm("using initrds: @initrds"); - my $initrd= "$c{TftpTmpDir}$ho->{Name}--initrd.gz"; - system_checked("cat -- @initrds >$c{TftpPath}$initrd"); + my $initrd= "$ho->{Tftp}{TmpDir}$ho->{Name}--initrd.gz"; + system_checked("cat -- @initrds >$ho->{Tftp}{Path}$initrd"); push @installcmdline, ("initrd=/$initrd", "domain=$c{TestHostDomain}",