Skip to contentSkip to conversation

oss-test: add FreeBSD guest support

PATCH In review Roger Pau Monne 2 participants 6 messages Nov 21, 2013

lore
Share & tools
lore
#1 lore raw

PATCH 1/2 oss-test: add UFS rw support to pvops kernel

In reply to Roger Pau Monne

This is needed in order to mount and modify the FreeBSD VM images.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 ts-kernel-build |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
ts-kernel-build +2 -0
index 43d9db7..478d912 100755
@@ -171,6 +171,8 @@ setopt CONFIG_IGB m
 setopt CONFIG_PCI_IOV y
 
 setopt CONFIG_EXT4_FS m
+setopt CONFIG_UFS_FS m
+setopt CONFIG_UFS_FS_WRITE y
 
 END
 
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#0 lore raw

cover oss-test: add FreeBSD guest support

This series allows installing a FreeBSD guest from OSS-Test.

The following change by Ian Jackson is needed in order to run the newly added FreeBSD installer script:

http://xenbits.xen.org/gitweb/?p=people/iwj/osstest.git;a=commit;h=a55ebaf5cd49b0c2bf7538b373ecbd9c871fc20b

The series can be found at:

git://xenbits.xen.org/people/royger/osstest.git freebsd

http://xenbits.xen.org/gitweb/?p=people/royger/osstest.git;a=shortlog;h=refs/heads/freebsd

Thanks, Roger.

#3 lore raw

PATCH 2/2 oss-test: add FreeBSD PVHVM installer

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>

---
Images have to be placed in $freebsd_vm_repo, currently it expects to find:

ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/VM-IMAGES/10.0-BETA3/i386/20131103/FreeBSD-10.0-BETA3-i386-20131103-r257580.qcow2.xz as
FreeBSD-10.0-BETA3-i386.qcow2.xz
and ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/VM-IMAGES/10.0-BETA3/amd64/20131103/FreeBSD-10.0-BETA3-amd64-20131103-r257580.qcow2.xz as
FreeBSD-10.0-BETA3-amd64.qcow2.xz

---
 ts-freebsd-install |  109 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 109 insertions(+), 0 deletions(-)
 create mode 100644 ts-freebsd-install
ts-freebsd-install new file +109 -0
new file mode 100644
index 0000000..4e32b6c
@@ -0,0 +1,109 @@
+#!/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/>.
+
+use strict qw(vars);
+use DBI;
+use Osstest;
+use Osstest::TestSupport;
+
+tsreadconfig();
+
+our ($whhost,$gn) = @ARGV;
+$whhost ||= 'host';
+$gn ||= 'freebsd';
+
+our $ho= selecthost($whhost);
+
+our $ram_mb=   1024;
+our $disk_mb= 20480;
+
+our $guesthost= "$gn.guest.osstest";
+our $gho;
+
+our $xl= toolstack()->{Command};
+
+our $freebsd_qcow2= '/root/freebsd.qcow2';
+our $freebsd_raw= '/root/freebsd.raw';
+
+our $freebsd_mount= '/root/freebsd_root';
+
+our $freebsd_version= "10.0-BETA3";
+
+# Folder where the FreeBSD VM images are stored inside of the host
+#
+# The naming convention of the stored images is:
+# FreeBSD-$freebsd_version-$arch.qcow2.xz
+# ie: FreeBSD-10.0-BETA3-amd64.qcow2.xz
+our $freebsd_vm_repo= '/var/images';
+
+sub prep () {
+    my $authkeys= authorized_keys();
+
+    target_install_packages_norec($ho, qw(lvm2 wget qemu-utils xz-utils kpartx));
+
+    $gho= prepareguest($ho, $gn, $guesthost, 22,
+                       $disk_mb + 1,
+                       100);
+
+    more_prepareguest_hvm($ho, $gho, $ram_mb, $disk_mb, NoCdromImage => 1);
+
+    my $freebsd_img = $freebsd_vm_repo . "/" . "FreeBSD-" . $freebsd_version . "-";
+    # Use amd64 as default arch
+    $freebsd_img .= defined($r{"$gho->{Guest}_arch"}) ? $r{"$gho->{Guest}_arch"} : 'amd64';
+    $freebsd_img .= ".qcow2.xz";
+
+    target_cmd_root($ho, "umount $gho->{Lvdev} ||:");
+
+    target_cmd_root($ho, <<END, 900);
+            xz -dkc $freebsd_img > $freebsd_qcow2
+            qemu-img convert -f qcow2 $freebsd_qcow2 -O raw $freebsd_raw
+            rm -rf $freebsd_qcow2
+            dd if=$freebsd_raw of=$gho->{Lvdev} bs=1M
+            rm -rf $freebsd_raw
+
+            kpartx -a $gho->{Lvdev}
+            mkdir -p $freebsd_mount
+            mount -t ufs -o ufstype=ufs2,rw /dev/mapper/$gho->{Vg}-$gho->{Name}--disk3 $freebsd_mount
+
+            mkdir -p $freebsd_mount/root/.ssh
+            cat <<'ENDKEYS' >$freebsd_mount/root/.ssh/authorized_keys
+$authkeys
+ENDKEYS
+
+            echo 'sshd_enable="YES"' >> $freebsd_mount/etc/rc.conf
+            echo 'ifconfig_xn0="DHCP"' >> $freebsd_mount/etc/rc.conf
+            echo 'PermitRootLogin yes' >> $freebsd_mount/etc/ssh/sshd_config
+
+            sed -i '/^ttyu0/s/off/on/' $freebsd_mount/etc/ttys
+
+            cp $freebsd_mount/usr/share/zoneinfo/Europe/London $freebsd_mount/etc/localtime
+
+            cat <<'ENDKEYS' >$freebsd_mount/boot/loader.conf
+boot_multicons="YES"
+boot_serial="YES"
+comconsole_speed="115200"
+console="comconsole,vidconsole"
+ENDKEYS
+
+            umount $freebsd_mount
+            rm -rf $freebsd_mount
+            kpartx -d $gho->{Lvdev}
+END
+
+}
+
+prep();
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#4 lore raw

