Generate Diskless Image

The copycds command copies the contents of the Linux media to /install/<os>/<arch> so that it will be available for installing nodes or creating diskless images. After executing copycds, there are several osimage definitions created by default. Run lsdef -t osimage to view these images:

lsdef -t osimage

The output should be similar to the following:

rhels8.5.0-ppc64le-install-compute  (osimage)
rhels8.5.0-ppc64le-install-service  (osimage)
rhels8.5.0-ppc64le-netboot-compute  (osimage)

The netboot-compute is the default diskless osimage created for rhels8.5 ppc64le. Run genimage to generate a diskless image based on the rhels8.5.0-ppc64le-netboot-compute definition:

genimage rhels8.5.0-ppc64le-netboot-compute

Before packing the diskless image, you have the opportunity to change any files in the image by changing to the rootimgdir and making modifications. (e.g. /install/netboot/rhels7.1/ppc64le/compute/rootimg).

However it’s recommended that all changes to the image are made via post install scripts so that it’s easily repeatable. Refer to Prescripts and Postscripts for more details.

Pack Diskless Image

After running genimage to create the image, run packimage to create the ramdisk:

packimage rhels8.5.0-ppc64le-netboot-compute

Export and Import Image

Overview

Note

There is a current restriction that exported 2.7 xCAT images cannot be imported on 2.8 xCAT https://sourceforge.net/p/xcat/bugs/3813/.

We want to create a system of making xCAT images more portable so that they can be shared and prevent people from reinventing the wheel. While every install is unique there are some things that can be shared among different sites to make images more portable. In addition, creating a method like this allows us to create snap shots of images we may find useful to revert to in different situations.

Image exporting and importing is supported for stateful (diskful) and stateless (diskless) clusters. The following documentation will show how to use imgexport to export images and imgimport to import images.

Exporting an image

Working image:

lsdef -t osimage myimage
Object name: myimage
exlist=/install/custom/netboot/sles/compute1.exlist
imagetype=linux
netdrivers=e1000
osarch=ppc64le
osname=Linux
osvers=sles12
otherpkgdir=/install/post/otherpkgs/sles12/ppc64
otherpkglist=/install/custom/netboot/sles/compute1.otherpkgs.pkglist
pkgdir=/install/sles11/ppc64le
pkglist=/install/custom/netboot/sles/compute1.pkglist
postinstall=/install/custom/netboot/sles/compute1.postinstall
profile=compute1
provmethod=netboot
rootimgdir=/install/netboot/sles12/ppc64le/compute1
synclists=/install/custom/netboot/sles/compute1.list

Run the imgexport command:

imgexport myimage -p node1 -e /install/postscripts/myscript1 -e /install/postscripts/myscript2

A bundle file called myimage.tgz will be created under the current directory. The bundle file contains the ramdisk, boot kernel, the root image and all the configuration files for generating the image for a diskless node. For diskful, it contains the kickstart/autoyast configuration file. (see appendix). The optional -p flag puts the names of the postscripts for node1 into the image bundle. The optional -e flags put additional files into the bundle. In this case two postscripts myscript1 and myscript2 are included. This image can now be used on other systems.

Importing an image

  1. Download the image bundle file generated by the imgexport.

  2. Run the imgimport command.:

    imgimport myimage.tgz -p group1
    

This command fills out the osimage and linuximage tables, and populates file directories with appropriate files from the image bundle file such as ramdisk, boot kernel, root image, configuration files for diskless. Any additional files that come with the bundle file will also be put into the appropriate directories. If optional -p flag is specified, the postscript names that come with the image will be put the into the postscripts table for the given node or group.

Copy an image to a new image name on the MN

Very often, the user wants to make a copy of an existing image on the same xCAT MN as a start point to make modifications. In this case, you can run imgexport first as described above, then run imgimport with -f flag to change the profile name of the image. That way the image will be copied into a different directory on the same xCAT MN.:

imgimport myimage.tgz -p group1 -f compute2

Modify an image (optional)

Skip this section if you want to use the image as is.

  1. You can modify the image to fit your needs. The following can be modified.

  • .pkglist file to add or remove packages that are from the os distro

  • .otherpkgs.pkglist to add or remove packages from other sources. Refer to Using updatenode for details

  • For diskful, .tmpl file to change the kickstart/autoyast configuration

  • .synclist file to change the files that are going to be synchronized to the nodes

  • postscripts table for the nodes to be deployed

  • the osimage and/or linuximage tables for the location of the source rpms and the rootimage location

  1. Run genimage:

    genimage image_name
    
  2. Run packimage:

    packimage image_name
    

Deploying nodes

You can now deploy the node with the new <image_name>

rinstall <noderange> osimage=<image_name>

Appendix

You can only export/import one image at a time. Each tarball will have the following simple structure:

manifest.xml
<files>
extra/ (optional)

manifest.xml

The manifest.xml will be analogous to an autoyast or windows unattend.xml file where it tells xCAT how to store the items. The following is an example for a diskless cluster:

manifest.xml:

<?xml version="1.0"?>
<xcatimage>
  <exlist>/install/custom/netboot/sles/compute1.exlist</exlist>
  <extra>
    <dest>/install/postscripts</dest>
    <src>/install/postscripts/myscript1</src>
  </extra>
  <imagename>myimage</imagename>
  <imagetype>linux</imagetype>
  <kernel>/install/netboot/sles12/ppc64le/compute1/kernel</kernel>
  <netdrivers>e1000</netdrivers>
  <osarch>ppc64le</osarch>
  <osname>Linux</osname>
  <osvers>sles12</osvers>
  <otherpkgdir>/install/post/otherpkgs/sles12/ppc64</otherpkgdir>
  <otherpkglist>/install/custom/netboot/sles/compute1.otherpkgs.pkglist</otherpkglist>
  <pkgdir>/install/sles12/ppc64le</pkgdir>
  <pkglist>/install/custom/netboot/sles/compute1.pkglist</pkglist>
  <postbootscripts>my4,otherpkgs,my3,my4</postbootscripts>
  <postinstall>/install/custom/netboot/sles/compute1.postinstall</postinstall>
  <postscripts>syslog,remoteshell,my1,configrmcnode,syncfiles,my1,my2</postscripts>
  <profile>compute1</profile>
  <provmethod>netboot</provmethod>
  <ramdisk>/install/netboot/sles12/ppc64le/compute1/initrd-diskless.gz</ramdisk>
  <rootimg>/install/netboot/sles12/ppc64le/compute1/rootimg.gz</rootimg>
  <rootimgdir>/install/netboot/sles12/ppc64le/compute1</rootimgdir>
  <synclists>/install/custom/netboot/sles/compute1.list</synclists>
</xcatimage>

In the above example, we have a directive of where the files came from and what needs to be processed.

Note that even though source destination information is included, all files that are standard will be copied to the appropriate place that xCAT thinks they should go.

Exported files

The following files will be exported, assuming x is the profile name:

For diskful:

x.pkglist
x.otherpkgs.pkglist
x.tmpl
x.synclist

For diskless:

kernel
initrd.gz
rootimg.gz
x.pkglist
x.otherpkgs.pkglist
x.synclist
x.postinstall
x.exlist

Note

Although the postscripts names can be exported by using the -p flag, the postscripts themselves are not included in the bundle file by default. Use -e flag to get them included one by one if needed.