ironic-python-agent/imagebuild/tinyipa
Riccardo Pittau ec4a2611e7 Build tinyipa with python3
This patch uses ``USE_PYTHON3`` variable to build
Ironic Python Agent with python 3 inside a tinycore
image.
It modifies the content of ``buildreqs.lst`` and
``finalreqs.lst``, adding specific package files
based on the python version used to build IPA.
Since we're using python 3.6, bytecode optimized
files have .pyc extension and are located under a
__pycache__ dir [1]; as an optimization option,to
reduce the size of the final image, all bytecode
generated files will be moved to the original
source location and the source code will be
removed.

[1] https://www.python.org/dev/peps/pep-0488/

Change-Id: I3448a5f41eff6736274308f924d9ad8f059e6c44
Story: #2002598
Task: #22210
Depends-On: https://review.openstack.org/634646
2019-02-04 10:05:57 +01:00
..
build_files Build tinyipa with python3 2019-02-04 10:05:57 +01:00
.gitignore Add option for building IPMItool into TinyIPA 2017-05-22 13:26:26 +01:00
Makefile Fix addssh make target in tinyipa 2017-12-22 10:07:11 +00:00
README.rst Allow using ironic-lib from source when building tinyipa 2018-10-02 13:42:57 +02:00
add-ssh-tinyipa.sh Fix addssh make target in tinyipa 2017-12-22 10:07:11 +00:00
build-instance-images.sh Update tiny-instance image to contain branch name 2017-10-25 14:47:11 +00:00
build-iso.sh Add script to install missing tinyipa dependencies 2016-04-11 11:28:48 +01:00
build-tinyipa.sh Build tinyipa with python3 2019-02-04 10:05:57 +01:00
common.sh Update tiny-instance image to contain branch name 2017-10-25 14:47:11 +00:00
finalise-tinyipa.sh Build tinyipa with python3 2019-02-04 10:05:57 +01:00
install-deps.sh imagebuild: tinyipa: Make the install-deps.sh SUSE aware 2017-02-09 14:45:39 +00:00
tc-mirror.sh Comment on when the TinyCore mirror list was generated 2016-12-14 09:14:54 -08:00
udhcpc.script Rescue bug: tinyipa fails to acquire IP in multitenant env 2018-05-15 14:33:36 +07:00

README.rst

Tiny Core Ironic Python Agent

Build script requirements

For the main build script:

  • wget
  • pip
  • unzip
  • sudo
  • awk
  • mksquashfs

For building an ISO you'll also need:

  • genisoimage

Instructions:

To create a new ramdisk, run:

make

or:

./build-tinyipa.sh && ./finalise-tinyipa.sh

This will create two new files once completed:

  • tinyipa.vmlinuz
  • tinyipa.gz

These are your two files to upload to glance for use with Ironic.

Building an ISO from a previous make run:

Once you've built tinyipa it is possible to pack it into an ISO if required. To create a bootable ISO, run:

make iso

or:

./build-iso.sh

This will create one new file once completed:

  • tinyipa.iso

To build a fresh ramdisk and build an iso from it:

Run:

make all

To clean up the whole build environment run:

Run:

make clean

For cleaning up just the iso or just the ramdisk build:

make clean_iso

or:

make clean_tinyipa

Advanced options

(De)Optimizing the image

If you want the build script to preinstall everything into the ramdisk, instead of loading some things at runtime (this results in a slightly bigger ramdisk), before running make or build-tinyipa.sh run:

export BUILD_AND_INSTALL_TINYIPA=true

By default, building TinyIPA will compile most of the Python code to optimized *.pyo files, completely remove most of *.py and *.pyc files, and run ironic-python-agent with PYTHONOPTIMIZE=1 to save space on the ramdisk. If instead you want a normal Python experience inside the image, for example for debugging/hacking on IPA in a running ramdisk, before running make or build-tinyipa.sh run:

export PYOPTIMIZE_TINYIPA=false

Enabling/disabling SSH access to the ramdisk

By default tinyipa will be built with OpenSSH server installed but no public SSH keys authorized to access it.

If you want to enable SSH access to the image, set AUTHORIZE_SSH variable in your shell before building the tinyipa:

export AUTHORIZE_SSH=true

By default it will use public RSA or DSA keys of the user running the build. To provide other public SSH key, export path to it in your shell before building tinyipa as follows:

export SSH_PUBLIC_KEY=<full-path-to-public-key>

If you want to disable SSH altogether, set INSTALL_SSH variable in your shell to false before building the tinyipa:

export INSTALL_SSH=false

You can also rebuild an already built tinyipa image by using addssh make tagret:

make addssh

This will fetch the pre-built tinyipa image from "tarballs.openstack.org" using the version specified as BRANCH_NAME shell variable as described above, or it may use an already downloaded ramdisk image if path to it is set as TINYIPA_RAMDISK_FILE shell variable before running this make target. It will install and configure OpenSSH if needed and add public SSH keys for tc user using the same SSH_PUBLIC_KEY shell variable as described above.

Enabling biosdevname in the ramdisk

If you want to collect BIOS given names of NICs in the inventory, set TINYIPA_REQUIRE_BIOSDEVNAME variable in your shell before building the tinyipa:

export TINYIPA_REQUIRE_BIOSDEVNAME=true

Using ironic-lib from source

ironic-lib contains important parts of the provisioning logic. If you need to build an IPA image with your local checkout of ironic-lib, export the following variable:

export IRONIC_LIB_SOURCE=/absolute/path/to/ironic-lib/checkout