All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 00/11] osstest: add a FreeBSD host
@ 2015-02-18 16:18 Roger Pau Monne
  2015-02-18 16:18 ` [PATCH v4 01/11] osstest: allow to disable the usage of a know_host file Roger Pau Monne
                   ` (10 more replies)
  0 siblings, 11 replies; 21+ messages in thread
From: Roger Pau Monne @ 2015-02-18 16:18 UTC (permalink / raw)
  To: xen-devel

Hello,

The following series enables setting up a FreeBSD PVH Dom0 host. Although 
this is marked as "v4" it should clearly have the RFC tag. The flow is based 
on the following diagram:

http://xenbits.xen.org/people/royger/osstest_freebsd.jpg

Patch 7 introduces a new management script, mg-freebsd-installer-update, but 
since this should be automatically executed when the FreeBSD/mfsBSD pushgate 
is updated it needs to be moved somewhere else, it's just that I'm not sure 
how the pushgate stuff works in order to integrate it.

Also the last patch, which adds two FreeBSD specific buildjobs, is 
dodgy and needs some close review.

Thanks, Roger.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v4 01/11] osstest: allow to disable the usage of a know_host file
  2015-02-18 16:18 [PATCH v4 00/11] osstest: add a FreeBSD host Roger Pau Monne
@ 2015-02-18 16:18 ` Roger Pau Monne
  2015-03-19 14:52   ` Ian Campbell
  2015-02-18 16:18 ` [PATCH v4 02/11] osstest: add routine to execute ssh with password Roger Pau Monne
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Roger Pau Monne @ 2015-02-18 16:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Campbell, Roger Pau Monne

This is only used by target_cmd_root and target_putfile_root and will be
needed for mfsBSD which generates new keys on each boot.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/TestSupport.pm | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 5ac66e5..d930e55 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -374,14 +374,21 @@ sub remote_perl_script_done ($) {
 
 sub sshuho ($$) { my ($user,$ho)= @_; return "$user\@$ho->{Ip}"; }
 
-sub sshopts () {
+sub sshopts {
+    my ($disable_hosts) = @_;
+    my $hosts = "tmp/t.known_hosts_$flight.$job";
+
+    if (defined $disable_hosts) {
+        $hosts = "/dev/null";
+    }
+
     return [ qw(-o StrictHostKeyChecking=no
                 -o BatchMode=yes
                 -o ConnectTimeout=100
                 -o ServerAliveInterval=100
                 -o PasswordAuthentication=no
                 -o ChallengeResponseAuthentication=no),
-             '-o', "UserKnownHostsFile=tmp/t.known_hosts_$flight.$job"
+             '-o', "UserKnownHostsFile=$hosts"
              ];
 }
 
@@ -412,16 +419,16 @@ sub target_getfile_root ($$$$) {
 }
 
 sub tputfileex {
-    my ($ruser, $ho,$timeout, $lsrc,$rdst, $rsync) = @_;
+    my ($ruser, $ho,$timeout, $lsrc,$rdst, $rsync, $disable_hosts) = @_;
     my @args= ($lsrc, sshuho($ruser,$ho).":$rdst");
     if (!defined $rsync) {
         tcmdex($timeout,undef,
-               'scp', sshopts(),
+               'scp', sshopts($disable_hosts),
                @args);
     } else {
         unshift @args, $rsync if length $rsync;
         tcmdex($timeout,undef,
-               'rsync', [ '-e', 'ssh '.join(' ',@{ sshopts() }) ],
+               'rsync', [ '-e', 'ssh '.join(' ',@{ sshopts($disable_hosts) }) ],
                @args);
     }
 }
@@ -429,7 +436,7 @@ sub target_putfile ($$$$;$) {
     # $ho,$timeout,$lsrc,$rdst,[$rsync_opt]
     tputfileex('osstest', @_);
 }
-sub target_putfile_root ($$$$;$) {
+sub target_putfile_root ($$$$;$$) {
     tputfileex('root', @_);
 }
 sub target_run_apt {
@@ -569,14 +576,14 @@ sub target_await_down ($$) {
 }    
 
 sub tcmd { # $tcmd will be put between '' but not escaped
-    my ($stdout,$user,$ho,$tcmd,$timeout) = @_;
+    my ($stdout,$user,$ho,$tcmd,$timeout,$disable_hosts) = @_;
     $timeout=30 if !defined $timeout;
     tcmdex($timeout,$stdout,
-           'ssh', sshopts(),
+           'ssh', sshopts($disable_hosts),
            sshuho($user,$ho), $tcmd);
 }
 sub target_cmd ($$;$) { tcmd(undef,'osstest',@_); }
-sub target_cmd_root ($$;$) { tcmd(undef,'root',@_); }
+sub target_cmd_root ($$;$$) { tcmd(undef,'root',@_); }
 
 sub tcmdout {
     my $stdout= IO::File::new_tmpfile();
-- 
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v4 02/11] osstest: add routine to execute ssh with password
  2015-02-18 16:18 [PATCH v4 00/11] osstest: add a FreeBSD host Roger Pau Monne
  2015-02-18 16:18 ` [PATCH v4 01/11] osstest: allow to disable the usage of a know_host file Roger Pau Monne
@ 2015-02-18 16:18 ` Roger Pau Monne
  2015-03-19 14:58   ` Ian Campbell
  2015-02-18 16:18 ` [PATCH v4 03/11] osstest: store a path runvar for built_stash_file Roger Pau Monne
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Roger Pau Monne @ 2015-02-18 16:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Campbell, Roger Pau Monne

This is needed when bootstrapping FreeBSD, since the installer has ssh
enabled with the root password set to 'root' by default.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
---
Changes since RFC:
 - Place the temp filename in a local variable.
 - Add error checks.
---
 Osstest/TestSupport.pm | 43 ++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 38 insertions(+), 5 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index d930e55..0c72faa 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -60,6 +60,7 @@ BEGIN {
                       target_install_packages target_install_packages_norec
                       target_jobdir target_extract_jobdistpath_subdir
                       target_extract_jobdistpath target_guest_lv_name
+                      target_cmd_root_with_password
 
                       poll_loop tcpconnect await_tcp
                       contents_make_cpio file_simple_write_contents
@@ -314,12 +315,11 @@ END
 #---------- running commands eg on targets ----------
 
 sub cmd {
-    my ($timeout,$stdout,@cmd) = @_;
+    my ($timeout,$child_sub,@cmd) = @_;
     my $child= fork;  die $! unless defined $child;
     if (!$child) {
-        if (defined $stdout) {
-            open STDOUT, '>&', $stdout
-                or die "STDOUT $stdout $cmd[0] $!";
+        if (defined $child_sub) {
+            $child_sub->();
         }
         exec @cmd;
         die "$cmd[0]: $!";
@@ -585,9 +585,42 @@ sub tcmd { # $tcmd will be put between '' but not escaped
 sub target_cmd ($$;$) { tcmd(undef,'osstest',@_); }
 sub target_cmd_root ($$;$$) { tcmd(undef,'root',@_); }
 
+sub target_cmd_root_with_password {
+    my ($ho,$tcmd,$timeout,$password, $disable_hosts) = @_;
+    my $temp_name = "tmp/t.ssh-password-helper.$flight.$job";
+
+    open(my $temp_fh, '>', $temp_name)
+      or die "Cannot open $temp_name: $!";
+    print $temp_fh "#!/bin/sh\n\necho \"$password\"\n"
+      or die "Cannot write to $temp_name: $!";
+    chmod 0755, $temp_name
+      or die "Cannot chmod $temp_name: $!";
+    close $temp_fh
+      or die "Cannot close $temp_name: $!";
+
+    my $child_sub = sub {
+                           $ENV{DISPLAY} = ":0";
+                           $ENV{SSH_ASKPASS} = "tmp/t.ssh-password-helper.$flight.$job";
+                           setsid or die "Can't start a new session: $!";
+                        };
+
+    my $ssh_opts = [qw(-o BatchMode=no
+                       -o PasswordAuthentication=yes
+                       -o ChallengeResponseAuthentication=yes),
+                    @{ sshopts($disable_hosts) }];
+
+    tcmdex($timeout,$child_sub,
+           'ssh', $ssh_opts,
+           sshuho("root",$ho), $tcmd);
+
+    unlink $temp_fh;
+}
+
 sub tcmdout {
     my $stdout= IO::File::new_tmpfile();
-    tcmd($stdout,@_);
+    my $stdout_sub = sub { open STDOUT, '>&', $stdout
+                              or die "STDOUT $stdout $!"; };
+    tcmd($stdout_sub,@_);
     $stdout->seek(0,0) or die "$stdout $!";
     my $r;
     { local ($/) = undef;
-- 
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v4 03/11] osstest: store a path runvar for built_stash_file
  2015-02-18 16:18 [PATCH v4 00/11] osstest: add a FreeBSD host Roger Pau Monne
  2015-02-18 16:18 ` [PATCH v4 01/11] osstest: allow to disable the usage of a know_host file Roger Pau Monne
  2015-02-18 16:18 ` [PATCH v4 02/11] osstest: add routine to execute ssh with password Roger Pau Monne
@ 2015-02-18 16:18 ` Roger Pau Monne
  2015-03-19 15:01   ` Ian Campbell
  2015-02-18 16:18 ` [PATCH v4 04/11] osstest: add support for installing bare metal FreeBSD Roger Pau Monne
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Roger Pau Monne @ 2015-02-18 16:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Campbell, Roger Pau Monne

