From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: [OSSTEST PATCH 23/26] rumprun: `rumpbake' our executables and run them with `rumprun'
Date: Mon, 5 Sep 2016 15:02:31 +0100 [thread overview]
Message-ID: <1473084154-396-24-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1473084154-396-1-git-send-email-ian.jackson@eu.citrix.com>
(Well, our one executable: xenstore-ls)
Modern rumprun requires the output of the linker to be `baked' (second
link phase, where the complete unikernel is assembled).
This has to be done as part of the build, because it needs all the
rumpkernel libraries. It generates a single image file - there is no
longer any disk image or config file produced by the rump ecosystem.
The baked file needs to be provided in a dist. We have
ts-rumprun-bake take command line argument specifying which things to
bake. It reads the runvars for the source executables and creates a
single dist output containing the images. There are now `executables'
and `images'.
Furthermore modern rumprun requires the image to be run with
`rumprun'. One underlying reason is that it wants to pass the command
line and some other config parameters to the guest via xenstore, in
/local/domain/GUEST/rumprun/cfg. To do this outside xl requires the
domain to be created paused. Another is to abstract away details of
the actual execution environment (compared to other unikernel
execution models).
rumprun has a mode (-D -T) in which it would be possible to fish the
configuration and the desired json object (for the cfg) out of the
tempfile it creates. It might also be possible for osstest to
construct these out of whole cloth.
However, this would be undesirable because it would break if rumprun
changed (in particular, if the interface to the domain creation
changed).
And because of the cfg wrinkle it still wouldn't let us construct a
domain config file which could be passed to
toolstack($ho)->guest_create.
So instead we invent Osstest::Rumprun::rumprun_guest_create, which
invokes rumprun. rumprun implicitly invokes xl.
The config editing which was previously done by ts-rumprun-demo-setup
is now done by passing appropriate options to rumprun.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
Osstest/RumpRun.pm | 67 ++++++++++++++++++++++++++++++++++
make-flight | 2 +-
sg-run-job | 2 ++
ts-rumprun-bake | 89 ++++++++++++++++++++++++++++++++++++++++++++++
ts-rumprun-demo-setup | 52 ++++-----------------------
ts-rumprun-demo-xenstorels | 3 +-
6 files changed, 167 insertions(+), 48 deletions(-)
create mode 100644 Osstest/RumpRun.pm
create mode 100755 ts-rumprun-bake
diff --git a/Osstest/RumpRun.pm b/Osstest/RumpRun.pm
new file mode 100644
index 0000000..0582bd2
--- /dev/null
+++ b/Osstest/RumpRun.pm
@@ -0,0 +1,67 @@
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2013 Citrix Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+package Osstest::RumpRun;
+
+use strict;
+use warnings;
+
+use Osstest::TestSupport;
+
+BEGIN {
+ use Exporter ();
+ our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
+ $VERSION = 1.00;
+ @ISA = qw(Exporter);
+ @EXPORT = qw(
+ rumprun_guest_create
+ );
+ %EXPORT_TAGS = ( );
+
+ @EXPORT_OK = qw();
+}
+
+sub rumprun_guest_create ($) {
+ my ($gho) = @_;
+ my $ho = $gho->{Host};
+ my $gn = $gho->{Guest};
+ guest_prepare_disk($gho);
+
+ my $rumprun = target_var($gho, 'rumprun_path');
+ if (!$rumprun) {
+ logm("finding rumprun to use for $gho->{Name} on $ho->{Name}");
+ my $buildjob = $r{guests_rumprunbuildjob} // # todo: eliminate this
+ target_var($gho, 'rumprunbuildjob');
+ my $rumprundist = target_extract_jobdistpath_subdir
+ ($ho, "rumprun-rumprun-g-$gho->{Name}", "rumprun", $buildjob);
+ $rumprun = "$rumprundist/rumprun";
+ store_runvar("${gn}_rumprun_path", $rumprun);
+ }
+
+ my $imagepath = $r{"${gn}_imagepath"};
+ my $cmdline = guest_var($gho, 'cmdline', undef);
+
+ my $cmd = "$rumprun xen";
+ $cmd .= " -N $gn";
+ $cmd .= " -IIFTAG,IFBASENAME,mac=$gho->{Ether}";
+ $cmd .= " $imagepath";
+ $cmd .= " $cmdline";
+
+ target_cmd_root($ho, $cmd, 100);
+}
+
+1;
diff --git a/make-flight b/make-flight
index 906bf2b..c94dfa4 100755
--- a/make-flight
+++ b/make-flight
@@ -203,7 +203,7 @@ do_rumpkernel_tests () {
guests_rumprunbuildjob=build-$rumparch-rumprun \
rump_builtimage=rumprun:/usr/local/lib/xen/rump-kernel/rump-kernel \
rump_cmdline=3 \
- xenstorels_builtimage=:/usr/local/bin/xenstore \
+ xenstorels_builtimage=rumpimages:xenstorels \
xenstorels_cmdline='ls -fp device' \
all_hostflags=$most_hostflags
}
diff --git a/sg-run-job b/sg-run-job
index eb3df26..6d455c7 100755
--- a/sg-run-job
+++ b/sg-run-job
@@ -478,6 +478,8 @@ proc run-job/build-libvirt {} {
proc run-job/build-rumprun {} {
run-ts . = ts-rumprun-build
run-ts . = ts-xen-build + host --no-kconfig tools
+ run-ts . = ts-rumprun-bake + host \
+ xenstorels ::/usr/local/bin/xenstore-ls
}
proc prepare-build-host {} {
diff --git a/ts-rumprun-bake b/ts-rumprun-bake
new file mode 100755
index 0000000..d79d6f8
--- /dev/null
+++ b/ts-rumprun-bake
@@ -0,0 +1,89 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2013 Citrix Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# ts-rumprun-bake HOST IMAGENAME [JOB]:DIST:SUBPATH [IMAGENAME ... [... ...]]
+#
+# Generates a dist stash `rumpimages' containg files IMAGENAME
+# From the specified files
+
+use strict qw(vars);
+use DBI;
+use Osstest;
+use Osstest::TestSupport;
+use Osstest::BuildSupport;
+
+tsreadconfig();
+
+our ($whhost,$gn) = @ARGV;
+selectbuildhost(\@ARGV);
+
+
+
+our %images;
+
+our $jobdir = target_jobdir($ho);
+our $imagesdir = $jobdir.'/rumpbake-images';
+our $rumpbake = $jobdir.'/rumprun/rumprun/bin/rumprun-bake';
+
+target_cmd($ho, "mkdir -p $imagesdir");
+
+sub bakeimage ($$) {
+ my ($name,$spec) = @_;
+
+ $spec =~ m/^(.*?)\:(.*?)\:/ or die "$spec ?";
+ my $buildjob = $1;
+ my $execpart = $2;
+ my $execpath = $';
+
+ logm("baking rump image $name from $spec");
+
+# my $rumpbake = target_extract_jobdistpath_subdir
+# ($ho, 'rumpbake-base', 'rumprun', $r{guests_rumprunbuildjob});
+# $rumpbake = "$rumpbake/rumpbake";
+
+ my $execdist;
+ eval {
+ $execdist = target_extract_jobdistpath_subdir
+ ($ho, "rumpbake-n-$name", $execpart, $buildjob || $job);
+ };
+ if ($@) {
+ warn "skipping: $@";
+ return;
+ }
+ my $execfile = $execdist.$execpath;
+
+ target_cmd_build($ho, 1000, $imagesdir, <<END);
+ if test -f $execfile; then
+ $rumpbake xen_pv $name $execfile
+ fi
+END
+}
+
+sub stash () {
+ built_stash($ho, "$jobdir", "rumpbake-images", "rumpimagesdist");
+}
+
+while (@ARGV) {
+ die unless @ARGV>=2;
+ my $name = shift @ARGV;
+ my $rumpexec = shift @ARGV;
+ eval {
+ bakeimage($name,$rumpexec);
+ };
+}
+
+stash();
diff --git a/ts-rumprun-demo-setup b/ts-rumprun-demo-setup
index 655328f..212d758 100755
--- a/ts-rumprun-demo-setup
+++ b/ts-rumprun-demo-setup
@@ -35,58 +35,18 @@ our $rkdist;
sub prep () {
$gho = prepareguest($ho, $gn, $gn, 4096, undef, 30);
- my $cfg_rkdist = target_extract_jobdistpath_subdir
- ($ho, 'rumprun--base', 'rumprun',
- $r{guests_rumprunbuildjob});
- $cfg_rkdist .= '/usr/local/lib/xen/rump-kernel';
-
- my $buildjob = guest_var($gho, 'rumprunbuildjob', undef);
my $builtimage = guest_var($gho, 'builtimage', undef);
+ my $buildjob = guest_var($gho, 'rumprunbuildjob', undef);
+
$builtimage =~ m/\:/ or die "$builtimage ?";
my $builtimage_part = $`;
my $builtimage_subpath = $'; #';
- $rkdist = target_extract_jobdistpath_subdir
- ($ho, "rumprun-$gn", $builtimage_part, $buildjob);
- my $imagefile = $rkdist.$builtimage_subpath;
- my $cmdline = guest_var($gho, 'cmdline', undef);
-
- my @images;
-
- my $fsimagesdir = target_jobdir($ho)."/$gn-images";
- my $cfgfile = "$gn.cfg";
- my $cfgpath = "/etc/xen/$cfgfile";
- target_editfile_root($ho, "$cfg_rkdist/domain_config", $cfgfile, $cfgpath,
- sub {
- while (<EI>) {
- next if m/^\s*\#/;
- next unless m/\S/;
-
- my $in = $& if m/^\w\S*/;
-
- s# = .* # " = '$gn'" #xe if $in eq 'name';
- s# = .* # " = '$imagefile'" #xe if $in eq 'kernel';
- s#\b mac=[0-9a-f:]+ # "mac=$gho->{Ether}" #xe if $in eq 'vif';
- s# = .* # " = '$cmdline'" #xe if $in eq 'extra';
-
- if ($in eq 'disk') {
- s{\b img/(\w+.ffs) \b}{
- push @images, $1;
- "$fsimagesdir/$1";
- }xeg;
- }
-
- print EO or die $!;
- }
- });
-
- store_runvar("$gho->{Guest}_cfgpath", $cfgpath);
+ $rkdist = target_extract_jobdistpath_subdir
+ ($ho, "rumprun-g-$gn", $builtimage_part, $buildjob);
+ my $imagepath = $rkdist.'/'.$builtimage_subpath;
- target_cmd($ho, <<END.(join "\n", map { <<END; } @images), 200);
- mkdir -p $fsimagesdir
-END
- cp $cfg_rkdist/img/$_ $fsimagesdir/$_
-END
+ store_runvar("${gn}_imagepath", $imagepath);
}
prep();
diff --git a/ts-rumprun-demo-xenstorels b/ts-rumprun-demo-xenstorels
index a54fbf4..47aa289 100755
--- a/ts-rumprun-demo-xenstorels
+++ b/ts-rumprun-demo-xenstorels
@@ -19,6 +19,7 @@ use strict qw(vars);
use DBI;
use Osstest;
use Osstest::TestSupport;
+use Osstest::RumpRun;
use Data::Dumper;
tsreadconfig();
@@ -44,7 +45,7 @@ sub arrangepreserve () {
}
sub start () {
- guest_create($gho);
+ rumprun_guest_create($gho);
$domid = guest_find_domid($ho, $gho);
}
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-09-05 14:02 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-05 14:02 [OSSTEST PATCH 00/26] rump kernels: Fix build Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 01/26] Executive: Do update flights_harness_touched for play flights Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 02/26] Executive: Allow out-of-order manipulations of flights intended play Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 03/26] TestSupport: Produce stack trace for undef tfileex Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 04/26] rumprun: Rename all `rumpuserxen' to `rumprun' Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 05/26] rumprun: Fetch source from new upstream Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 06/26] rumprun: Move xenbits tree to osstest subdir Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 07/26] rumprun: ts-rumprun-build: Remove $bodges Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 08/26] rumprun: ts-rumprun-build: Build new rumprun properly, ship the output Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 09/26] rumprun: ts-rumprun-build: Adjust command prefixes for new rumprun Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 10/26] ts-xen-build: Separate out kconfig from main build step Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 11/26] ts-xen-build: Support $r{cmdsuffix_configure} Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 12/26] ts-xen-build: Support --no-kconfig Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 13/26] rumprun: ts-rumprun-build: Update for new rumprun bin location Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 14/26] rumprun: ts-rumprun-build: Update for newer Xen Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 15/26] rumprun: Drop old rumpuserxen demo Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 16/26] rumprun: Do not run xen/Kconfig Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 17/26] rumprun: Break out findtools Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 18/26] rumprun: ts-rumprun-build: set up ccache Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 19/26] Xen built versions: Move list of subtrees to BuildSupport Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 20/26] Xen built versions: ts-xen-build: check versions of Xen subtrees, only Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 21/26] rumprun: Do not stash whole build tree Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 22/26] TestSupport: guest_prepare_disk: cope with no disk Ian Jackson
2016-09-05 14:02 ` Ian Jackson [this message]
2016-09-05 14:02 ` [OSSTEST PATCH 24/26] rumprun: xenstorels: Do not attempt to edit the config file Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 25/26] rumprun: xenstorels: New regexps for finding output Ian Jackson
2016-09-05 14:02 ` [OSSTEST PATCH 26/26] rumprun: xenstorels: Improve an error message slightly Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1473084154-396-24-git-send-email-ian.jackson@eu.citrix.com \
--to=ian.jackson@eu.citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).