bsd-cloudinit

FreeBSD on OpenStack: cloud-init scripts for FreeBSD

This project is maintained by pellaeon

FreeBSD on OpenStack

There has not been a complete solution to run FreeBSD instances on OpenStack, until now.

With bsd-cloudinit and bsd-cloudinit-installer, you could build a FreeBSD VM image that takes advantage of the cloud environment.

Components

The entire project to run FreeBSD on OpenStack is called Feng Li Su (鳳梨酥), a kind of cuboid-shaped sweet Taiwanese pastry with soft crust and pineapple fillings.

bsd-cloudinit-installer installs bsd-cloudinit, and make /etc/rc.local invoke bsd-cloudinit at first boot.

bsd-cloudinit

bsd-cloudinit is a Python script based on cloudbase-init that do various tasks to prepare the FreeBSD instance for cloud environment.

Features:

bsd-cloudinit-installer

A shell script to transform VM into OpenStack VM Template and installs bsd-cloudinit

Features:

Pre-built image

We have experimental pre-built images available for download.

You can use the following command to upload the image to Glance

glance image-create --name "FreeBSD 9.2" --disk-format qcow2 \
 --container-format bare < freebsd-9.2-fls-cloudimage-v3.img

bsd-cloudinit will inject your SSH public key into the instance, just log in with username freebsd.

bsd-cloudinit will set freebsd and root user password to random for security. If for some reason bsd-cloudinit was not executed, root password will not be changed. The original root password for all our prebuilt images are fenglisu.

Build a FreeBSD VM image for OpenStack

If you would like to build your own image, follow the guides below.

bsd-cloudinit-installer is the VM image maker, it transforms a VM into a OpenStack VM image.

Install FreeBSD via virt-manager

First you'll have to install a normal FreeBSD (only version 10.x tested) VM via virt-manager or similiar tools.

When creating the VM, configure its disk and network to use VIRTIO. Since FreeBSD 9.2 it should be able to detect it correctly.

Note: bsd-cloudinit will set all network interfaces except lo0, plip0, pflog0 to use DHCP!

The virtual disk size should be as small as possible, so it'll be quicker to deploy and upload. FreeBSD requires root partition to be at least 1GB, so you should create a virtual disk slightly larger than 1GB. (We use 1.1GB in our released experimental images.)

The root partition must be the last partition on the disk, so that bsd-cloudinit could grow the partition on first boot.

There should be no need for SWAP. (there is no SWAP in the official Ubuntu cloud images either) But if you want SWAP, always make sure / is on the last partition.

After installation completes, do the following actions as root to prepare the VM for transformation.

VIRTIO

If you installed on VIRTIO disk, there should be nothing to worry about. To make sure, disk names in /etc/fstab should be vtbd.

Download and execute bsd-cloudinit-installer

The installer will modify some system configuration files, and install bsd-cloudinit and its Python dependencies.

fetch --no-verify-peer https://raw.github.com/pellaeon/bsd-cloudinit-installer/master/installer.sh
chmod +x installer.sh
./installer.sh

After this step, the VM is no longer a normal VM and not suitable for use with virt-manager.

Follow instruction of the installer to clean command history.

Shutdown

shutdown -p now

After shutting down, the VM's virtual disk is ready to be deployed in OpenStack, just upload it to Glance

glance image-create --name "FreeBSD 9.2" --disk-format qcow2 \
 --container-format bare < freebsd-9.2-fls-cloudimage-v3.img

Then the image is ready to be deployed! Launch an instance to test it!

Further configurations

FreeBSD currently does not support DHCP interface-mtu option (bug 187094). If your VM internal network uses MTU other than 1500, FreeBSD will ignore the option from the assigning DHCP server. You can work around this by manually setting the interface MTU in /etc/rc.local:

ifconfig vtnet0 mtu 1450

Planned Features

Changelog

Authors and Contributors

bsd-cloudinit is built by @pellaeon, @apua, @iblis17 from Information Technology Service Center of National Chiao Tung University in Taiwan.

This project is based on cloudbase-init, we share most of non-OS-specific code. Great thanks to them.

Donation

If you like our project, please consider sending Bitcoin to 17sei77Rt29wQ7cx4hqznQ2esMA49Fj9KQ

Users

DigitalOcean