This mimics the behaviour of built_stash.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/TestSupport.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 0c72faa..4d35a19 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -1221,6 +1221,7 @@ sub built_stash_file ($$$$;$) {
     target_getfile($ho, 300,
                    "$builddir/$fname",
                    "$stash/$stashleaf");
+    store_runvar("path_$item", $stashleaf);
 }
 
 sub built_compress_stashed($) {
-- 
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v4 04/11] osstest: add support for installing bare metal FreeBSD
  2015-02-18 16:18 [PATCH v4 00/11] osstest: add a FreeBSD host Roger Pau Monne
                   ` (2 preceding siblings ...)
  2015-02-18 16:18 ` [PATCH v4 03/11] osstest: store a path runvar for built_stash_file Roger Pau Monne
@ 2015-02-18 16:18 ` Roger Pau Monne
  2015-03-19 15:13   ` Ian Campbell
  2015-02-18 16:18 ` [PATCH v4 05/11] osstest: add script for building custom mfsBSD images Roger Pau Monne
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Roger Pau Monne @ 2015-02-18 16:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Campbell, Roger Pau Monne

This is done using mfsBSD, which can be booted from pxelinux and
contains a script to automatically install FreeBSD using ZFS on root.
After the install the host is set to boot from the local disk.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
---
Changes since RFC:
 - Set the bridge to use the MAC from the first added interface
   instead of generating a random one.
 - Launch DHCP on the bridge instead of the nic.
 - Add a list of FreeBSD ftp mirrors and iterate over them in order to
   find a working one.
 - Add support for finding the primary disk and nic automatically.
 - Switch shell to sh (instead of the default csh), and use set -e in
   order to exit if a command fails.
 - Replace echo "-Dh" with printf "%s" "-Dh".
 - Copy installer keys into the installed system in order to prevent
   it from generating new keys on the first boot.
---
 production-config       |   2 +
 ts-freebsd-host-install | 283 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 285 insertions(+)
 create mode 100755 ts-freebsd-host-install

diff --git a/production-config b/production-config
index 515bd98..fefc467 100644
--- a/production-config
+++ b/production-config
@@ -86,6 +86,8 @@ HostProp_GenEtherPrefixBase 5a:36:0e:00
 #                                      :00:01 guest number in job appended
 #                                    ^^ xor'd with low 8 bits of flight
 
+FreeBSDVersion current
+
 AuthorizedKeysAppend= <<'END'
 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq8eHHFJ+XHYgpHxfSdciq0b3tYPdMhHf9CgtwdKGSqCyDyocbn1jX6P0Z535K/JcVaxvaRQbGDl9FZ25neQw6lysE8pGf+G353mgLAE7Lw6xKqlTXDcR0GpKHiZUyY8Ck5AJlGF2MO0cDEzMBx+xkOahDBvAozikUcDHJsTNP+UUIGoRaPeQK0DfgprPkoaLzXFDiZvEoBtYcUUieuNygJt+QVM+ovyTXC68wg5Xb5Ou2PopmDaVMX6/A1HxziTWc3XdhOF5ocuRF/kfWpZL223Auuu/xvNQDly13DhuVlQiU3gRIP7BSCwCdsQC/K68Q6SgfBklKRiqHquYo/QyNQ== osstest@woking.xci-test.com
 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAs6FF9nfzWIlLPeYdqNteJBoYJAcgGxQgeNi7FHYDgWNFhoYPlMPXWOuXhgNxA2/vkX9tUMVZaAh+4WTL1iRBW5B/AS/Ek2O7uM2Uq8v68D2aU9/XalLVnIxssr84pewUmKW8hZfjNnRm99RTQ2Knr2BvtwcHqXtdGYdTYCJkel+FPYQ51yXGRU7dS0D59WapkDFU1tH1Y8s+dRZcRZNRJ5f1w/KO1zx1tOrZRkO3fPlEGNZHVUYfpZLPxz0VX8tOeoaOXhKZO8vSp1pD0L/uaD6FOmugMZxbtq9wEjhZciNCq61ynRf2yt2v9DMu4EAzbW/Ws7OBvWtYj/RHcSxKbw== iwj@woking.xci-test.com
diff --git a/ts-freebsd-host-install b/ts-freebsd-host-install
new file mode 100755
index 0000000..2097c66
--- /dev/null
+++ b/ts-freebsd-host-install
@@ -0,0 +1,283 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2014 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/>.
+
+use strict qw(vars);
+use DBI;
+use POSIX;
+
+use Osstest;
+use Osstest::TestSupport;
+use Osstest::Logtailer;
+
+use File::Basename;
+use File::Copy;
+use File::Path;
+use Cwd 'abs_path';
+
+tsreadconfig();
+
+our ($whhost) = grep /host=/, @ARGV;
+$whhost ||= 'host';
+our $ho= selecthost($whhost);
+exit 0 if $ho->{Flags}{'no-reinstall'};
+exit 0 if $ho->{SharedReady};
+
+our %timeout= qw(ReadPreseed  350
+                 Sshd        2400);
+
+our @disk_names = qw(ada0 da0 ad0);
+our @sets = qw(kernel.txz base.txz MANIFEST);
+
+defined($r{freebsd_buildjob}) or defined($c{FreeBSDVersion}) or
+    die "don't know which FreeBSD version to install";
+
+sub get_mfsbsd() {
+
+    # Figure out the path to the mfsBSD image we have to use.
+    # This can either come from a previous buildjob or from
+    # a pre-seeded image.
+
+    if ($r{freebsd_buildjob}) {
+        # We are going to use the build output from a previous job.
+        return get_stashed('path_mfsbsd.img', $r{freebsd_buildjob});
+    } else {
+        # We are going to use a pre-seeded version.
+        return "$c{Images}/freebsd/$c{FreeBSDVersion}/$r{arch}/mfsbsd.img";
+    }
+}
+
+sub get_set($) {
+    my ($set) = @_;
+
+    if ($r{freebsd_buildjob}) {
+        # We are going to use the build output from a previous job.
+        return get_stashed("path_$set", $r{freebsd_buildjob});
+    } else {
+        # We are going to use a pre-seeded version.
+        return "$c{Images}/freebsd/$c{FreeBSDVersion}/$r{arch}/$set";
+    }
+}
+
+sub setup_sets() {
+    my $webfolder = "$c{WebspaceFile}/$c{WebspaceCommon}/freebsd/$ho->{Name}";
+
+    # Link the sets to the public http folder
+    rmtree($webfolder);
+    mkpath($webfolder);
+    foreach my $set (@sets) {
+        my $set_src = abs_path(get_set($set));
+        logm("Using install set: $set_src");
+        symlink $set_src,"$webfolder/$set" or die "Unable to create symlink: $!";
+    }
+}
+
+sub setup_pxeboot_firstboot() {
+    # copy mfsBSD image from the images folder to the tftp folder.
+    my $mfs_src = get_mfsbsd();
+    my $mfs = "$ho->{Tftp}{TmpDir}/mfsbsd-$ho->{Name}.img";
+    unlink "$ho->{Tftp}{Path}/$mfs";
+
+    logm("Using mfsBSD image: $mfs_src");
+    copy($mfs_src, "$ho->{Tftp}{Path}/$mfs") or die "Unable to copy image file: $!";
+
+    setup_pxeboot($ho, <<END);
+serial 0 $c{Baud}
+timeout 5
+label overwrite
+    menu label ^Overwrite
+    menu default
+    kernel memdisk
+    append initrd=$mfs
+default overwrite
+END
+}
+
+sub set_host_keys ($;$) {
+    my ($restart, $prefix) = @_;
+    my $target_path;
+
+    if (defined $prefix) {
+        $target_path = "$prefix/etc/ssh/";
+    } else {
+        $target_path = "/etc/ssh/";
+    }
+
+    logm("Copying overlay keys to: $target_path");
+
+    my @ssh_keys = glob("$c{OverlayLocal}/etc/ssh/*");
+    foreach my $key (@ssh_keys) {
+        target_putfile_root($ho, 10, $key, $target_path, undef, 1);
+        # Force the usage of the keys that we have uploaded.
+        # If not mfsBSD/FreeBSD defaults to the automatically generated
+        # ECDSA key.
+        if ($key !~ /pub$/) {
+            $key = basename($key);
+            target_cmd_root($ho, <<END, 100, 1);
+                set -e
+                echo 'HostKey /etc/ssh/$key' >> $target_path/sshd_config
+END
+        }
+    }
+
+    if ($restart) {
+        logm("Restarting sshd");
+        target_cmd_root($ho, <<END, 100, 1);
+            set -e
+            /etc/rc.d/sshd restart
+END
+    }
+}
+
+sub install () {
+    my $authkeys= authorized_keys();
+    my $disk = "";
+    my $nic = "";
+    my $ftp = "";
+
+    power_state($ho, 0);
+
+    setup_pxeboot_firstboot();
+
+    logm('Booting into mfsBSD');
+
+    sleep(power_cycle_time($ho));
+
+    power_state($ho, 1);
+
+    # Prepare the sets while the host boots
+    setup_sets();
+
+    logm('Waiting for host to boot');
+    await_tcp(get_timeout($ho,'boot',$timeout{Sshd}), 22, $ho);
+
+    logm('Setting host to boot from local disk on next boot');
+    setup_pxeboot_local($ho);
+
+    logm('Switching root shell to /bin/sh');
+    target_cmd_root_with_password($ho, 'chsh -s /bin/sh', 100, "root", 1);
+
+    logm('Setting up ssh keys for remote access');
+    target_cmd_root_with_password($ho, <<END, 100, "root", 1);
+        set -e
+        mkdir -p ~/.ssh
+        cat <<ENDKEYS >~/.ssh/authorized_keys
+$authkeys
+ENDKEYS
+END
+
+    set_host_keys(1);
+
+    foreach my $test_disk (@disk_names) {
+        logm("Probing for $test_disk existence");
+        my $output = target_cmd_output_root($ho,
+            'test -c /dev/'.$test_disk.' >/dev/null 2>&1 && echo "yes" || echo "no"',
+            200);
+        if ($output eq "yes") {
+            logm("Found a valid disk device: $test_disk");
+            $disk = $test_disk;
+            last;
+        }
+    }
+    length($disk) or die "Unable to find a valid disk, exiting";
+
+    my $sets_url = "$c{WebspaceUrl}/$c{WebspaceCommon}/freebsd/$ho->{Name}";
+    logm("Install of base system using ZFS on root, using sets from: $sets_url");
+    target_cmd_root($ho, <<END,2400);
+            set -e
+            gpart destroy -F $disk || true
+            zfsinstall -d $disk -u $sets_url -s 4g
+END
+
+    logm('Setting up ssh and keys for the installed system');
+    target_cmd_root($ho, <<END, 100);
+            set -e
+            echo 'sshd_enable="YES"' >> /mnt/etc/rc.conf
+            echo 'PermitRootLogin yes' >> /mnt/etc/ssh/sshd_config
+            mkdir -p /mnt/root/.ssh
+            cat <<ENDKEYS >/mnt/root/.ssh/authorized_keys
+$authkeys
+ENDKEYS
+END
+
+    logm('Setting up serial console');
+    target_cmd_root($ho, <<END, 100);
+            set -e
+            printf "%s" "-Dh" >> /mnt/boot.config
+            cat <<ENDB >>/mnt/boot/loader.conf
+boot_multicons="YES"
+boot_serial="YES"
+comconsole_speed="$c{Baud}"
+console="comconsole,vidconsole"
+boot_verbose="YES"
+ENDB
+END
+
+    logm("Trying to figure out primary nic device name");
+    $nic = target_cmd_output_root($ho,
+            'ifconfig | grep -B3 '.$ho->{Ip}.' | head -n1 | awk \'{print $1}\'|sed s/://',
+            200);
+    length($nic) or die "Unable to find primary network interface";
+
+    logm("Using $nic as primary nic interface");
+
+    logm('Setting up network');
+    target_cmd_root($ho, <<END, 100);
+            set -e
+            echo "net.link.bridge.inherit_mac=1" >> /mnt/boot/loader.conf
+            echo 'cloned_interfaces="bridge0"' >> /mnt/etc/rc.conf
+            echo 'ifconfig_bridge0="addm $nic SYNCDHCP"' >> /mnt/etc/rc.conf
+            echo 'ifconfig_$nic="up"' >> /mnt/etc/rc.conf
+END
+
+    if ($c{HttpProxy}) {
+        logm("Setting pkg proxy to: $c{HttpProxy}");
+        target_cmd_root($ho, <<END, 100);
+            set -e
+            mkdir -p /mnt/usr/local/etc/
+            echo 'PKG_ENV: { http_proxy = $c{HttpProxy} }' >> /mnt/usr/local/etc/pkg.conf
+END
+    }
+
+    logm('Setting up miscellaneous settings');
+    target_cmd_root($ho, <<END, 100);
+            set -e
+            cp /mnt/usr/share/zoneinfo/Europe/London /mnt/etc/localtime
+            echo 'sendmail_enable="NONE"' >> /mnt/etc/rc.conf
+END
+
+    set_host_keys(0, "/mnt");
+
+    logm('Rebooting into the installed system');
+    target_reboot($ho);
+
+    logm('Setting root shell to /bin/sh');
+    target_cmd_root($ho, 'chsh -s /bin/sh', 100);
+    logm('Adding osstest user');
+    target_cmd_root($ho, 'pw useradd osstest -m', 100);
+    target_cmd_root($ho, <<END, 100);
+            set -e
+            chsh -s /bin/sh osstest
+            mkdir -p /home/osstest/.ssh
+            cat <<ENDKEYS >/home/osstest/.ssh/authorized_keys
+$authkeys
+ENDKEYS
+END
+
+    logm('OK: install completed');
+}
+
+install();
-- 
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v4 05/11] osstest: add script for building custom mfsBSD images
  2015-02-18 16:18 [PATCH v4 00/11] osstest: add a FreeBSD host Roger Pau Monne
                   ` (3 preceding siblings ...)
  2015-02-18 16:18 ` [PATCH v4 04/11] osstest: add support for installing bare metal FreeBSD Roger Pau Monne
@ 2015-02-18 16:18 ` Roger Pau Monne
  2015-03-19 15:16   ` Ian Campbell
  2015-02-18 16:18 ` [PATCH v4 06/11] osstest: fix ts-build-check to work with freebsd_buildjob Roger Pau Monne
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Roger Pau Monne @ 2015-02-18 16:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Campbell, Roger Pau Monne