Re: [PATCH 2/2] oss-test: add FreeBSD PVHVM installer

Quoted 52 lines · Roger Pau Monne
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>

---
Images have to be placed in $freebsd_vm_repo, currently it expects to find:

ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/VM-IMAGES/10.0-BETA3/i386/20131103/FreeBSD-10.0-BETA3-i386-20131103-r257580.qcow2.xz as
FreeBSD-10.0-BETA3-i386.qcow2.xz
and ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/VM-IMAGES/10.0-BETA3/amd64/20131103/FreeBSD-10.0-BETA3-amd64-20131103-r257580.qcow2.xz as
FreeBSD-10.0-BETA3-amd64.qcow2.xz

---
 ts-freebsd-install |  109 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 109 insertions(+), 0 deletions(-)
 create mode 100644 ts-freebsd-install
ts-freebsd-install new file +27 -0
new file mode 100644
index 0000000..4e32b6c
@@ -0,0 +1,109 @@
+#!/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/>.
+
+use strict qw(vars);
+use DBI;
+use Osstest;
+use Osstest::TestSupport;
+
+tsreadconfig();
+
+our ($whhost,$gn) = @ARGV;
+$whhost ||= 'host';
+$gn ||= 'freebsd';

ts-freebsd-install line 37

Quoted 10 lines
ts-freebsd-install new file +10 -0
+
+our $ho= selecthost($whhost);
+
+our $ram_mb=   1024;
+our $disk_mb= 20480;
+
+our $guesthost= "$gn.guest.osstest";
+our $gho;
+
+our $xl= toolstack()->{Command};

The line above is not needed at all, I've just used it for testing, could you remove it when committing Ian?

Thanks.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#5 lore raw

Re: [PATCH 2/2] oss-test: add FreeBSD PVHVM installer

Roger Pau Monné writes ("Re: [PATCH 2/2] oss-test: add FreeBSD PVHVM installer"):

Quoted 5 lines · Roger Pau Monne
Quoted 1 line

+our $xl= toolstack()->{Command};

The line above is not needed at all, I've just used it for testing, could you remove it when committing Ian?

Willdo, thanks.

Ian.

#2 lore raw

Re: [PATCH 1/2] oss-test: add UFS rw support to pvops kernel

In reply to Roger Pau Monne

Roger Pau Monne writes ("[PATCH 1/2] oss-test: add UFS rw support to pvops kernel"):

Quoted 1 line

This is needed in order to mount and modify the FreeBSD VM images.

Thanks. I have pushed this one right away to osstest staging ("pretest") in the hope that it will do a build for me and safe the effort of doing so myself :-).

I have a work-in-progress fixup and integration of your FreeBSD test.

Ian.