Ironic is an OpenStack project that provides bare metal (as opposed to virtual machines).A tool called the Ironic Python Agent (IPA) is used to control and configure these physical nodes, performing tasks such as wiping machines and writing images to disk.This is accomplished by booting a custom Linux kernel and running IPA and connecting to the Ironic Conductor with an initramfs image.The Ironic project supports several different image builders through Disk Image Builder, including CoreOS, TinyCore, and others.However, these image builders have limitations, such as requiring root privileges and their sizes being several hundred megabytes (except for TinyCore).One of the downsides of TinyCore is its limited hardware support; while it is not used in production, it is used for OpenStack gate testing (booting in virtual machines with about 300MB of RAM).Large deployment images mean longer configuration times for nodes, so the author began creating a small, customizable image to address the issues of other existing images.
BuildrootThe author chose to use Buildroot, which is considered easy to use for building embedded Linux images. So far, it has been quite successful as a proof of concept. The Linux kernel is ~2MB The compressed initramfs image is ~25MB Through OpenStack Ironic gate testing Highly customizable (thanks to Buildroot)Can be customized through a menuconfig system, similar to the Linux kernel.
Buildroot menuconfig
Source CodeAll the source code used to build the image is located in the ipa-buildroot repository on the author’s GitHub account (https://github.com/csmart/ipa-buildroot). The author has also written some documentation to guide you through the entire build and customization process. The ipa-buildroot repository contains IPA-specific Buildroot configurations and tracks upstream Buildroot in Git submodules. By using upstream Buildroot and external repositories, the IPA Buildroot configuration appears as an option for regular Buildroot builds.
IPA in the default configuration list of Buildroot
Buildroot will compile the kernel and initramfs, then release build scripts that clone the Ironic Python Agent repository and create Python Wheels for the target. The following final images will be found in ./output/images: bzImage (kernel) rootfs.cpio.xz (ramdisk) rootfs.iso9660 (ISO image) These files can be uploaded to Glance for use with Ironic.
CustomizationBuildroot allows you to customize build parameters, target initramfs, and the Linux kernel. This is also straightforward; every time you run make, it returns to where you left off and recreates your image.
The build script directly fetches the Ironic Python Agent, making the build highly flexible to obtain the exact version to use. You can specify the location and branch of the Ironic Python Agent and requirements repository by customizing settings in Buildroot’s menuconfig.
Setting the Ironic Python Agent and Requirement location, Git version
The author created the kernel configuration from scratch (using tinyconfig) and intentionally worked to balance size and functionality. It should boot on most Intel-based computers (BIOS and UEFI), but support for hardware such as hard drives and Ethernet controllers is intentionally limited. Our goal is to start small and add more support as needed, so modifications may be necessary to work on your hardware.
Using imagebuild scripts for automated buildsManual builds are great as they help understand the stitching process, but manual involvement is more.The Ironic Python Agent (IPA) repo has some image creation scripts that make building CoreOS and TinyCore images very simple.The author now provides some patches to add support for creating Buildroot images.These patches include several scripts, including a manual build method and a Makefile to integrate them.Only the install-deps.sh script requires root privileges, and if it detects no dependencies, all other Buildroot tasks will run as a non-privileged user.This is a significant advantage of the Buildroot approach!Again, the author has included documentation in the repo (https://github.com/csmart/ironic-python-agent/tree/buildroot/imagebuild/buildroot#buildroot-ironic-python-agent), so please refer to it for more details on how to build and customize images.But overall, doing this is quite simple:
These operations will automatically perform the following tasks: Fetch the Buildroot Git repository Load the default IPA Buildroot configuration Download and verify all source code Build the toolchain Using the toolchain to build: System libraries and packages Linux kernel Python Wheels for IPA and dependencies Create kernel, initramfs, and ISO images The default configuration points to the upstream IPA Git repository, but you can change it to point to any repo and commit you like. For example, if you are working on IPA, you can point Buildroot to a local Git repo and then build and boot that image for testing.
HelpTo see available Makefile targets, just run the help target: make helpIf you enter the -help option, then the shell script can also provide assistance:
Compiled by: Jonathan Zhang
Author: Chris Smart
Source: http://superuser.openstack.org/articles/openstack-ironic-buildroot/
Submission email: [email protected]