In order to test FreeBSD HEAD we need to build a mfsBSD installer and
sets based on the version that we want to test. This patch adds support for
building such mfsBSD image and sets.

In order to build the images sources from two different repositories are
needed. The first ones of course are the FreeBSD sources which can be
fetched from the official github mirror at:

https://github.com/freebsd/freebsd.git

And the mfsBSD sources which can be downloaded from:

https://github.com/mmatuska/mfsbsd.git

We would need to have a local copy of them in order to have a push gate like
we do for Linux, Qemu or SeaBIOS.

The workflow of this would be:

1. Setup a FreeBSD host using a RELEASE image (10.1 right now).
2. Fetch upstream FreeBSD sources and compile a fresh FreeBSD world +
kernel.
3. Generate a mfsBSD image using the output from the FreeBSD build process.
4. Stash all the resulting build files (MANIFEST, kernel.txz, base.txz and
mfsbsd.img).
5. Use the newly created mfsBSD image in order to boot and the uploaded
install sets with zfsinstall.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
---
 ts-freebsd-create-mfsbsd | 140 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 140 insertions(+)
 create mode 100755 ts-freebsd-create-mfsbsd

diff --git a/ts-freebsd-create-mfsbsd b/ts-freebsd-create-mfsbsd
new file mode 100755
index 0000000..561766f
--- /dev/null
+++ b/ts-freebsd-create-mfsbsd
@@ -0,0 +1,140 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2014 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/>.
+
+use strict qw(vars);
+use DBI;
+use POSIX;
+
+use Osstest;
+use Osstest::TestSupport;
+use Osstest::BuildSupport;
+
+tsreadconfig();
+selectbuildhost(\@ARGV);
+builddirsprops();
+
+sub pkg_install {
+
+    logm("Installing git");
+    target_cmd_root($ho, <<END, 1000);
+        set -e
+        export ASSUME_ALWAYS_YES="YES"
+        pkg install -y git
+END
+}
+
+sub build_freebsd {
+
+    # Since the build processes requires root access, we need to remove
+    # the folder as root also.
+    target_cmd_root($ho, <<END, 2400);
+        chflags -R noschg $builddir/freebsd
+        rm -rf $builddir/freebsd
+END
+
+    logm("Fetching FreeBSD sources");
+    build_clone($ho, 'freebsd', $builddir, 'freebsd');
+
+    logm("Building FreeBSD world");
+    target_cmd_root($ho, <<END, 1000);
+        set -e
+        chflags -R noschg /usr/obj
+        rm -rf /usr/obj/*
+        chmod 777 /usr/obj
+END
+
+    target_cmd_build($ho, 9000, $builddir, <<END);
+    rm -rf build-ok-stamp
+    cd freebsd
+        (make $makeflags buildworld 2>&1 && touch ../build-ok-stamp) |tee ../log-buildworld
+        test -f ../build-ok-stamp
+        echo ok.
+END
+
+    logm("Building FreeBSD kernel");
+    target_cmd_build($ho, 9000, $builddir, <<END);
+    rm -rf build-ok-stamp
+    cd freebsd
+        (make $makeflags buildkernel 2>&1 && touch ../build-ok-stamp) |tee ../log-buildkernel
+        test -f ../build-ok-stamp
+        echo ok.
+END
+
+    logm("Packing release files");
+    # Needs to be done as root...
+    target_cmd_root($ho, <<END, 2400);
+    cd $builddir
+    rm -rf build-ok-stamp
+    cd freebsd/release
+        (make ftp 2>&1 && touch ../../build-ok-stamp) |tee ../../log-release
+        test -f ../../build-ok-stamp
+        echo ok.
+END
+}
+
+sub build_mfsbsd {
+
+    # Since the build processes requires root access, we need to remove
+    # the folder as root also.
+    target_cmd_root($ho, <<END, 1000);
+        chflags -R noschg $builddir/mfsbsd
+        rm -rf $builddir/mfsbsd
+END
+
+    logm("Fetching mfsBSD sources");
+    build_clone($ho, 'mfsbsd', $builddir, 'mfsbsd');
+    target_cmd_build($ho, 100, $builddir, <<END);
+        set -e
+        cd mfsbsd
+        printf "%s" "-Dh" > conf/boot.config
+        cp conf/loader.conf.sample conf/loader.conf
+        cp conf/ttys.sample conf/ttys
+        sed -i .bak 's/std.[^"]*/std.$c{Baud}/' conf/ttys
+        cat <<ENDB >> conf/loader.conf
+mfsbsd.rootpw="root"
+boot_multicons="YES"
+boot_serial="YES"
+comconsole_speed="$c{Baud}"
+console="comconsole,vidconsole"
+boot_verbose="YES"
+ENDB
+END
+
+    target_cmd_root($ho, <<END, 2400);
+        cd $builddir
+        rm -rf build-ok-stamp
+        cd mfsbsd
+        (make BASE=../freebsd/release/ftp PKG_STATIC=`which pkg-static` RELEASE="HEAD" 2>&1 && touch ../build-ok-stamp) |tee ../log-mfsbsd
+END
+}
+
+sub copy_sets {
+
+    built_stash_file($ho, $builddir, 'kernel.txz',
+                     'freebsd/release/ftp/kernel.txz');
+    built_stash_file($ho, $builddir, 'base.txz',
+                     'freebsd/release/ftp/base.txz');
+    built_stash_file($ho, $builddir, 'MANIFEST',
+                     'freebsd/release/ftp/MANIFEST');
+    built_stash_file($ho, $builddir, 'mfsbsd.img',
+                     'mfsbsd/mfsbsd-HEAD-amd64.img');
+}
+
+pkg_install();
+build_freebsd();
+build_mfsbsd();
+copy_sets();
-- 
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v4 06/11] osstest: fix ts-build-check to work with freebsd_buildjob
  2015-02-18 16:18 [PATCH v4 00/11] osstest: add a FreeBSD host Roger Pau Monne
                   ` (4 preceding siblings ...)
  2015-02-18 16:18 ` [PATCH v4 05/11] osstest: add script for building custom mfsBSD images Roger Pau Monne
