Adding New Lorax Composer Output Types
When lorax-composer version
is released it will support 3 output types.
partitioned-disk. Originally I was going to write about adding
support, but it ended up being a bit more
than it needed to be, so after re-arranging the code to support all of the
livemedia-creator output types, we’ll talk about adding partitioned disk
lorax-composer is an API on top of livemedia-creator, which has a large number of supported output types. In order to make these work with an API and clients with minimal knowledge about the internals of building images and running Anaconda we need a few extra things.
A kickstart file needs to be added to
name of the kickstart is what will be used by the
/compose/types route, and the
compose_type field of the POST to start a compose.
It also needs to have
code added to the
pylorax.api.compose.compose_args() function. The
_MAP entry in this function defines what lorax-composer will pass to
pylorax.installer.novirt_install() when it runs the compose.
When the compose is finished the output files need to be copied out of the
build directory (
pylorax.api.compose.move_compose_results() handles this for each type. You
should move them instead of copying to save space.
If the new output type does not have support in livemedia-creator it should be added there first. This will make the output available to the widest number of users.
Example: Add partitioned disk support
Partitioned disk support is something that livemedia-creator already supports
--make-disk cmdline argument. To add this to lorax-composer it
needs 3 things:
- A new entry in the
- Add a bit of code to
pylorax.api.compose.move_compose_results()to move the disk image from the compose directory to the results directory.
partitioned-disk.ks is pretty similar to the example minimal kickstart
./docs/rhel7-minimal.ks. You should remove the
commands, they will be added by the compose process. Make sure the bootloader
packages are included in the
%packages section at the end of the kickstart,
and you will want to leave off the
%end so that the compose can append the
list of packages from the recipe.
_MAP entry should be a copy of one of the existing entries, but with
True. Make sure that none of the other
make_* options are
what the name of the final image will be.
move_compose_results() can be as simple as moving the output file into
the results directory, or it could do some post-processing on it. The end of
the function should always clean up the
./compose/ directory, removing any
unneeded extra files. This is especially true for the
live-iso since it produces
the contents of the iso as well as the boot.iso itself.