FreeBSD on OpenStack: cloud-init scripts for FreeBSD
This project is maintained by pellaeon
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.
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 is a Python script based on cloudbase-init that do various tasks to prepare the FreeBSD instance for cloud environment.
Features:
A shell script to transform VM into OpenStack VM Template and installs bsd-cloudinit
Features:
/etc/rc.local
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
.
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.
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.
If you installed on VIRTIO disk, there should be nothing to worry about.
To make sure, disk names in /etc/fstab
should be vtbd
.
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!
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
ntpdate
on first boot/home/freebsd
wrong permission.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.
If you like our project, please consider sending Bitcoin to 17sei77Rt29wQ7cx4hqznQ2esMA49Fj9KQ