@ 2015-02-18 16:18 ` Roger Pau Monne
  2015-02-18 16:18 ` [PATCH v4 07/11] osstest: add freebsd installer update script Roger Pau Monne
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Roger Pau Monne @ 2015-02-18 16:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Campbell, Roger Pau Monne

The output of the FreeBSD buildjob generates several files that are stashed
independently, so check each of them individually.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
---
 ts-build-check | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/ts-build-check b/ts-build-check
index 0ae3be8..a3dc1ef 100755
--- a/ts-build-check
+++ b/ts-build-check
@@ -24,12 +24,24 @@ die if @ARGV && $ARGV[0] =~ m/^-/;
 
 logm("checking builds ...");
 
+sub check_path($$) {
+        my ($path, $job) = @_;
+        logm("checking $job $path");
+        get_stashed($path, $r{$job});
+}
+
 foreach my $k (sort keys %r) {
     next unless $k =~ m/^(?:.*_)?([^_]*)buildjob$/;
-    my $part= $1;
-    my $path= "path_${part}dist";
-    logm("checking $k $path");
-    get_stashed($path, $r{$k});
+
+    if ($k =~ m/^freebsd/) {
+        my @check = qw(MANIFEST kernel.txz base.txz mfsbsd.img);
+        foreach my $elem (@check) {
+            check_path("path_$elem", $k);
+        }
+    } else {
+        my $part= $1;
+        check_path("path_${part}dist", $k);
+    }
 }
 
 logm("all ok.");
-- 
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v4 07/11] osstest: add freebsd installer update script
  2015-02-18 16:18 [PATCH v4 00/11] osstest: add a FreeBSD host Roger Pau Monne
                   ` (5 preceding siblings ...)
  2015-02-18 16:18 ` [PATCH v4 06/11] osstest: fix ts-build-check to work with freebsd_buildjob Roger Pau Monne
@ 2015-02-18 16:18 ` Roger Pau Monne
  2015-02-18 16:18 ` [PATCH v4 08/11] osstest: prepare FreeBSD host for Xen build Roger Pau Monne
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Roger Pau Monne @ 2015-02-18 16:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Campbell, Roger Pau Monne

This script allows moving a FreeBSD build (as produced by
ts-freebsd-create-mfsbsd) so it's usable by other test/build jobs.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
---
 mg-freebsd-installer-update | 59 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100755 mg-freebsd-installer-update

diff --git a/mg-freebsd-installer-update b/mg-freebsd-installer-update
new file mode 100755
index 0000000..b55d9e0
--- /dev/null
+++ b/mg-freebsd-installer-update
@@ -0,0 +1,59 @@
+#!/bin/bash
+# usage
+#   ./mg-freebsd-installer-update <flight> <job>
+
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2015 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/>.
+
+
+set -e
+
+. cri-getconfig
+
+flight=$1
+job=$2
+
+fail () { echo >&2 "$0: $1"; exit 1; }
+
+case $job in
+    *amd64*)
+        arch=amd64
+        ;;
+    *i386*)
+        arch=i386
+        ;;
+    *)
+        fail "Unsupported arch"
+        ;;
+esac
+
+date=`date +%Y-%m-%d`
+images=`getconfig Images`
+dst=$images/freebsd/$date/$arch/
+src=logs/$flight/$job/build/
+
+mkdir -p $dst
+
+# Copy sets and mfsBSD image
+cp $src/*.txz $dst
+cp $src/MANIFEST $dst
+cp $src/mfsbsd.img $dst
+
+# Set "current" to point to the new version
+rm -rf $images/freebsd/current
+ln -s $date $images/freebsd/current
+
+echo "Produced version: $date"
-- 
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v4 08/11] osstest: prepare FreeBSD host for Xen build
  2015-02-18 16:18 [PATCH v4 00/11] osstest: add a FreeBSD host Roger Pau Monne
                   ` (6 preceding siblings ...)
  2015-02-18 16:18 ` [PATCH v4 07/11] osstest: add freebsd installer update script Roger Pau Monne
@ 2015-02-18 16:18 ` Roger Pau Monne
  2015-03-19 15:18   ` Ian Campbell
  2015-02-18 16:18 ` [PATCH v4 09/11] osstest: make ts-xen-build work on FreeBSD Roger Pau Monne
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Roger Pau Monne @ 2015-02-18 16:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Campbell, Roger Pau Monne

Install pkg (the binary package management tool) and the dependencies
needed to build Xen.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
---
Changes since RFC:
 - Add the tools necessary in order to build the man pages and
   markdown documents.
---
 ts-xen-build-prep-freebsd | 48 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100755 ts-xen-build-prep-freebsd

diff --git a/ts-xen-build-prep-freebsd b/ts-xen-build-prep-freebsd
new file mode 100755
index 0000000..7a15b03
--- /dev/null
+++ b/ts-xen-build-prep-freebsd
@@ -0,0 +1,48 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2014 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/>.
+
+use strict qw(vars);
+use DBI;
+use POSIX;
+
+use Osstest;
+use Osstest::TestSupport;
+use Osstest::Logtailer;
+
+tsreadconfig();
+
+our ($whhost) = @ARGV;
+$whhost ||= 'host';
+our $ho= selecthost($whhost);
+exit 0 if $ho->{SharedReady};
+
+#TODO: should be a runvar
+our $compiler = 'gcc47';
+our $deps = "mercurial git bash python bcc glib pkgconf yajl gmake pixman ".
+            "perl5 markdown bison gettext gawk $compiler";
+
+sub install_depends () {
+    logm('Installing Xen build dependencies');
+    target_cmd_root($ho, <<END, 2400);
+        set -e
+        export ASSUME_ALWAYS_YES="YES"
+        pkg install -y $deps
+        ln -s /usr/local/bin/$compiler /usr/local/bin/gcc
+END
+}
+
+install_depends();
-- 
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v4 09/11] osstest: make ts-xen-build work on FreeBSD
  2015-02-18 16:18 [PATCH v4 00/11] osstest: add a FreeBSD host Roger Pau Monne
                   ` (7 preceding siblings ...)
  2015-02-18 16:18 ` [PATCH v4 08/11] osstest: prepare FreeBSD host for Xen build Roger Pau Monne
@ 2015-02-18 16:18 ` Roger Pau Monne
  2015-03-19 15:20   ` Ian Campbell
  2015-02-18 16:18 ` [PATCH v4 10/11] osstest: add a script to install Xen on FreeBSD hosts Roger Pau Monne
  2015-02-18 16:18 ` [PATCH v4 11/11] osstest: add FreeBSD build recipe Roger Pau Monne
  10 siblings, 1 reply; 21+ messages in thread
From: Roger Pau Monne @ 2015-02-18 16:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Campbell, Roger Pau Monne

This patch contains a new subroutine that guesses the right make
command to use (gmake on BSDs, make otherwise).

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
---
 ts-xen-build | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/ts-xen-build b/ts-xen-build
index 661f186..d800396 100755
--- a/ts-xen-build
+++ b/ts-xen-build
@@ -28,6 +28,16 @@ selectbuildhost(\@ARGV);
 # remaining arguments are passed as targets to "make"
 builddirsprops();
     
+sub get_make_cmd() {
+    my $uname = target_cmd_output_root($ho, 'uname -a', 200);
+
+    if ($uname =~ m/BSD/) {
+        return "gmake";
+    } else {
+        return "make";
+    }
+}
+
 sub checkout () {
     prepbuilddirs();
 
@@ -91,6 +101,7 @@ END
 }
 
 sub build () {
+    my $make_cmd = get_make_cmd();
     my $xend_opt= $r{enable_xend} =~ m/true/ ? "--enable-xend" : "--disable-xend";
     my $ovmf_opt= $r{enable_ovmf} =~ m/true/ ? "--enable-ovmf" : "--disable-ovmf";
 
@@ -112,7 +123,7 @@ END
 END
 #/;
     buildcmd_stamped_logged(9000, 'build', '',<<END,'');
-            $make_prefix make $makeflags @ARGV
+            $make_prefix $make_cmd $makeflags @ARGV
 END
 }
 
-- 
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v4 10/11] osstest: add a script to install Xen on FreeBSD hosts
  2015-02-18 16:18 [PATCH v4 00/11] osstest: add a FreeBSD host Roger Pau Monne
                   ` (8 preceding siblings ...)
  2015-02-18 16:18 ` [PATCH v4 09/11] osstest: make ts-xen-build work on FreeBSD Roger Pau Monne
@ 2015-02-18 16:18 ` Roger Pau Monne
  2015-03-19 15:24   ` Ian Campbell
  2015-02-18 16:18 ` [PATCH v4 11/11] osstest: add FreeBSD build recipe Roger Pau Monne
  10 siblings, 1 reply; 21+ messages in thread
From: Roger Pau Monne @ 2015-02-18 16:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Campbell, Roger Pau Monne

This scripts takes care of installing the run-time dependencies, unpacking
the Xen files and setup the right configuration in order to boot a FreeBSD
PVH Dom0.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
---
 ts-xen-install-freebsd | 128 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 128 insertions(+)
 create mode 100644 ts-xen-install-freebsd

diff --git a/ts-xen-install-freebsd b/ts-xen-install-freebsd
new file mode 100644
index 0000000..2e0c35d
--- /dev/null
+++ b/ts-xen-install-freebsd
@@ -0,0 +1,128 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2015 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/>.
+
+use strict qw(vars);
+use DBI;
+use Osstest;
+use POSIX;
+use Osstest::TestSupport;
+
+my $checkmode= 0;
+
+tsreadconfig();
+
+our @hos;
+
+if (@ARGV and $ARGV[0] eq '--check') {
+    $checkmode= 1;
+    shift @ARGV;
+    logm("checking builds are done...");
+} else {
+    if (!@ARGV) {
+	push @ARGV, 'host';
+    }
+    foreach my $k (@ARGV) {
+        push @hos, selecthost($k);
+    }
+}
+
+our $ho;
+
+my %distpath;
+
+our $run_deps = "yajl python curl glib gettext pixman libiconv";
+
+sub packages () {
+    logm('Installing Xen runtime dependencies');
+target_cmd_root($ho, <<END, 2400);
+        set -e
+        export ASSUME_ALWAYS_YES="YES"
+        pkg install -y $run_deps
+END
+}
+
+sub extract () {
+    my @parts = ('', 'xen');
+
+    foreach my $part (@parts) {
+        target_extract_jobdistpath($ho, $part, "path_${part}dist",
+				   $r{"${part}buildjob"}, \%distpath);
+    }
+    target_cmd_root($ho, 'gunzip -c `readlink -f /boot/xen.gz` > /boot/xen', 100);
+}
+
+sub adjustconfig () {
+    target_cmd_root($ho, <<END, 100);
+        set -e
+        mkdir -p /usr/local/etc/rc.conf.d
+        echo 'XENCONSOLED_TRACE=guest' >> /usr/local/etc/rc.conf.d/xencommons
+        mkdir -p /var/log/xen/console
+        mkdir -p /var/lock
+        mkdir -p /var/run/xen
+        echo 'vm.max_wired=-1' >> /etc/sysctl.conf
+        echo 'xc0   "/usr/libexec/getty Pc"         xterm   on  secure' >> /etc/ttys
+        echo 'xencommons_enable="YES"' >> /etc/rc.conf
+END
+}
+
+sub setupboot () {
+    my $xenhopt = "dom0pvh=1";
+
+    my $cons= get_host_property($ho, 'XenSerialConsole', 'com1');
+
+    if ( $cons eq "com1" ) {
+	$xenhopt .= " com1=$c{Baud},8n1 console=com1,vga gdb=com1";
+    } elsif ( $cons eq "dtuart" ) {
+	$xenhopt .= " console=dtuart";
+	my $dtuart= get_host_property($ho, 'XenDTUARTPath', undef);
+	$xenhopt .= " dtuart=$dtuart" if $dtuart;
+    } else {
+	logm("No Xen console device defined for host");
+    }
+    if (toolstack()->{Dom0MemFixed}) {
+        $xenhopt .= " dom0_mem=2048M,max:2048M";
+    }
+    my $append= $r{xen_boot_append};
+    $xenhopt .= " $append" if defined $append;
+    $append = get_host_property($ho, 'xen-commandline-append', undef);
+    $xenhopt .= " $append" if defined $append;
+
+    die "pci-passthrough is not supported" if host_involves_pcipassthrough($ho);
+
+    target_cmd_root($ho, <<END, 100);
+            set -e
+            cat <<ENDB >>/boot/loader.conf
+vfs.zfs.arc_max="1G"
+xen_cmdline="$xenhopt"
+xen_kernel="/boot/xen"
+ENDB
+END
+
+    logm("ready to boot Xen");
+}
+
+if ($checkmode) {
+    extract();
+} else {
+    die if @hos > 1;
+    $ho= $hos[0];
+
+    packages();
+    extract();
+    adjustconfig();
+    setupboot();
+}
-- 
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v4 11/11] osstest: add FreeBSD build recipe
  2015-02-18 16:18 [PATCH v4 00/11] osstest: add a FreeBSD host Roger Pau Monne
                   ` (9 preceding siblings ...)
  2015-02-18 16:18 ` [PATCH v4 10/11] osstest: add a script to install Xen on FreeBSD hosts Roger Pau Monne
@ 2015-02-18 16:18 ` Roger Pau Monne
  2015-03-19 15:31   ` Ian Campbell
  10 siblings, 1 reply; 21+ messages in thread
From: Roger Pau Monne @ 2015-02-18 16:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Campbell, Roger Pau Monne

This patch introduces two new buildjobs:

build-<arch>-freebsd-xen: sets up a FreeBSD host and builds Xen.
build-<arch>-freebsd-freebsd: sets up a FreeBSD host and builds FreeBSD sets
and a mfsBSD installer image.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
---
 ap-common  |  2 ++
 mfi-common | 22 ++++++++++++++++++++++
 sg-run-job | 25 +++++++++++++++++++++----
 3 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/ap-common b/ap-common
index 96cbd14..8987637 100644
--- a/ap-common
+++ b/ap-common
@@ -27,6 +27,8 @@
 #: ${TREE_QEMU:=git://mariner.uk.xensource.com/qemu-$xenbranch.git}
 : ${TREE_QEMU:=git://xenbits.xen.org/staging/qemu-$xenbranch.git}
 
+: ${TREE_FREEBSD:=https://github.com/freebsd/freebsd.git}
+: ${TREE_MFSBSD:=https://github.com/mmatuska/mfsbsd.git}
 
 : ${GIT_KERNEL_ORG:=git://git.kernel.org}
 : ${KERNEL_SCM:=${GIT_KERNEL_ORG}/pub/scm/linux/kernel/git}
diff --git a/mfi-common b/mfi-common
index e167606..636052e 100644
--- a/mfi-common
+++ b/mfi-common
@@ -153,6 +153,28 @@ create_build_jobs () {
                 revision_qemuu=$REVISION_QEMU_UPSTREAM                       \
                 revision_seabios=$REVISION_SEABIOS
 
+    ./cs-job-create $flight build-$arch-freebsd-freebsd build-freebsd        \
+                arch=$arch                                                   \
+        tree_freebsd=$TREE_FREEBSD                                           \
+        tree_mfsbsd=$TREE_MFSBSD                                             \
+                $RUNVARS $BUILD_RUNVARS $arch_runvars                        \
+                host_hostflags=$build_hostflags                              \
+                revision_freebsd=$REVISION_FREEBSD                           \
+                revision_mfsbsd=$REVISION_MFSBSD
+
+    ./cs-job-create $flight build-$arch-freebsd-xen build                    \
+                arch=$arch enable_xend=false enable_ovmf=false               \
+        tree_qemu=$TREE_QEMU                                                 \
+        tree_qemuu=$TREE_QEMU_UPSTREAM                                       \
+        tree_xen=$TREE_XEN                                                   \
+        tree_seabios=$TREE_SEABIOS                                           \
+                $RUNVARS $BUILD_RUNVARS $BUILD_XEN_RUNVARS $arch_runvars     \
+                host_hostflags=$build_hostflags                              \
+                revision_xen=$REVISION_XEN                                   \
+                revision_qemu=$REVISION_QEMU                                 \
+                revision_qemuu=$REVISION_QEMU_UPSTREAM                       \
+                revision_seabios=$REVISION_SEABIOS
+
     if [ $build_extraxend = "true" ] ; then
     ./cs-job-create $flight build-$arch-xend build                           \
                 arch=$arch enable_xend=true enable_ovmf=$enable_ovmf         \
diff --git a/sg-run-job b/sg-run-job
index 2cf810a..d8d75ba 100755
--- a/sg-run-job
+++ b/sg-run-job
@@ -50,8 +50,13 @@ proc run-job {job} {
 
     if {$ok} { setstatus running                                          }
 
-    per-host-ts broken  host-install/@(*) ts-host-install-twice
-    per-host-ts .       xen-install/@     ts-xen-install
+    if {[string match *freebsd* $job]} {
+        per-host-ts broken  host-install/@(*) ts-freebsd-host-install
+        per-host-ts .       xen-install/@     ts-xen-install-freebsd
+    } else {
+        per-host-ts broken  host-install/@(*) ts-host-install-twice
+        per-host-ts .       xen-install/@     ts-xen-install
+    }
     per-host-ts .       xen-boot/@        ts-host-reboot
 
     per-host-ts .       =(*)             {ts-leak-check basis}
@@ -327,6 +332,7 @@ proc need-hosts/build {} { return BUILD }
 proc need-hosts/build-kern {} { return BUILD }
 proc need-hosts/build-libvirt {} { return BUILD }
 proc need-hosts/build-rumpuserxen {} { return BUILD }
+proc need-hosts/build-freebsd {} { return BUILD }
 
 proc run-job/build {} {
     run-ts . = ts-xen-build
@@ -345,11 +351,22 @@ proc run-job/build-rumpuserxen {} {
     run-ts . = ts-xen-build + host tools
 }
 
+proc run-job/build-freebsd {} {
+    run-ts . = ts-freebsd-create-mfsbsd
+}
+
 proc prepare-build-host {} {
     global jobinfo
     run-ts broken = ts-hosts-allocate + host
-    run-ts broken host-install(*) ts-host-install-twice
-    run-ts . host-build-prep ts-xen-build-prep
+    if {[string match *freebsd-xen* $jobinfo(job)]} {
+        run-ts broken host-install(*) ts-freebsd-host-install
+        run-ts . host-build-prep ts-xen-build-prep-freebsd
+    } elseif {[string match *freebsd-freebsd* $jobinfo(job)]} {
+        run-ts broken host-install(*) ts-freebsd-host-install
+    } else {
+        run-ts broken host-install(*) ts-host-install-twice
+        run-ts . host-build-prep ts-xen-build-prep
+    }
 }
 
 #---------- main program ----------
-- 
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH v4 01/11] osstest: allow to disable the usage of a know_host file
  2015-02-18 16:18 ` [PATCH v4 01/11] osstest: allow to disable the usage of a know_host file Roger Pau Monne
@ 2015-03-19 14:52   ` Ian Campbell
  0 siblings, 0 replies; 21+ messages in thread
From: Ian Campbell @ 2015-03-19 14:52 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Ian Jackson

On Wed, 2015-02-18 at 17:18 +0100, Roger Pau Monne wrote:

"known" in subject.

> This is only used by target_cmd_root and target_putfile_root and will be
> needed for mfsBSD which generates new keys on each boot.

AIUI this is an installer thing which runs from a ramdisk and hence has
no static host key, is that right?

I take it is has no preseeding like mechanisms then?


Would an alternative to plumbing this option all the way down be to
invoke ssh-keyscan after booting this mfsBSD to populate the
known_hosts?

> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> ---
>  Osstest/TestSupport.pm | 25 ++++++++++++++++---------
>  1 file changed, 16 insertions(+), 9 deletions(-)
> 
> diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
> index 5ac66e5..d930e55 100644
> --- a/Osstest/TestSupport.pm
> +++ b/Osstest/TestSupport.pm
> @@ -374,14 +374,21 @@ sub remote_perl_script_done ($) {
>  
>  sub sshuho ($$) { my ($user,$ho)= @_; return "$user\@$ho->{Ip}"; }
>  
> -sub sshopts () {
> +sub sshopts {
> +    my ($disable_hosts) = @_;
> +    my $hosts = "tmp/t.known_hosts_$flight.$job";
> +
> +    if (defined $disable_hosts) {
> +        $hosts = "/dev/null";
> +    }

A more Perl-ish approach would be:
	$host = "/dev/null" if defined $disable_hosts;
(and I think the defined is optional there too).

Or perhaps $host = $disable_hosts ? "/dev/null" : "tmp/....";



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v4 02/11] osstest: add routine to execute ssh with password
  2015-02-18 16:18 ` [PATCH v4 02/11] osstest: add routine to execute ssh with password Roger Pau Monne
@ 2015-03-19 14:58   ` Ian Campbell
  0 siblings, 0 replies; 21+ messages in thread
From: Ian Campbell @ 2015-03-19 14:58 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Ian Jackson

On Wed, 2015-02-18 at 17:18 +0100, Roger Pau Monne wrote:
> This is needed when bootstrapping FreeBSD, since the installer has ssh
> enabled with the root password set to 'root' by default.

I think the commit message should mention the refactoring done WRT
$stdout vs $child_sub (i.e. you are replacing the boolean with a hook,
where the current invocations do the same thing as the old boolean used
to cause).

I also think the trick with SSH_ASKPASS deserves a brief mention.

> @@ -585,9 +585,42 @@ sub tcmd { # $tcmd will be put between '' but not escaped
>  sub target_cmd ($$;$) { tcmd(undef,'osstest',@_); }
>  sub target_cmd_root ($$;$$) { tcmd(undef,'root',@_); }
>  
> +sub target_cmd_root_with_password {
> +    my ($ho,$tcmd,$timeout,$password, $disable_hosts) = @_;
> +    my $temp_name = "tmp/t.ssh-password-helper.$flight.$job";
> +
> +    open(my $temp_fh, '>', $temp_name)
> +      or die "Cannot open $temp_name: $!";
> +    print $temp_fh "#!/bin/sh\n\necho \"$password\"\n"
> +      or die "Cannot write to $temp_name: $!";
> +    chmod 0755, $temp_name
> +      or die "Cannot chmod $temp_name: $!";
> +    close $temp_fh
> +      or die "Cannot close $temp_name: $!";
> +
> +    my $child_sub = sub {
> +                           $ENV{DISPLAY} = ":0";

? This seems like it must be pretty magic, in some terribly scary way...

> +                           $ENV{SSH_ASKPASS} = "tmp/t.ssh-password-helper.$flight.$job";
> +                           setsid or die "Can't start a new session: $!";
> +                        };
> +
> +    my $ssh_opts = [qw(-o BatchMode=no
> +                       -o PasswordAuthentication=yes
> +                       -o ChallengeResponseAuthentication=yes),
> +                    @{ sshopts($disable_hosts) }];
> +
> +    tcmdex($timeout,$child_sub,
> +           'ssh', $ssh_opts,
> +           sshuho("root",$ho), $tcmd);
> +
> +    unlink $temp_fh;
> +}
> +
>  sub tcmdout {
>      my $stdout= IO::File::new_tmpfile();
> -    tcmd($stdout,@_);
> +    my $stdout_sub = sub { open STDOUT, '>&', $stdout
> +                              or die "STDOUT $stdout $!"; };
> +    tcmd($stdout_sub,@_);
>      $stdout->seek(0,0) or die "$stdout $!";
>      my $r;
>      { local ($/) = undef;

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v4 03/11] osstest: store a path runvar for built_stash_file
  2015-02-18 16:18 ` [PATCH v4 03/11] osstest: store a path runvar for built_stash_file Roger Pau Monne
@ 2015-03-19 15:01   ` Ian Campbell
  0 siblings, 0 replies; 21+ messages in thread
From: Ian Campbell @ 2015-03-19 15:01 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Ian Jackson

On Wed, 2015-02-18 at 17:18 +0100, Roger Pau Monne wrote:
> This mimics the behaviour of built_stash.

This will result in the creation of a bunch of new runvars, matching:
        ts-kernel-build:built_stash_file($ho, $builddir, 'vmlinux', 'linux/vmlinux');
        ts-kernel-build:built_stash_file($ho, $builddir, 'config', 'linux/.config');
        ts-xen-build:    built_stash_file($ho, $builddir, "xen-syms", "xen/xen/xen-syms", 1);
        ts-xen-build:    built_stash_file($ho, $builddir, "xen-config", "xen/.config", 1);
        ts-xen-build:    built_stash_file($ho, $builddir, "seabios-config",

which I suppose is expected and even desirable, so:
Acked-by: Ian Campbell <ian.campbell@citrix.com>

> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> ---
>  Osstest/TestSupport.pm | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
> index 0c72faa..4d35a19 100644
> --- a/Osstest/TestSupport.pm
> +++ b/Osstest/TestSupport.pm
> @@ -1221,6 +1221,7 @@ sub built_stash_file ($$$$;$) {
>      target_getfile($ho, 300,
>                     "$builddir/$fname",
>                     "$stash/$stashleaf");
> +    store_runvar("path_$item", $stashleaf);
>  }
>  
>  sub built_compress_stashed($) {



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v4 04/11] osstest: add support for installing bare metal FreeBSD
  2015-02-18 16:18 ` [PATCH v4 04/11] osstest: add support for installing bare metal FreeBSD Roger Pau Monne
@ 2015-03-19 15:13   ` Ian Campbell
  0 siblings, 0 replies; 21+ messages in thread
From: Ian Campbell @ 2015-03-19 15:13 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Ian Jackson

On Wed, 2015-02-18 at 17:18 +0100, Roger Pau Monne wrote:

>  - Add a list of FreeBSD ftp mirrors and iterate over them in order to
>    find a working one.

I didn't actually see this, and in general we try and avoid dependencies
on random 3rd party webservices. Can we mirror FreeBSD locally like we
do with Debian?

> diff --git a/production-config b/production-config
> index 515bd98..fefc467 100644
> --- a/production-config
> +++ b/production-config
> @@ -86,6 +86,8 @@ HostProp_GenEtherPrefixBase 5a:36:0e:00
>  #                                      :00:01 guest number in job appended
>  #                                    ^^ xor'd with low 8 bits of flight
>  
> +FreeBSDVersion current

I think for the final deployment we would want a specific version here.
IIRC the "current" stuff used with DiVersion is vestigial and no longer
used (or perhaps a standalone-mode-ism).

(or perhaps there is something which that graphic from 00/11 should be
telling me which I can't decipher)

> +exit 0 if $ho->{SharedReady};

I suppose this is some clever way to avoid unnecessary reinstalls?

> +sub get_mfsbsd() {
> +
> +    # Figure out the path to the mfsBSD image we have to use.
> +    # This can either come from a previous buildjob or from
> +    # a pre-seeded image.
> +
> +    if ($r{freebsd_buildjob}) {
> +        # We are going to use the build output from a previous job.
> +        return get_stashed('path_mfsbsd.img', $r{freebsd_buildjob});
> +    } else {
> +        # We are going to use a pre-seeded version.
> +        return "$c{Images}/freebsd/$c{FreeBSDVersion}/$r{arch}/mfsbsd.img";
> +    }
> +}
> +
> +sub get_set($) {
> +    my ($set) = @_;
> +
> +    if ($r{freebsd_buildjob}) {
> +        # We are going to use the build output from a previous job.
> +        return get_stashed("path_$set", $r{freebsd_buildjob});
> +    } else {
> +        # We are going to use a pre-seeded version.
> +        return "$c{Images}/freebsd/$c{FreeBSDVersion}/$r{arch}/$set";
> +    }
> +}

Isn't get_mfsbsd the same as get_set("mfsbsd.img") ?

> +
> +sub setup_sets() {
> +    my $webfolder = "$c{WebspaceFile}/$c{WebspaceCommon}/freebsd/$ho->{Name}";
> +
> +    # Link the sets to the public http folder
> +    rmtree($webfolder);
> +    mkpath($webfolder);
> +    foreach my $set (@sets) {
> +        my $set_src = abs_path(get_set($set));
> +        logm("Using install set: $set_src");
> +        symlink $set_src,"$webfolder/$set" or die "Unable to create symlink: $!";

This relies on the webserver and the controller having a shared NFS view
of the world, which I'm not sure is always true?

> +    logm('Setting root shell to /bin/sh');
> +    target_cmd_root($ho, 'chsh -s /bin/sh', 100);

Did you not already do this and/or can't you do it while tailoring
rather than after first boot?

> +    logm('Adding osstest user');
> +    target_cmd_root($ho, 'pw useradd osstest -m', 100);
> +    target_cmd_root($ho, <<END, 100);
> +            set -e
> +            chsh -s /bin/sh osstest
> +            mkdir -p /home/osstest/.ssh
> +            cat <<ENDKEYS >/home/osstest/.ssh/authorized_keys
> +$authkeys
> +ENDKEYS
> +END

Likewise.

> +    logm('OK: install completed');

That was remarkably painless, I thought it would be much worse!

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v4 05/11] osstest: add script for building custom mfsBSD images
  2015-02-18 16:18 ` [PATCH v4 05/11] osstest: add script for building custom mfsBSD images Roger Pau Monne
@ 2015-03-19 15:16   ` Ian Campbell
  0 siblings, 0 replies; 21+ messages in thread
From: Ian Campbell @ 2015-03-19 15:16 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Ian Jackson

On Wed, 2015-02-18 at 17:18 +0100, Roger Pau Monne wrote:
[...]
> We would need to have a local copy of them in order to have a push gate like
> we do for Linux, Qemu or SeaBIOS.
> 
> The workflow of this would be:
> 
> 1. Setup a FreeBSD host using a RELEASE image (10.1 right now).
> 2. Fetch upstream FreeBSD sources and compile a fresh FreeBSD world +
> kernel.
> 3. Generate a mfsBSD image using the output from the FreeBSD build process.
> 4. Stash all the resulting build files (MANIFEST, kernel.txz, base.txz and
> mfsbsd.img).
> 5. Use the newly created mfsBSD image in order to boot and the uploaded
> install sets with zfsinstall.

Is all this a bunch of TODO items or things which will happen later in
the series?

The actual script seems reasonable.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v4 08/11] osstest: prepare FreeBSD host for Xen build
  2015-02-18 16:18 ` [PATCH v4 08/11] osstest: prepare FreeBSD host for Xen build Roger Pau Monne
@ 2015-03-19 15:18   ` Ian Campbell
  0 siblings, 0 replies; 21+ messages in thread
From: Ian Campbell @ 2015-03-19 15:18 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Ian Jackson

On Wed, 2015-02-18 at 17:18 +0100, Roger Pau Monne wrote:
> Install pkg (the binary package management tool) and the dependencies
> needed to build Xen.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>

Looks reasonable.

> ---
> Changes since RFC:
>  - Add the tools necessary in order to build the man pages and
>    markdown documents.
> ---
>  ts-xen-build-prep-freebsd | 48 +++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
>  create mode 100755 ts-xen-build-prep-freebsd
> 
> diff --git a/ts-xen-build-prep-freebsd b/ts-xen-build-prep-freebsd
> new file mode 100755
> index 0000000..7a15b03
> --- /dev/null
> +++ b/ts-xen-build-prep-freebsd
> @@ -0,0 +1,48 @@
> +#!/usr/bin/perl -w
> +# This is part of "osstest", an automated testing framework for Xen.
> +# Copyright (C) 2009-2014 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/>.
> +
> +use strict qw(vars);
> +use DBI;
> +use POSIX;
> +
> +use Osstest;
> +use Osstest::TestSupport;
> +use Osstest::Logtailer;
> +
> +tsreadconfig();
> +
> +our ($whhost) = @ARGV;
> +$whhost ||= 'host';
> +our $ho= selecthost($whhost);
> +exit 0 if $ho->{SharedReady};
> +
> +#TODO: should be a runvar
> +our $compiler = 'gcc47';
> +our $deps = "mercurial git bash python bcc glib pkgconf yajl gmake pixman ".
> +            "perl5 markdown bison gettext gawk $compiler";
> +
> +sub install_depends () {
> +    logm('Installing Xen build dependencies');
> +    target_cmd_root($ho, <<END, 2400);
> +        set -e
> +        export ASSUME_ALWAYS_YES="YES"
> +        pkg install -y $deps
> +        ln -s /usr/local/bin/$compiler /usr/local/bin/gcc
> +END
> +}
> +
> +install_depends();



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v4 09/11] osstest: make ts-xen-build work on FreeBSD
  2015-02-18 16:18 ` [PATCH v4 09/11] osstest: make ts-xen-build work on FreeBSD Roger Pau Monne
@ 2015-03-19 15:20   ` Ian Campbell
  0 siblings, 0 replies; 21+ messages in thread
From: Ian Campbell @ 2015-03-19 15:20 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Ian Jackson

On Wed, 2015-02-18 at 17:18 +0100, Roger Pau Monne wrote:
> This patch contains a new subroutine that guesses the right make
> command to use (gmake on BSDs, make otherwise).

Will this also be needed from e.g. the ts-libvirt-build script? (I
assume you don't care about ts-kernel-build AKA ts-linux-build)

> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> ---
>  ts-xen-build | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/ts-xen-build b/ts-xen-build
> index 661f186..d800396 100755
> --- a/ts-xen-build
> +++ b/ts-xen-build
> @@ -28,6 +28,16 @@ selectbuildhost(\@ARGV);
>  # remaining arguments are passed as targets to "make"
>  builddirsprops();
>      
> +sub get_make_cmd() {
> +    my $uname = target_cmd_output_root($ho, 'uname -a', 200);
> +
> +    if ($uname =~ m/BSD/) {
> +        return "gmake";
> +    } else {
> +        return "make";
> +    }
> +}
> +
>  sub checkout () {
>      prepbuilddirs();
>  
> @@ -91,6 +101,7 @@ END
>  }
>  
>  sub build () {
> +    my $make_cmd = get_make_cmd();
>      my $xend_opt= $r{enable_xend} =~ m/true/ ? "--enable-xend" : "--disable-xend";
>      my $ovmf_opt= $r{enable_ovmf} =~ m/true/ ? "--enable-ovmf" : "--disable-ovmf";
>  
> @@ -112,7 +123,7 @@ END
>  END
>  #/;
>      buildcmd_stamped_logged(9000, 'build', '',<<END,'');
> -            $make_prefix make $makeflags @ARGV
> +            $make_prefix $make_cmd $makeflags @ARGV
>  END
>  }
>  



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v4 10/11] osstest: add a script to install Xen on FreeBSD hosts
  2015-02-18 16:18 ` [PATCH v4 10/11] osstest: add a script to install Xen on FreeBSD hosts Roger Pau Monne
@ 2015-03-19 15:24   ` Ian Campbell
  0 siblings, 0 replies; 21+ messages in thread
From: Ian Campbell @ 2015-03-19 15:24 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Ian Jackson

On Wed, 2015-02-18 at 17:18 +0100, Roger Pau Monne wrote:

> +sub setupboot () {
> +    my $xenhopt = "dom0pvh=1";
> +
> +    my $cons= get_host_property($ho, 'XenSerialConsole', 'com1');
> +
> +    if ( $cons eq "com1" ) {
> +	$xenhopt .= " com1=$c{Baud},8n1 console=com1,vga gdb=com1";
> +    } elsif ( $cons eq "dtuart" ) {
> +	$xenhopt .= " console=dtuart";
> +	my $dtuart= get_host_property($ho, 'XenDTUARTPath', undef);
> +	$xenhopt .= " dtuart=$dtuart" if $dtuart;
> +    } else {
> +	logm("No Xen console device defined for host");
> +    }
> +    if (toolstack()->{Dom0MemFixed}) {
> +        $xenhopt .= " dom0_mem=2048M,max:2048M";
> +    }
> +    my $append= $r{xen_boot_append};
> +    $xenhopt .= " $append" if defined $append;
> +    $append = get_host_property($ho, 'xen-commandline-append', undef);
> +    $xenhopt .= " $append" if defined $append;

Perhaps some or all of this could be common with ts-xen-install?

> +    die "pci-passthrough is not supported" if host_involves_pcipassthrough($ho);

If a host is passthrough capable does that imply that the current job is
going to use it? It seems the two hosts with a passthrough-* host flag
are gall-mite and itch-mite which are certainly used for other jobs.

I'm not sure how this can be dealt with, maybe Ian has an idea, or maybe
you can just defer until a FreeBSD w/ passthrough job is created, at
which point you would surely know what to write here.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v4 11/11] osstest: add FreeBSD build recipe
  2015-02-18 16:18 ` [PATCH v4 11/11] osstest: add FreeBSD build recipe Roger Pau Monne
@ 2015-03-19 15:31   ` Ian Campbell
  0 siblings, 0 replies; 21+ messages in thread
From: Ian Campbell @ 2015-03-19 15:31 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Ian Jackson

On Wed, 2015-02-18 at 17:18 +0100, Roger Pau Monne wrote:
> This patch introduces two new buildjobs:
> 
> build-<arch>-freebsd-xen: sets up a FreeBSD host and builds Xen.
> build-<arch>-freebsd-freebsd: sets up a FreeBSD host and builds FreeBSD sets
> and a mfsBSD installer image.

Not sure why this is dodgy, it doesn't look too bad to me.

One thought I had all the way through this is that its a bit wrong that
ts-xen-{install,build} and ts-kernel-build are actually
ts-xen-{install,build}-linux and ts-linux-build.

Renaming those script would allow some of the iffs you are added to be
replace with do-a-thing-$os.

A little care would be needed so that the testid doesn't change, but
that's might be a good thing, since having the testid be host-install
regardless of the OS being installed would make things a bit more
readable IMHO (e.g. in the summary grid).

Perhaps the way to achieve that is to make ts-xen-build be:
    #!/bin/bash
    set -ex
    os=$1;shift
    exec ts-xen-build-$1 $@

Then things like:
    per-host-ts broken  host-install/@(*) ts-host-install + $os
    per-host-ts .       xen-install/@     ts-xen-install + $os

(the + makes the $os not be in the test id)

Ian.

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2015-03-19 15:33 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-18 16:18 [PATCH v4 00/11] osstest: add a FreeBSD host Roger Pau Monne
2015-02-18 16:18 ` [PATCH v4 01/11] osstest: allow to disable the usage of a know_host file Roger Pau Monne
2015-03-19 14:52   ` Ian Campbell
2015-02-18 16:18 ` [PATCH v4 02/11] osstest: add routine to execute ssh with password Roger Pau Monne
2015-03-19 14:58   ` Ian Campbell
2015-02-18 16:18 ` [PATCH v4 03/11] osstest: store a path runvar for built_stash_file Roger Pau Monne
2015-03-19 15:01   ` Ian Campbell
2015-02-18 16:18 ` [PATCH v4 04/11] osstest: add support for installing bare metal FreeBSD Roger Pau Monne
2015-03-19 15:13   ` Ian Campbell
2015-02-18 16:18 ` [PATCH v4 05/11] osstest: add script for building custom mfsBSD images Roger Pau Monne
2015-03-19 15:16   ` Ian Campbell
2015-02-18 16:18 ` [PATCH v4 06/11] osstest: fix ts-build-check to work with freebsd_buildjob Roger Pau Monne
2015-02-18 16:18 ` [PATCH v4 07/11] osstest: add freebsd installer update script Roger Pau Monne
2015-02-18 16:18 ` [PATCH v4 08/11] osstest: prepare FreeBSD host for Xen build Roger Pau Monne
2015-03-19 15:18   ` Ian Campbell
2015-02-18 16:18 ` [PATCH v4 09/11] osstest: make ts-xen-build work on FreeBSD Roger Pau Monne
2015-03-19 15:20   ` Ian Campbell
2015-02-18 16:18 ` [PATCH v4 10/11] osstest: add a script to install Xen on FreeBSD hosts Roger Pau Monne
2015-03-19 15:24   ` Ian Campbell
2015-02-18 16:18 ` [PATCH v4 11/11] osstest: add FreeBSD build recipe Roger Pau Monne
2015-03-19 15:31   ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.